> ## Documentation Index
> Fetch the complete documentation index at: https://exchanger-api.iexexchanger.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Upload files and submit verifications

> Attach a file to an order field, submit documents for identity or card verification, and check whether payment instructions are available for the order.

If a route requests an attachment, upload it before creating the order. For identity or card verification, create an upload intent first. Sign private calls with [HMAC v2](https://exchanger-api.iexexchanger.com/en/start/authentication.md) and replace `https://your-exchange` with your exchanger's address.

Before you begin, get an API key with the scopes for the calls you need.

| Request | Scope |
| - | - |
| Read the route contract | `public-api:exchange:routes:read` |
| Read route verification requirements | `public-api:verifications:read` or `public-api:exchange:routes:read` |
| Read order requirements through `/exchange/orders/{order}/verifications` | `public-api:verifications:read` or `public-api:orders:detail:read` |
| Upload a file or create an upload intent | `public-api:files:write` |
| Read an upload intent | `public-api:files:read` or `public-api:files:write` |
| Submit or read a verification | `public-api:verifications:write` to submit, `public-api:verifications:read` to read |

## Attach a file to an order field

1. Read the route contract.

   ```bash Request theme={null}
   node request.mjs GET '/api/v3/private/exchange/routes/2/details'
   ```

   Find the field in `result.operation_contract.contract.dynamic_fields`. Read its `key`, the limits in `file`, and the path in `upload.endpoint`.

2. Send one file to that path with `POST` and the `public-api:files:write` scope. This example uses field `81` in group `in` for route `2`. Substitute the path returned by your exchanger.

   ```bash Upload theme={null}
   curl --request POST \
     'https://your-exchange/api/v3/private/exchange/routes/2/fields/in/81/files' \
     --header 'Accept: application/json' \
     --header "Authorization: Bearer ${EXCHANGER_API_TOKEN}" \
     --header 'X-Api-Signature-Version: v2' \
     --header "X-Api-Timestamp: ${TIMESTAMP}" \
     --header "X-Api-Nonce: ${NONCE}" \
     --header "X-Api-Signature: sha256=${SIGNATURE}" \
     --form 'file=@attachment.csv'
   ```

   Set `TIMESTAMP`, `NONCE`, and `SIGNATURE` for this request. Use the SHA-256 hash of the bytes of `attachment.csv` to calculate the signature. cURL sets the multipart boundary. Send one `file` field per request.

   The [quickstart script](https://exchanger-api.iexexchanger.com/en/start/quickstart.md) signs the same bytes and sets the multipart boundary. Use the endpoint and file type returned for your field.

   ```bash theme={null}
   node request.mjs POST /api/v3/private/exchange/routes/2/fields/in/81/files \
     --file attachment.csv --file-type text/csv
   ```

   ```json 201 Created excerpt theme={null}
   {
     "state": 0,
     "result": {
       "file": {
         "token": "TOKEN_FROM_UPLOAD",
         "expires_at": "2026-07-01T12:00:00.000000Z"
       }
     }
   }
   ```

3. Put the token under the field key in the preflight and create-order bodies. For a field whose `key` is `attachment` and whose upload group is `in`, use the following fragment.

   ```json Order body excerpt theme={null}
   {
     "fields_in": {
       "attachment": ["TOKEN_FROM_UPLOAD"]
     }
   }
   ```

| Group in the upload path | Object in the order body |
| - | - |
| `in` | `fields_in` |
| `out` | `fields_out` |
| `direction` | `direction_fields` |
| `user` | `user_fields` |

A successful creation attaches the file to the order. The token is valid until `expires_at` for one integration, route, and field. Upload the file again for another order.

## Prepare a document for verification

Before creating an order, call `GET /api/v3/private/verifications/requirements?route_id=2` to check which verifications the route requires. Substitute your route ID.

1. For identity verification, call `GET /api/v3/private/verifications/identity`. Use `result.requirements.mode` to choose the next action.

   | `mode` | Action |
   | - | - |
   | `manual` | Render `form.fields`. Read the file field keys and upload rules from the form. |
   | `provider` | Send the customer to `handoff_url`. Read the requirements again to check the status in `current`. |
   | `unavailable` | Display the status from `current` and keep submission disabled. |

2. Create an upload intent with `POST /api/v3/private/files/upload-intents` and `public-api:files:write`. For standalone verification, supply `purpose`. To tie the upload to an order, add `resource_type: "order"` and its identifier in `resource_id`. This example attaches the document to a manual form field called `proof`. Use the published field key.

   ```json intent.json theme={null}
   {
     "purpose": "identity_verification",
     "resource_type": "order",
     "resource_id": "2696843857965",
     "field_key": "proof"
   }
   ```

   ```bash Create an upload intent theme={null}
   node request.mjs POST '/api/v3/private/files/upload-intents' --json intent.json
   ```

   For a card photo, set `purpose: "card_verification"`. Read `result.upload_intent.uuid`, `allowed_extensions`, `max_bytes`, and `expires_at` from the `201 Created` response. The initial status is `pending`.

3. Upload the document using the signed file request above. Replace the path, filename, and signature.

   ```http Verification upload request excerpt theme={null}
   POST /api/v3/private/files/upload-intents/00000000-0000-4000-8000-000000000001/commit HTTP/1.1
   Host: your-exchange
   Content-Type: multipart/form-data; boundary=example-boundary
   ```

   After `200 OK`, check `result.upload_intent.status`. To check status again, call `GET /api/v3/private/files/upload-intents/{intent}`.

| Intent status | Action |
| - | - |
| `pending` before `expires_at` | Upload one file. |
| `committed` before `expires_at` | Pass the UUID in your verification request. |
| `consumed` | The document is attached. Read the verification status. |
| `expired`, or `pending` or `committed` past `expires_at` | Create a new intent and upload the document again. |

The `expires_at` deadline applies both to uploading and to submitting the uploaded document. After the exchanger cleans up an unused intent, reading it returns HTTP 404.

## Submit a verification

| Scenario | Method and body |
| - | - |
| Standalone identity | `POST /api/v3/private/verifications/identity`. Put answers in `fields` and arrays of UUIDs under the file field keys in `file_intents_by_field`. |
| Standalone card or account | `POST /api/v3/private/verifications/cards`. Supply `card_number`, `currency_id`, and the primary photo UUID in `file_intent`. |
| Verification for an order | `POST /api/v3/private/exchange/orders/{order}/verifications/submit`. Put the body in `identity`, `card`, or both. |

Submission requires `public-api:verifications:write`. This order-specific request uses the `full_name` and `proof` fields returned by a manual form. Substitute the committed upload UUID.

```json verification.json theme={null}
{
  "identity": {
    "fields": {
      "full_name": "Ivan Ivanov"
    },
    "file_intents_by_field": {
      "proof": ["00000000-0000-4000-8000-000000000001"]
    }
  }
}
```

```bash Submit the verification theme={null}
node request.mjs POST \
  '/api/v3/private/exchange/orders/2696843857965/verifications/submit' \
  --json verification.json
```

```json 200 OK excerpt theme={null}
{
  "state": 0,
  "result": {
    "submitted": {
      "identity": {
        "status": {
          "key": "pending"
        }
      }
    }
  }
}
```

For standalone submission, the API returns `201 Created` and `result.verification`. For an order, read `result.submitted` and the updated `result.requirements`. If you submit both blocks and either fails, neither is submitted.

For order-specific card verification, use the card or account the customer pays from in `card.card_number` and the primary photo UUID in `card.file_intent`. If `card.additional_photos.enabled` in the requirements allows extra photos, put their UUIDs in `additional_file_intents` inside `card`.

## Check status and get payment instructions

Call `GET /api/v3/private/verifications/identity/{verification}` or `GET /api/v3/private/verifications/cards/{verification}` with `public-api:verifications:read`. For a new identity verification, pass `verification.uuid` as returned. For a card, save the numeric ID from `result.verification.id` or `result.submitted.card.id` and pass it as a string in the path. This identifies the particular submission even if a customer verifies their card again for the same order. Append `/actions` to check whether another submission is available after rejection (`allowed_actions.resubmit_after_reject.allowed` in `result.actions`).

For an order, call `GET /api/v3/private/exchange/orders/{order}/verifications` and read `identity` and `card` in `result.requirements`.

| Response | Action |
| - | - |
| `blocks_payment: true` and `can_submit: true` | Submit the documents for this verification. |
| `current.key: "pending"` | Wait for review and read the requirements again. |
| Both `blocks_payment` values are `false` | Request payment instructions. |
| `payment_instructions.status: "verification_required"` | The API returns `details: null`. Read the order requirements and complete the required verification. |

Card approval applies to the card or account the customer pays from. Check `blocks_payment` on the order itself, even when the customer already has an approved card in their profile. Once verification clears, use the status from a fresh payment instructions response.

## Account for AML when creating an order

If the exchanger checks the destination address at order creation, that check runs during `POST /api/v3/private/exchange/orders`. The value `can_create_order: true` in [preflight](https://exchanger-api.iexexchanger.com/en/guides/exchange/quote-and-preflight.md) confirms the local rules. The value `checks.external: "deferred"` indicates that external checks wait until creation.

If the check stops order creation, the API returns HTTP 422 with `error.code: "validation_failed"`. Read `error.details.fields` and show the customer the relevant message. Depending on its settings, the exchanger may also run AML checks when verifying incoming payment or before an automatic payout. Once an order exists, follow its [order and payment status](https://exchanger-api.iexexchanger.com/en/guides/exchange/payment-and-status.md).

## Recover after a network error

You can send an [Idempotency-Key](https://exchanger-api.iexexchanger.com/en/guides/reliability/idempotency.md) with the direct upload, intent creation, `commit`, and verification submission. Save a separate key for each request before sending it. On retry, use the same key and request with a fresh signature. For multipart, also preserve the filename and the file part's MIME type. The multipart boundary can change.

If the `commit` response is lost, read the current status by UUID. If the intent is `committed` and still within its deadline, submit the verification. If it is `pending` and still within its deadline, retry the upload with its original key. When the API returns a saved response with `Idempotency-Replayed: true`, its `status` reflects the original operation. Use `GET` to read the current status.

## Handle errors and protect documents

| Situation | Action |
| - | - |
| HTTP 403 when calling an operation | Check `error.code`. For `scope_denied`, verify the key scopes for the request. |
| HTTP 422 when uploading a file | Read `error.details.fields`. For an order field, fetch the route contract again. For a document, check the current upload intent. Check the format, size, and expiration. |
| HTTP 422 when submitting documents | Read `error.details.fields`. Check the form keys, upload expiration and status, and any binding to the order. |
| Verification rejected | Read `/actions`. Offer another submission when `result.actions.allowed_actions.resubmit_after_reject.allowed` is `true`. |

In production, send documents and file tokens over HTTPS. Keep the HMAC secret on your integration server. Exclude documents, file tokens, and payment details from request logs and traces. In a test environment, use test data to exercise upload, rejection, and resubmission.

> [card] [Create an order](https://exchanger-api.iexexchanger.com/en/guides/exchange/create-order.md)
>
> Send file tokens with the rest of the order form.

> [card] [Get payment instructions](https://exchanger-api.iexexchanger.com/en/guides/exchange/payment-and-status.md)
>
> Fetch payment instructions and check payment status.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.