> For the complete documentation index, see [llms.txt](https://docs.terminal.africa/tship/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.terminal.africa/tship/regulatory-documents/purchase-regulatory-documents.md).

# Purchase Regulatory Documents

Purchase selected regulatory documents on a draft request and start generation.

`/regulatory-documents/purchase`

<mark style="color:green;">`POST`</mark> `https://api.terminal.africa/v1/regulatory-documents/purchase`

Charges the user's wallet using the amounts already stored on the draft from analyze. Document types must exist in `available_documents`.

All items must have valid HS codes before purchase succeeds.

#### Headers

| Name                                            | Type   | Description                      |
| ----------------------------------------------- | ------ | -------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Set value to `Bearer SECRET_KEY` |
| Content-Type<mark style="color:red;">\*</mark>  | String | Set value to `application/json`  |

#### Request Body

| Name                                              | Type   | Description                                                  |
| ------------------------------------------------- | ------ | ------------------------------------------------------------ |
| request\_id<mark style="color:red;">\*</mark>     | String | Document request id from analyze. e.g. `DRQ-ABC1234567`.     |
| document\_types<mark style="color:red;">\*</mark> | Array  | Document slugs to purchase. e.g. `["FDA", "FISH-WILDLIFE"]`. |

#### Sample body

```json
{
    "request_id": "DRQ-ABC1234567",
    "document_types": ["FDA"],
    "shipment_id": "SH-ABC1234567"
}
```

{% tabs %}
{% tab title="200: OK Regulatory documents purchased successfully" %}

```json
{
    "status": true,
    "message": "Regulatory documents purchased successfully",
    "data": {
        "request_id": "DRQ-ABC1234567",
        "user_id": "USR-1234567890",
        "source": "invoice",
        "status": "processing",
        "currency": "USD",
        "available_documents": [
            {
                "type": "FDA",
                "name": "FDA Prior Notice",
                "amount": 1.67,
                "currency": "USD",
                "free": false,
                "automated": true
            }
        ],
        "purchased_documents": [
            {
                "type": "FDA",
                "name": "FDA Prior Notice",
                "logo": "https://cdn.terminal.africa/regulatory/fda.png",
                "document_url": "",
                "document_id": "DOC-XYZ789",
                "status": "pending",
                "paid": true,
                "amount": 1.67,
                "currency": "USD",
                "automated": true,
                "error": ""
            }
        ],
        "payment": {
            "amount": 1.67,
            "currency": "USD",
            "free": false,
            "transaction_id": "TXN-1234567890",
            "charged_at": "2026-09-01T10:05:00.000Z"
        },
        "generation": {
            "generated": [],
            "skipped": [],
            "pending": [
                {
                    "type": "FDA",
                    "document_id": "DOC-XYZ789",
                    "status": "pending"
                }
            ]
        },
        "created_at": "2026-09-01T10:00:00.000Z",
        "updated_at": "2026-09-01T10:05:00.000Z"
    }
}
```

{% endtab %}
{% endtabs %}

#### Common errors

| Status | Message                                                         |
| ------ | --------------------------------------------------------------- |
| 400    | One or more items are missing HS codes                          |
| 400    | Invalid document type(s) for this document request: {types}     |
| 409    | Documents for this document request have already been purchased |
| 400    | Insufficient wallet balance (via wallet charge)                 |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.terminal.africa/tship/regulatory-documents/purchase-regulatory-documents.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
