> For the complete documentation index, see [llms.txt](https://helpdesk.ldtsoft.work/ldt-digital-downloads/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://helpdesk.ldtsoft.work/ldt-digital-downloads/ai-and-api/how-to-use-the-api.md).

# How to use the API

Create an access key and drive files, orders, downloads and license keys from your own system through the LDT Digital Downloads API.

Connect your own system to LDT Digital Downloads: generate an access key, send it in one header, then call the endpoint groups for files, orders, downloads and license keys.

### 1. Open the API settings

Go to **LDT Digital Downloads → Settings → APIs**.

The page is split into two sections: **General**, which holds the **Authorization** tab, and **Endpoints**, which holds **File management**, **License management**, **Digital download management** and **Order management**. Each tab lists the endpoints with the exact request to send.

![APIs page General tab with Your API access token hidden and the Re-generate button](https://1863660695-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6iG7j4lDhziM0FqdCCU8%2Fuploads%2Fgit-blob-6bfd0c7fd40a00df67fe13937c2b83a442bb3dfa%2Fsettings-api-access-token-redacted.png?alt=media)

### 2. Generate an access key

On the **General** tab, under **Your API access token**, click **Generate access key** and copy the value. If you ever leak it, click **Re-generate** to invalidate the old one.

Until you generate one the page says **No access key found. Please generate one.**

![APIs Authorization tab with the access token and the Re-generate button](https://1863660695-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6iG7j4lDhziM0FqdCCU8%2Fuploads%2Fgit-blob-bc9fbcd8f5cb9f83058cc0d4b2b2b85bbc181978%2Fsettings-api-generate-key.png?alt=media)

### 3. Authenticate every request

Each call carries the key in a header:

```
LDT-X-Access-Token: <your access key>
```

Two things to keep in mind:

* Send at most **2 requests per second** by default — the **Authorization** tab shows the limit that applies to your shop, and some shops get a higher one. The API is rate limited to keep the service stable.
* Keep the key secret. The page states plainly that you are responsible for it, so store it in your own secret manager rather than in client-side code.

![APIs Authorization tab with the LDT-X-Access-Token header rule and the rate limit note](https://1863660695-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6iG7j4lDhziM0FqdCCU8%2Fuploads%2Fgit-blob-67741b683304be141bbdbd9baa87cfa78742955b%2Fsettings-api-authenticate.png?alt=media)

### 4. Upload and manage files

**File management** covers the file side:

* **File uploading (< 100MB)** — a single request for small files.
* **File uploading multiparts (>= 100MB)** — the chunked upload to use for big files.
* **Retrieve file information** and **Search files** — look up what is already there.
* **File categories**, **List all categories**, **Add categories to files**, **Remove categories from files** — group your files.
* **Generate download link** — produce a link for a file, which is how your own site hands a download to a buyer.

Some older endpoints are marked **Deprecated** on the page; use the current ones next to them.

![File management tab with the upload, information and search endpoints](https://1863660695-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6iG7j4lDhziM0FqdCCU8%2Fuploads%2Fgit-blob-c539a46378332197ac39e519c77e479589e7616e%2Fsettings-api-file-endpoints.png?alt=media)

### 5. Use the other endpoint groups

* **Order management** — read orders and the files or keys attached to them. The order lookups now match **exactly**: pass the full order name and the full customer email (or phone) instead of a partial value. The older search endpoints stay listed but are marked **Deprecated**, and a request that still uses them answers with a deprecation header naming its replacement.
* **Digital download management** — work with what a customer can download, using the same exact-match rule.
* **License management** — create and assign license keys.

![APIs Endpoints navigation with File, License, Digital download and Order management groups](https://1863660695-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6iG7j4lDhziM0FqdCCU8%2Fuploads%2Fgit-blob-1065f652bf0f57bfb8cf53b40d205d2f433a5f2b%2Fsettings-api-endpoint-groups.png?alt=media)

### Result

Your system can upload files, attach them to products, hand out download links and manage license keys without anyone opening the app.

### Troubleshooting

* **Every request returns an authentication error.** The header name is `LDT-X-Access-Token`; a key sent as a query parameter or under another header name is ignored.
* **Large uploads fail.** Files of 100 MB and more must use **File uploading multiparts**, not the single-request endpoint.
* **Requests start failing under load.** You are above the limit shown on the **Authorization** tab — queue them in your own system.
* **The key stopped working.** Someone clicked **Re-generate**; copy the new key into your system.

### Related

* [How to create and sell a digital product](https://helpdesk.ldtsoft.work/ldt-digital-downloads/sell-your-digital-products/how-to-create-and-sell-digital-product.md) — in Sell your digital products
