# Quick Start

> Get up and running with Axelered in minutes.

This guide walks you through the lifecycle of a document: from setting up your workspace to extracting structured data from a file.

<Mermaid
  chart="`
flowchart LR
  A[&#x22;Authenticate<br/><small>API Key</small>&#x22;] --> B[&#x22;Check Workspace<br/><small>Project Sandbox</small>&#x22;]
  B --> C[&#x22;Submit an Extraction<br/><small>Upload &amp; Extract</small>&#x22;]
  C --> D[&#x22;Read the Output<br/><small>Extracted fields</small>&#x22;]
`"
/>

***

### Step 1: Check your Workspace

A workspace is a secure sandbox. All your documents, Parsings and Operations are isolated within this boundary. Your API key is bound to one workspace and every call acts on it, so paths never name it.

```bash
curl "https://api.axelered.com/v1/workspace" \
  -H "Authorization: Bearer <your_api_key>"
```

***

### Step 2: Upload & Extract Data

An [Extraction](https://docs.axelered.com/extract) parses one Document and extracts the fields of your JSON Schema. Send the file in the same call: it becomes a Document of your workspace, kept for 30 days. `wait` keeps the request open up to 30 seconds for the Extraction to finish.

```bash
curl -X POST "https://api.axelered.com/v1/extractions?wait=30" \
  -H "Authorization: Bearer <your_api_key>" \
  -F "file=@/path/to/invoice.pdf" \
  -F "config={
    \"outputSchema\": {
      \"type\": \"object\",
      \"properties\": {
        \"totalAmount\": { \"type\": \"number\" },
        \"vendorName\": { \"type\": \"string\" }
      },
      \"required\": [\"totalAmount\"]
    },
    \"parsing\": { \"tier\": \"accurate\" },
    \"perimeter\": \"external\"
  }"
```

The response is the Extraction: `200` when it finished within `wait`, `202` while it is still running. The `perimeter` says where your data may go: `local` keeps it inside Axelered's infrastructure, `external` allows third-party providers. See [Perimeters](https://docs.axelered.com/config_guide).

***

### Step 3: Read the Output

Read the Extraction until its `status` is `done`. Its `output.value` carries the extracted fields.

```bash
curl "https://api.axelered.com/v1/extractions/{extraction_id}?wait=30" \
  -H "Authorization: Bearer <your_api_key>"
```

To read the Document itself as Markdown, text, HTML or JSON, submit a [Parsing](https://docs.axelered.com/parse) and read its Output. The Parsing reads the Document again and is billed on its own: an Operation never shares its Parsing.

```bash
curl -X POST "https://api.axelered.com/v1/parsings?wait=30" \
  -H "Authorization: Bearer <your_api_key>" \
  -F "documentId={document_id}" \
  -F 'config={"tier": "accurate"}'

curl "https://api.axelered.com/v1/parsings/{parsing_id}/output?format=markdown" \
  -H "Authorization: Bearer <your_api_key>"
```

The `documentId` is in the Extraction: pass it instead of uploading the file again.
