# API quickstart
Source: https://docs.file.ai/quickstart/api

> Upload a file and read its structured values in about 5 minutes.

fileScout

# API quickstart

Copy pageCopy page

Upload a file and read its structured values in about 5 minutes.

Copy pageCopy page

**What you’ll have at the end:** a document uploaded through the API and its extracted values back as structured JSON, plus the `fileId` you need for every other guide.

**You need:** a fileAI workspace and an API key. Workspace admins create keys on the [Developer Portal](https://developer.file.ai). Keys only work on the instance that issued them.

The Developer Portal works with Developer Portal workspaces. If your workspace was set up in the fileAI app, create keys in the app instead: **Settings → API Keys** at [orion.file.ai](https://orion.file.ai).

1

Set your key and base URL

```
export FILEAI_API_KEY="your-api-key"
export FILEAI_BASE_URL="https://api.orion.file.ai/prod/v1"
```

Using a regional instance? Swap the host. See [Regions](/authentication#regions).Check the connection:

```
curl "$FILEAI_BASE_URL/health-check" -H "x-api-key: $FILEAI_API_KEY"
```

Response

```
{ "message": "Public API is up and running!" }
```

2

Request an upload URL

fileAI uploads go straight to storage. First ask for a presigned URL:

cURL

Python

Node.js

```
curl -X POST "$FILEAI_BASE_URL/files/upload" \
  -H "x-api-key: $FILEAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "fileName": "invoice.pdf", "fileType": "application/pdf" }'
```

```
import os, requests

BASE = os.environ["FILEAI_BASE_URL"]
HEADERS = {"x-api-key": os.environ["FILEAI_API_KEY"]}

upload = requests.post(
    f"{BASE}/files/upload",
    headers=HEADERS,
    json={"fileName": "invoice.pdf", "fileType": "application/pdf"},
).json()
```

```
const BASE = process.env.FILEAI_BASE_URL;
const headers = { "x-api-key": process.env.FILEAI_API_KEY };

const upload = await fetch(`${BASE}/files/upload`, {
  method: "POST",
  headers: { ...headers, "Content-Type": "application/json" },
  body: JSON.stringify({ fileName: "invoice.pdf", fileType: "application/pdf" }),
}).then((r) => r.json());
```

Response

```
{
  "uploadId": "…",
  "presignedUploadURL": "https://…",
  "s3Path": "…"
}
```

3

Upload the file

`PUT` the raw bytes to `presignedUploadURL`. The URL expires after 5 minutes.

```
curl -X PUT "<presignedUploadURL>" \
  -H "Content-Type: application/pdf" \
  --data-binary @invoice.pdf
```

Processing starts automatically once the upload lands.

4

Track processing

Poll the upload until its steps complete, or skip polling by passing a `callbackURL` when you request the upload ([processing callbacks](/deliver/callbacks)). [Async jobs](/api/async-jobs) compares the two.

```
curl "$FILEAI_BASE_URL/uploads/<uploadId>" -H "x-api-key: $FILEAI_API_KEY"
```

The response lists each processing step in `statuses` and the resulting documents in `files`. Note the `fileId` of your document.

5

Read the structured values

```
curl "$FILEAI_BASE_URL/files/<fileId>/values" -H "x-api-key: $FILEAI_API_KEY"
```

Response (trimmed)

```
{
  "formValues": [
    {
      "fileId": "…",
      "schemaName": "Invoice",
      "fields": [
        { "title": "Supplier", "type": "string", "value": "Northwind Supplies" },
        { "title": "Total due", "type": "number", "value": 4820 }
      ]
    }
  ],
  "count": 1,
  "currentPage": 1
}
```

`formValues` holds one entry per AI Schema, each with its `fields`: the field’s title, type and extracted value. [Data types](/extract/data-types) explains each value shape. To see where a value came from on the page, see [Citations and validations](/verify/citations-validations).

## 

[​

](#next-steps)

Next steps

## Shape the output with AI Schemas

Define exactly which fields you want, across one file or many.

## Large files and batches

Multipart uploads, batch registration and ZIP archives.

## Extract without storing

One-shot extract, split and classify jobs.

## Authentication and regions

API keys, regional base URLs and request conventions.

[Previous](/scout/overview)[

Upload files

Send files to fileAI one at a time, in batches of up to 100, in parts for large files, or as ZIP archives.

Next

](/ingest/uploads)

⌘I

## On this page

Back to top

*   [Next steps](#next-steps)
