> 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.md).

# Regulatory Documents

Base URL: `https://api.terminal.africa/v1/regulatory-documents`

1. **Shipment flow:** analyze from an existing Terminal shipment (`source: shipment`).
2. **Invoice flow:** analyze from an uploaded commercial invoice URL (`source: invoice`).

### Typical workflow

1. **Analyze:** `POST /analyze` with `shipment_id` or `file_url`. Returns a draft `request_id`, matched `available_documents`, and line items.
2. **Edit draft:** update items, addresses, shipping (invoice only), and per-form regulatory profiles.
3. **Purchase:** `POST /purchase` with `request_id` and `document_types`. Charges the user's wallet and starts document generation.
4. **Poll:** `GET /request/:request_id` until `status` is `completed` or `failed`. Retry failed automated docs if needed.

### Authentication

All endpoints require authentication **except** Generate Regulatory Document PDF.

| Header                                          | 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` (for POST/PUT bodies) |

### Document request statuses

| Status       | Description                            |
| ------------ | -------------------------------------- |
| `draft`      | Analyzed, not yet purchased. Editable. |
| `purchasing` | Purchase in progress (transient).      |
| `processing` | Purchased; generation in progress.     |
| `completed`  | All purchased documents generated.     |
| `failed`     | Analyze or generation failed.          |

### Supported document types (slug)

`AMS`, `CUSTOMS`, `FDA`, `DROP-BALL`, `FISH-WILDLIFE`, `FOOTWEAR`, `FUMIGATION`, `LITHIUM-BATTERY`, `MSDS`, `MUSEUM`, `OTHER`, `QUARANTINE`, `STEEL`, `TEXTILE`, `WATCH`

### Pricing

* Amounts are converted into the user's **wallet currency** at analyze time.
* Purchase charges the amounts already stored on the draft (`available_documents`).


---

# 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.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.
