# Get the contract

The contract is the structured list of every field Emboss detected on a form: its labels, types, data types, and positions. Fetch it once detection is ready to verify or map your own data against the fields.

## Get the contract

```
GET /forms/{id}/contract
```

Authentication: Bearer API key required.

Return the detected-fields contract for a form once detection is complete. The body is { id, contract }: read the fields from contract.fields. Pages count from 0, and value is always null: the contract describes the form; a fill never writes into it.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| id | path | string | yes | The form id to fetch the contract for. |

```curl
curl https://api.getemboss.ai/forms/6c47f7f5-f921-4698-910f-95dd7d81310b/contract \
  -H "Authorization: Bearer sk_..."
```

```js
const res = await fetch("https://api.getemboss.ai/forms/6c47f7f5-f921-4698-910f-95dd7d81310b/contract", {
  headers: { Authorization: "Bearer sk_..." },
});
if (res.status === 409) {
  // detection not ready yet -- poll again shortly
}
const { contract } = await res.json(); // fields: contract.fields
```

```python
import requests

res = requests.get(
    "https://api.getemboss.ai/forms/6c47f7f5-f921-4698-910f-95dd7d81310b/contract",
    headers={"Authorization": "Bearer sk_..."},
)
if res.status_code == 409:
    pass  # detection not ready yet -- poll again shortly
contract = res.json()["contract"]
```

### Response

```json
{
  "id": "6c47f7f5-f921-4698-910f-95dd7d81310b",
  "contract": {
    "schema_version": "1.0",
    "page_count": 1,
    "field_count": 3,
    "form": { "title": "Form W-9" },
    "fields": [
      {
        "id": 1,
        "name": "business_name",
        "label": "Business name",
        "type": "text",
        "data_type": "organization",
        "required": true,
        "page": 0,
        "rect": { "x": 72, "y": 540, "width": 320, "height": 18 },
        "description": "The legal name of the business.",
        "section": "Part I",
        "value": null
      },
      {
        "id": 7,
        "label": "Exempt payee code applies",
        "type": "checkbox",
        "data_type": "boolean",
        "required": false,
        "page": 0,
        "rect": { "x": 88, "y": 470, "width": 12, "height": 12 },
        "value": null
      },
      {
        "id": 14,
        "label": "Signature",
        "type": "signature",
        "data_type": "signature",
        "required": true,
        "page": 0,
        "rect": { "x": 72, "y": 120, "width": 240, "height": 28 },
        "value": null
      }
    ]
  }
}
```

### Status codes

| Code | Meaning |
| --- | --- |
| 200 | Detection complete: { id, contract }. |
| 401 | Missing or invalid API key. |
| 404 | No such form, or owned by another key. |
| 409 | Contract not available: detection not ready. |

## See also

- [The contract shape](https://getemboss.ai/docs/the-contract-shape)
- [Turn a flat PDF into a fillable form](https://getemboss.ai/use-cases/flat-pdf-to-fillable)
