Developers /Docs API

Extract document fields

Extract a schema's fields (schema, fields or prompt) from a document.

POST/docs/v1/extract
POST example
curl --request POST \
  --url 'https://factget.dev/docs/v1/extract' \
  --header "Authorization: Bearer $FACTGET_DOCS_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "fileId": "YOUR_FILE_ID",
  "prompt": "Extract the company name, reporting period, and total revenue."
}'

Replace IDs and sample values with your own. Examples are not executed in your browser.

Authorization

Authorizationstring · header · required

Bearer Docs API key with the required scope. Learn about authentication →

Request body

application/json
fileIdstring | null

A file from POST /v1/files

urlstring | null

A public URL of the document

pagesstring | null

Pages to read, e.g. "1-10" or "3,7,12-15"

timeoutinteger

ms to wait before 202

Default: 120000minimum: 1000maximum: 300000
schemaobject | null

A JSON Schema

fieldsobject[] | null
maxItems: 5000
Show item properties
namestringrequired
minLength: 1maxLength: 200
descriptionstring | null
maxLength: 2000
typestring
Default: "string"Allowed: "string", "number", "integer", "boolean", "date"
sectionstring | null
maxLength: 200
unitstring | null
maxLength: 100
enumstring[] | null
maxItems: 200
promptstring | null

What to extract, in words (a schema is designed)

maxLength: 20000
generateOnlyboolean

With prompt: return the schema, do not extract

Default: false
Provide either a fileId from an upload or a public document URL. For extraction, also supply schema, fields, or prompt.

Responses

200Successful Response
application/json

The published schema does not define individual response fields for this endpoint. Inspect the returned JSON in your integration.

422Validation Error
application/json
detailobject[]
Show item properties
locstring | integer[]required
msgstringrequired
typestringrequired
inputobject
ctxobject

The API schema lists the responses above. Long-running operations can also return 202; see async jobs. For application errors, see errors & retries.