# Process a deal

With a key made on your **Deals** page, the same processing works on a deal that already exists,
addressed by its row id. Use these when your team also works the deal in Specter.

| Route | Scope | Does |
| --- | --- | --- |
| `GET /v1/ingest/rows/{rowId}/files` | `read` | The deal's files |
| `POST /v1/ingest/rows/{rowId}/files` | `rows:write` | Declare a file; answers its upload URL |
| `POST /v1/ingest/rows/{rowId}/process` | `processing` | Process the deal's documents |
| `GET /v1/ingest/rows/{rowId}/processing` | `read` | The latest job, its steps and its documents |
| `GET /v1/ingest/rows/{rowId}/findings` | `read` | The latest job's [findings](/processor/findings) |
| `GET /v1/ingest/rows/{rowId}/financials` | `read` | The deal's headline financials |

A deal's row id comes from [reading the page](/boards/read-and-write), or from the answer when
you [add the deal](/boards/read-and-write) with the same key.

## Add a file

```bash
curl -X POST https://neo-app-api-prod-836053680024.us-central1.run.app/v1/ingest/rows/$ROW_ID/files \
  -H "Authorization: Bearer $SPECTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "april.pdf", "contentType": "application/pdf", "sizeBytes": 471902, "documentType": "bank_statement"}'
```

A `201` answers the file in `data` and `uploadUrl` beside it. Upload the bytes exactly as for a
job — a `PUT` with the declared `Content-Type`, within 15 minutes
([Upload each file](/processor/send-documents#2-upload-each-file)).

## Process it

```bash
curl -X POST https://neo-app-api-prod-836053680024.us-central1.run.app/v1/ingest/rows/$ROW_ID/process \
  -H "Authorization: Bearer $SPECTER_KEY"
```

It processes every file on the deal, and answers like [starting a job](/processor/send-documents#3-start-the-job):
`201` a new job, `200` the job these files already started, `409 would_supersede` with the fields
a re-run would replace (send `{"replace": true}` to go ahead). The optional body takes
`idempotencyKey` and `replace`.

## Read it

`GET …/processing` answers the job — `status`, `events`, `documents` with their `extractions` —
the same `job` object as [Read results](/processor/read-results#the-job). A deal never processed
answers an empty job, not a `404`. `GET …/findings` and `GET …/financials` answer the
[findings](/processor/findings) and [financials](/processor/read-results#financials) on their own.

These routes share the board routes' limit of 120 requests a minute per key — see
[Rate limits](/rate-limits).
