archastro.platform.v1.resources.extractions
1# Copyright (c) 2026 ArchAstro Inc. Licensed under the MIT License. 2# This file is auto-generated by @archastro/sdk-generator. Do not edit. 3# Content hash: 0737f7cbe88e 4 5from __future__ import annotations 6 7from typing import Literal, Required, TypedDict 8 9from ...runtime.http_client import HttpClient, SyncHttpClient 10from ...types.extractions import Extraction 11 12 13class ExtractionCreateInput(TypedDict, total=False): 14 "Start an extraction" 15 16 agent: str | None 17 "Owning agent (`agt_...`) scopes the extraction and its outputs." 18 destination_kind: Required[Literal["config", "storage"]] 19 "Where outputs are written." 20 destination_path: str | None 21 "Destination virtual_path prefix. Required for `destination_kind=config`, where it must name at least one path segment (`.` and `..` segments are dropped)." 22 file: str | None 23 "Source file id (`fil_...`) for document extraction. Runs synchronously, so the source must be at most 10MB; larger files are rejected." 24 max_pages: int | None 25 "Crawl cap for `mode=site` must be at least 1 (defaults to 100; `link` is always 1)." 26 mode: Literal["link", "site"] | None 27 "Required with `url`. Document extraction is selected by `file` instead and takes no `mode` (its `kind` is `document`)." 28 org: str | None 29 "Owning organization (`org_...`). Defaults to the viewer's org." 30 url: str | None 31 "Source URL for link/site extraction." 32 33 34class AsyncExtractionResource: 35 def __init__(self, http: HttpClient): 36 self._http = http 37 38 async def create(self, input: ExtractionCreateInput) -> Extraction: 39 """ 40 Start an extraction 41 Records a text-extraction job for a document (`file`) or a URL (`url` + `mode`). 42 The job is owner-scoped and tagged with the caller-supplied `destination` 43 namespace, **without** committing knowledge to an agent (no embeddings, no 44 agent attach). 45 Exactly one of `file` or (`url` + `mode`) is required. 46 Document extraction (`file`) runs synchronously: the response already 47 reflects the final state (`done` with its output, or an error if extraction 48 couldn't complete), status `201`. URL extraction (`url` + `mode`) submits an 49 async crawl and returns immediately with state `running`, status `202` 50 poll `GET /extractions/:extraction` for its terminal state. 51 52 Args: 53 input: Request body. 54 input.agent: Owning agent (`agt_...`) scopes the extraction and its outputs. 55 input.destination_kind: Where outputs are written. 56 input.destination_path: Destination virtual_path prefix. Required for `destination_kind=config`, where it must name at least one path segment (`.` and `..` segments are dropped). 57 input.file: Source file id (`fil_...`) for document extraction. Runs synchronously, so the source must be at most 10MB; larger files are rejected. 58 input.max_pages: Crawl cap for `mode=site` must be at least 1 (defaults to 100; `link` is always 1). 59 input.mode: Required with `url`. Document extraction is selected by `file` instead and takes no `mode` (its `kind` is `document`). 60 input.org: Owning organization (`org_...`). Defaults to the viewer's org. 61 input.url: Source URL for link/site extraction. 62 63 Returns: 64 The extraction job. Document extraction returns `201` with `state: "done"`; link/site extraction returns `202` with `state: "running"`. 65 """ 66 return await self._http.request( 67 "/api/v1/extractions", 68 method="POST", 69 body=input, 70 response_type=Extraction, 71 ) 72 73 async def get(self, extraction: str) -> Extraction: 74 """ 75 Retrieve an extraction 76 Returns a single extraction job and its current state. Poll this endpoint after 77 starting an async (link/site) extraction until `state` is `done` or `failed`. 78 An extraction that exists but is not visible to the current viewer returns `404` 79 rather than `403`, so the resource's existence is not revealed. 80 81 Args: 82 extraction: Extraction ID (`ext_...`). 83 84 Returns: 85 The extraction job. 86 """ 87 return await self._http.request( 88 f"/api/v1/extractions/{extraction}", 89 response_type=Extraction, 90 ) 91 92 93class ExtractionResource: 94 def __init__(self, http: SyncHttpClient): 95 self._http = http 96 97 def create(self, input: ExtractionCreateInput) -> Extraction: 98 """ 99 Start an extraction 100 Records a text-extraction job for a document (`file`) or a URL (`url` + `mode`). 101 The job is owner-scoped and tagged with the caller-supplied `destination` 102 namespace, **without** committing knowledge to an agent (no embeddings, no 103 agent attach). 104 Exactly one of `file` or (`url` + `mode`) is required. 105 Document extraction (`file`) runs synchronously: the response already 106 reflects the final state (`done` with its output, or an error if extraction 107 couldn't complete), status `201`. URL extraction (`url` + `mode`) submits an 108 async crawl and returns immediately with state `running`, status `202` 109 poll `GET /extractions/:extraction` for its terminal state. 110 111 Args: 112 input: Request body. 113 input.agent: Owning agent (`agt_...`) scopes the extraction and its outputs. 114 input.destination_kind: Where outputs are written. 115 input.destination_path: Destination virtual_path prefix. Required for `destination_kind=config`, where it must name at least one path segment (`.` and `..` segments are dropped). 116 input.file: Source file id (`fil_...`) for document extraction. Runs synchronously, so the source must be at most 10MB; larger files are rejected. 117 input.max_pages: Crawl cap for `mode=site` must be at least 1 (defaults to 100; `link` is always 1). 118 input.mode: Required with `url`. Document extraction is selected by `file` instead and takes no `mode` (its `kind` is `document`). 119 input.org: Owning organization (`org_...`). Defaults to the viewer's org. 120 input.url: Source URL for link/site extraction. 121 122 Returns: 123 The extraction job. Document extraction returns `201` with `state: "done"`; link/site extraction returns `202` with `state: "running"`. 124 """ 125 return self._http.request( 126 "/api/v1/extractions", 127 method="POST", 128 body=input, 129 response_type=Extraction, 130 ) 131 132 def get(self, extraction: str) -> Extraction: 133 """ 134 Retrieve an extraction 135 Returns a single extraction job and its current state. Poll this endpoint after 136 starting an async (link/site) extraction until `state` is `done` or `failed`. 137 An extraction that exists but is not visible to the current viewer returns `404` 138 rather than `403`, so the resource's existence is not revealed. 139 140 Args: 141 extraction: Extraction ID (`ext_...`). 142 143 Returns: 144 The extraction job. 145 """ 146 return self._http.request(f"/api/v1/extractions/{extraction}", response_type=Extraction)
14class ExtractionCreateInput(TypedDict, total=False): 15 "Start an extraction" 16 17 agent: str | None 18 "Owning agent (`agt_...`) scopes the extraction and its outputs." 19 destination_kind: Required[Literal["config", "storage"]] 20 "Where outputs are written." 21 destination_path: str | None 22 "Destination virtual_path prefix. Required for `destination_kind=config`, where it must name at least one path segment (`.` and `..` segments are dropped)." 23 file: str | None 24 "Source file id (`fil_...`) for document extraction. Runs synchronously, so the source must be at most 10MB; larger files are rejected." 25 max_pages: int | None 26 "Crawl cap for `mode=site` must be at least 1 (defaults to 100; `link` is always 1)." 27 mode: Literal["link", "site"] | None 28 "Required with `url`. Document extraction is selected by `file` instead and takes no `mode` (its `kind` is `document`)." 29 org: str | None 30 "Owning organization (`org_...`). Defaults to the viewer's org." 31 url: str | None 32 "Source URL for link/site extraction."
Start an extraction
Destination virtual_path prefix. Required for destination_kind=config, where it must name at least one path segment (. and .. segments are dropped).
Source file id (fil_...) for document extraction. Runs synchronously, so the source must be at most 10MB; larger files are rejected.
Crawl cap for mode=site must be at least 1 (defaults to 100; link is always 1).
35class AsyncExtractionResource: 36 def __init__(self, http: HttpClient): 37 self._http = http 38 39 async def create(self, input: ExtractionCreateInput) -> Extraction: 40 """ 41 Start an extraction 42 Records a text-extraction job for a document (`file`) or a URL (`url` + `mode`). 43 The job is owner-scoped and tagged with the caller-supplied `destination` 44 namespace, **without** committing knowledge to an agent (no embeddings, no 45 agent attach). 46 Exactly one of `file` or (`url` + `mode`) is required. 47 Document extraction (`file`) runs synchronously: the response already 48 reflects the final state (`done` with its output, or an error if extraction 49 couldn't complete), status `201`. URL extraction (`url` + `mode`) submits an 50 async crawl and returns immediately with state `running`, status `202` 51 poll `GET /extractions/:extraction` for its terminal state. 52 53 Args: 54 input: Request body. 55 input.agent: Owning agent (`agt_...`) scopes the extraction and its outputs. 56 input.destination_kind: Where outputs are written. 57 input.destination_path: Destination virtual_path prefix. Required for `destination_kind=config`, where it must name at least one path segment (`.` and `..` segments are dropped). 58 input.file: Source file id (`fil_...`) for document extraction. Runs synchronously, so the source must be at most 10MB; larger files are rejected. 59 input.max_pages: Crawl cap for `mode=site` must be at least 1 (defaults to 100; `link` is always 1). 60 input.mode: Required with `url`. Document extraction is selected by `file` instead and takes no `mode` (its `kind` is `document`). 61 input.org: Owning organization (`org_...`). Defaults to the viewer's org. 62 input.url: Source URL for link/site extraction. 63 64 Returns: 65 The extraction job. Document extraction returns `201` with `state: "done"`; link/site extraction returns `202` with `state: "running"`. 66 """ 67 return await self._http.request( 68 "/api/v1/extractions", 69 method="POST", 70 body=input, 71 response_type=Extraction, 72 ) 73 74 async def get(self, extraction: str) -> Extraction: 75 """ 76 Retrieve an extraction 77 Returns a single extraction job and its current state. Poll this endpoint after 78 starting an async (link/site) extraction until `state` is `done` or `failed`. 79 An extraction that exists but is not visible to the current viewer returns `404` 80 rather than `403`, so the resource's existence is not revealed. 81 82 Args: 83 extraction: Extraction ID (`ext_...`). 84 85 Returns: 86 The extraction job. 87 """ 88 return await self._http.request( 89 f"/api/v1/extractions/{extraction}", 90 response_type=Extraction, 91 )
39 async def create(self, input: ExtractionCreateInput) -> Extraction: 40 """ 41 Start an extraction 42 Records a text-extraction job for a document (`file`) or a URL (`url` + `mode`). 43 The job is owner-scoped and tagged with the caller-supplied `destination` 44 namespace, **without** committing knowledge to an agent (no embeddings, no 45 agent attach). 46 Exactly one of `file` or (`url` + `mode`) is required. 47 Document extraction (`file`) runs synchronously: the response already 48 reflects the final state (`done` with its output, or an error if extraction 49 couldn't complete), status `201`. URL extraction (`url` + `mode`) submits an 50 async crawl and returns immediately with state `running`, status `202` 51 poll `GET /extractions/:extraction` for its terminal state. 52 53 Args: 54 input: Request body. 55 input.agent: Owning agent (`agt_...`) scopes the extraction and its outputs. 56 input.destination_kind: Where outputs are written. 57 input.destination_path: Destination virtual_path prefix. Required for `destination_kind=config`, where it must name at least one path segment (`.` and `..` segments are dropped). 58 input.file: Source file id (`fil_...`) for document extraction. Runs synchronously, so the source must be at most 10MB; larger files are rejected. 59 input.max_pages: Crawl cap for `mode=site` must be at least 1 (defaults to 100; `link` is always 1). 60 input.mode: Required with `url`. Document extraction is selected by `file` instead and takes no `mode` (its `kind` is `document`). 61 input.org: Owning organization (`org_...`). Defaults to the viewer's org. 62 input.url: Source URL for link/site extraction. 63 64 Returns: 65 The extraction job. Document extraction returns `201` with `state: "done"`; link/site extraction returns `202` with `state: "running"`. 66 """ 67 return await self._http.request( 68 "/api/v1/extractions", 69 method="POST", 70 body=input, 71 response_type=Extraction, 72 )
Start an extraction
Records a text-extraction job for a document (file) or a URL (url + mode).
The job is owner-scoped and tagged with the caller-supplied destination
namespace, without committing knowledge to an agent (no embeddings, no
agent attach).
Exactly one of file or (url + mode) is required.
Document extraction (file) runs synchronously: the response already
reflects the final state (done with its output, or an error if extraction
couldn't complete), status 201. URL extraction (url + mode) submits an
async crawl and returns immediately with state running, status 202
poll GET /extractions/:extraction for its terminal state.
Arguments:
- input: Request body.
- input.agent: Owning agent (
agt_...) scopes the extraction and its outputs. - input.destination_kind: Where outputs are written.
- input.destination_path: Destination virtual_path prefix. Required for
destination_kind=config, where it must name at least one path segment (.and..segments are dropped). - input.file: Source file id (
fil_...) for document extraction. Runs synchronously, so the source must be at most 10MB; larger files are rejected. - input.max_pages: Crawl cap for
mode=sitemust be at least 1 (defaults to 100;linkis always 1). - input.mode: Required with
url. Document extraction is selected byfileinstead and takes nomode(itskindisdocument). - input.org: Owning organization (
org_...). Defaults to the viewer's org. - input.url: Source URL for link/site extraction.
Returns:
The extraction job. Document extraction returns
201withstate: "done"; link/site extraction returns202withstate: "running".
74 async def get(self, extraction: str) -> Extraction: 75 """ 76 Retrieve an extraction 77 Returns a single extraction job and its current state. Poll this endpoint after 78 starting an async (link/site) extraction until `state` is `done` or `failed`. 79 An extraction that exists but is not visible to the current viewer returns `404` 80 rather than `403`, so the resource's existence is not revealed. 81 82 Args: 83 extraction: Extraction ID (`ext_...`). 84 85 Returns: 86 The extraction job. 87 """ 88 return await self._http.request( 89 f"/api/v1/extractions/{extraction}", 90 response_type=Extraction, 91 )
Retrieve an extraction
Returns a single extraction job and its current state. Poll this endpoint after
starting an async (link/site) extraction until state is done or failed.
An extraction that exists but is not visible to the current viewer returns 404
rather than 403, so the resource's existence is not revealed.
Arguments:
- extraction: Extraction ID (
ext_...).
Returns:
The extraction job.
94class ExtractionResource: 95 def __init__(self, http: SyncHttpClient): 96 self._http = http 97 98 def create(self, input: ExtractionCreateInput) -> Extraction: 99 """ 100 Start an extraction 101 Records a text-extraction job for a document (`file`) or a URL (`url` + `mode`). 102 The job is owner-scoped and tagged with the caller-supplied `destination` 103 namespace, **without** committing knowledge to an agent (no embeddings, no 104 agent attach). 105 Exactly one of `file` or (`url` + `mode`) is required. 106 Document extraction (`file`) runs synchronously: the response already 107 reflects the final state (`done` with its output, or an error if extraction 108 couldn't complete), status `201`. URL extraction (`url` + `mode`) submits an 109 async crawl and returns immediately with state `running`, status `202` 110 poll `GET /extractions/:extraction` for its terminal state. 111 112 Args: 113 input: Request body. 114 input.agent: Owning agent (`agt_...`) scopes the extraction and its outputs. 115 input.destination_kind: Where outputs are written. 116 input.destination_path: Destination virtual_path prefix. Required for `destination_kind=config`, where it must name at least one path segment (`.` and `..` segments are dropped). 117 input.file: Source file id (`fil_...`) for document extraction. Runs synchronously, so the source must be at most 10MB; larger files are rejected. 118 input.max_pages: Crawl cap for `mode=site` must be at least 1 (defaults to 100; `link` is always 1). 119 input.mode: Required with `url`. Document extraction is selected by `file` instead and takes no `mode` (its `kind` is `document`). 120 input.org: Owning organization (`org_...`). Defaults to the viewer's org. 121 input.url: Source URL for link/site extraction. 122 123 Returns: 124 The extraction job. Document extraction returns `201` with `state: "done"`; link/site extraction returns `202` with `state: "running"`. 125 """ 126 return self._http.request( 127 "/api/v1/extractions", 128 method="POST", 129 body=input, 130 response_type=Extraction, 131 ) 132 133 def get(self, extraction: str) -> Extraction: 134 """ 135 Retrieve an extraction 136 Returns a single extraction job and its current state. Poll this endpoint after 137 starting an async (link/site) extraction until `state` is `done` or `failed`. 138 An extraction that exists but is not visible to the current viewer returns `404` 139 rather than `403`, so the resource's existence is not revealed. 140 141 Args: 142 extraction: Extraction ID (`ext_...`). 143 144 Returns: 145 The extraction job. 146 """ 147 return self._http.request(f"/api/v1/extractions/{extraction}", response_type=Extraction)
98 def create(self, input: ExtractionCreateInput) -> Extraction: 99 """ 100 Start an extraction 101 Records a text-extraction job for a document (`file`) or a URL (`url` + `mode`). 102 The job is owner-scoped and tagged with the caller-supplied `destination` 103 namespace, **without** committing knowledge to an agent (no embeddings, no 104 agent attach). 105 Exactly one of `file` or (`url` + `mode`) is required. 106 Document extraction (`file`) runs synchronously: the response already 107 reflects the final state (`done` with its output, or an error if extraction 108 couldn't complete), status `201`. URL extraction (`url` + `mode`) submits an 109 async crawl and returns immediately with state `running`, status `202` 110 poll `GET /extractions/:extraction` for its terminal state. 111 112 Args: 113 input: Request body. 114 input.agent: Owning agent (`agt_...`) scopes the extraction and its outputs. 115 input.destination_kind: Where outputs are written. 116 input.destination_path: Destination virtual_path prefix. Required for `destination_kind=config`, where it must name at least one path segment (`.` and `..` segments are dropped). 117 input.file: Source file id (`fil_...`) for document extraction. Runs synchronously, so the source must be at most 10MB; larger files are rejected. 118 input.max_pages: Crawl cap for `mode=site` must be at least 1 (defaults to 100; `link` is always 1). 119 input.mode: Required with `url`. Document extraction is selected by `file` instead and takes no `mode` (its `kind` is `document`). 120 input.org: Owning organization (`org_...`). Defaults to the viewer's org. 121 input.url: Source URL for link/site extraction. 122 123 Returns: 124 The extraction job. Document extraction returns `201` with `state: "done"`; link/site extraction returns `202` with `state: "running"`. 125 """ 126 return self._http.request( 127 "/api/v1/extractions", 128 method="POST", 129 body=input, 130 response_type=Extraction, 131 )
Start an extraction
Records a text-extraction job for a document (file) or a URL (url + mode).
The job is owner-scoped and tagged with the caller-supplied destination
namespace, without committing knowledge to an agent (no embeddings, no
agent attach).
Exactly one of file or (url + mode) is required.
Document extraction (file) runs synchronously: the response already
reflects the final state (done with its output, or an error if extraction
couldn't complete), status 201. URL extraction (url + mode) submits an
async crawl and returns immediately with state running, status 202
poll GET /extractions/:extraction for its terminal state.
Arguments:
- input: Request body.
- input.agent: Owning agent (
agt_...) scopes the extraction and its outputs. - input.destination_kind: Where outputs are written.
- input.destination_path: Destination virtual_path prefix. Required for
destination_kind=config, where it must name at least one path segment (.and..segments are dropped). - input.file: Source file id (
fil_...) for document extraction. Runs synchronously, so the source must be at most 10MB; larger files are rejected. - input.max_pages: Crawl cap for
mode=sitemust be at least 1 (defaults to 100;linkis always 1). - input.mode: Required with
url. Document extraction is selected byfileinstead and takes nomode(itskindisdocument). - input.org: Owning organization (
org_...). Defaults to the viewer's org. - input.url: Source URL for link/site extraction.
Returns:
The extraction job. Document extraction returns
201withstate: "done"; link/site extraction returns202withstate: "running".
133 def get(self, extraction: str) -> Extraction: 134 """ 135 Retrieve an extraction 136 Returns a single extraction job and its current state. Poll this endpoint after 137 starting an async (link/site) extraction until `state` is `done` or `failed`. 138 An extraction that exists but is not visible to the current viewer returns `404` 139 rather than `403`, so the resource's existence is not revealed. 140 141 Args: 142 extraction: Extraction ID (`ext_...`). 143 144 Returns: 145 The extraction job. 146 """ 147 return self._http.request(f"/api/v1/extractions/{extraction}", response_type=Extraction)
Retrieve an extraction
Returns a single extraction job and its current state. Poll this endpoint after
starting an async (link/site) extraction until state is done or failed.
An extraction that exists but is not visible to the current viewer returns 404
rather than 403, so the resource's existence is not revealed.
Arguments:
- extraction: Extraction ID (
ext_...).
Returns:
The extraction job.