> For the complete documentation index, see [llms.txt](https://docs.tagshelf.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tagshelf.dev/endpoints/api-conventions.md). Agents can also search and read this documentation through its [MCP server](https://docs.tagshelf.dev/~gitbook/mcp).

# API conventions

Base URL, headers, response format, paging, views, errors, file size limits and rate limits that apply to every endpoint.

Base URL, headers, response format, errors and rate limits that apply to every endpoint.

All Alfred API endpoints share a common set of rules. This page covers them in one place: where to send your requests, which headers to include, how responses are formatted, how to page through long lists, and what to expect when something goes wrong. Each endpoint page builds on what is described here.

### Base URL

All endpoints are served from a single host:

```
https://app.tagshelf.com
```

The paths shown in this reference are relative to that host. For example, `/api/tagshelf/ping` means `https://app.tagshelf.com/api/tagshelf/ping`.

### Required headers

| Header                                 | Required                  | What to send                                                                                                                                                                                                                                |
| -------------------------------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `X-TagshelfAPI-Key` or `Authorization` | Yes                       | Your credentials. Send an API key in `X-TagshelfAPI-Key`, or a token in `Authorization` (`Bearer <access_token>` or `amx <secret_key>:<signature>:<nonce>:<timestamp>`). See [Authentication](https://docs.tagshelf.dev/authentication.md). |
| `User-Agent`                           | Yes                       | Any value that identifies your integration, such as `acme-invoices/1.0`. Alfred only checks that the header is present. Requests without it are rejected with `403 Forbidden`, before your credentials are checked.                         |
| `Content-Type`                         | Only when you send a body | `application/json` for JSON bodies, or `multipart/form-data` for file uploads.                                                                                                                                                              |

{% hint style="info" %}
Most HTTP libraries, including cURL and Python `requests`, send a `User-Agent` automatically. The examples in this reference set it explicitly so that it is easy to see.
{% endhint %}

### Your first call

A good first request is `GET /api/tagshelf/ping`. If your credentials are valid, it responds with the name of the user or application you authenticated as.

{% tabs %}
{% tab title="cURL" %}

```bash
curl "https://app.tagshelf.com/api/tagshelf/ping" \
  -H "X-TagshelfAPI-Key: $ALFRED_API_KEY" \
  -H "User-Agent: my-integration/1.0"
```

{% endtab %}

{% tab title="Python" %}

```python
import os
import requests

response = requests.get(
    "https://app.tagshelf.com/api/tagshelf/ping",
    headers={
        "X-TagshelfAPI-Key": os.environ["ALFRED_API_KEY"],
        "User-Agent": "my-integration/1.0",
    },
)
response.raise_for_status()
print(response.json())
```

{% endtab %}
{% endtabs %}

```json
{
  "pong": "my-integration-app"
}
```

### Response format

* **Field names are `snake_case`.** For example, `job_id`, `creation_date` and `correlation_id`.
* **Enum values are `snake_case` strings.** For example, a job stage comes back as `in_progress`, not `InProgress` or `6`. The one exception is `priority` in the full view of a job, which is sent as written in code (`Normal`, `High`).
* **Dates are ISO 8601 in UTC.** For example, `2026-10-14T18:42:22.067Z`.
* **Empty text is an empty string.** A text field with no value is usually sent as `""` rather than `null`. Fields that are not text (numbers, objects, lists) are left out of the response when they have no value. Write your client so it treats a missing field and an empty string the same way.
* **IDs are UUIDs**, such as `559167cb-4c76-4e28-bf15-34cbf614119c`.

### Paging through lists

Endpoints that return lists send their results one page at a time. The parameter names vary slightly from one endpoint to another, so the table below summarizes them. Each endpoint page also lists its own parameters. Pages are numbered from 1.

| Endpoint                                 | Page parameter          | Size parameter            | Default size | Allowed sizes         | Response                                                                                          |
| ---------------------------------------- | ----------------------- | ------------------------- | ------------ | --------------------- | ------------------------------------------------------------------------------------------------- |
| `GET /api/job/all`                       | `page` or `currentPage` | `page_size` or `pageSize` | 10           | 10 to 100             | `{ "items": [...], "page": n, "page_size": n, "total": n, "has_more": true }`                     |
| `GET /api/file/all`                      | `currentPage`           | `pageSize`                | 25           | 1 to 200              | `{ "result": [...], "total": n, "is_empty": false }`                                              |
| `GET /api/tags`                          | `page`                  | `page_size`               | 50           | 1 to 200              | A plain list, or `{ "result", "total", "page", "page_size" }` when you send `page` or `page_size` |
| `GET /api/search/basic` and `/universal` | `page`                  | `pageSize`                | 50           | Up to 100 recommended | `{ "result": [...], "total": n, "is_empty": false }`                                              |
| `GET /api/report/tag/{id}`               | `page`                  | `pageSize`                | 10           | Any positive number   | A plain list: the whole report, or one page of it when you send `page` or `pageSize`              |

{% hint style="warning" %}
**Changed in v1.130.0.** `GET /api/job/all` now answers with the envelope `items`, `page`, `page_size`, `total` and `has_more`. Before, it answered with `result`, `total` and `is_empty`. If your code reads `result`, change it to `items`. The job summaries inside `items` also no longer carry `metadata`; ask for `view=full` to get it. The new `page` and `page_size` parameters work beside `currentPage` and `pageSize`. When you send both, `page` and `page_size` win.
{% endhint %}

On `GET /api/job/all`, a size outside 10 to 100 is answered with `400 Bad Request`. On `GET /api/file/all`, a size above 200 is lowered to 200, and a size below 1 is replaced by 25.

### Summary and full views

Job responses come in two sizes, chosen with the `view` query parameter:

* `view=summary` is the default. It holds the fields that are cheap to read, such as the stage and the file counts. It has the same shape in a list and when you read one job.
* `view=full` returns the complete record, including `files`, `metadata`, `file_urls` and `error_messages`.

Only your company's Account Admin or an API key may ask for `view=full`. Anyone else gets `403 Forbidden`, not a smaller response. Any value other than `summary` or `full` gets `400 Bad Request`. The value is not case-sensitive. The [Job](https://docs.tagshelf.dev/endpoints/job.md) page lists the fields of each view.

{% hint style="warning" %}
**Changed in v1.130.0.** `GET /api/job/detail/{id}` returns the summary unless you send `view=full`. If your integration reads `files`, `metadata`, `file_urls` or `error_messages` from the job detail, add `view=full`. Sending `view=full` to an older version of the API does no harm, so you can add it before you upgrade.
{% endhint %}

### Repeated reads

A few read endpoints, such as job detail and file detail, keep their answer for five seconds. If you read the same record again within five seconds, you get exactly the same body, so polling faster than that gains nothing. These endpoints also send an `ETag` header. If you send it back in `If-None-Match` and the record has not changed, Alfred answers `304 Not Modified` with no body.

### Errors

When a request fails, Alfred responds with a standard HTTP status code. In most cases, the response also includes a JSON body with a `message` that explains the problem:

```json
{
  "message": "view must be 'summary' or 'full'."
}
```

Some endpoints also include a `correlation_id`. Our support team uses it to find the request in our logs, so please include it if you contact us about an error. It isn't related to the `correlation_id` field that you can set when you create a job.

```json
{
  "message": "The request cannot be fulfilled due to bad syntax or bad data.",
  "correlation_id": "4f9c2a7d1b3e"
}
```

{% hint style="warning" %}
A few error responses use a different format. The tag endpoints return a list of `errors`, `GET /api/job/all` returns `error` and `statusCode` for an invalid paging or date parameter, some endpoints capitalize the field as `Message`, and some responses, such as a failed `401` or a `404`, have no body at all. We recommend checking the status code first and then reading the body, if there is one.
{% endhint %}

| Status                      | What it means                                                                                                    | What to do                                                                                                    |
| --------------------------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| `400 Bad Request`           | The request is missing something or a value is invalid.                                                          | Check the `message`, fix the request and try again.                                                           |
| `401 Unauthorized`          | Your credentials are missing or invalid, or you are not allowed to see this resource.                            | Check your API key or token.                                                                                  |
| `403 Forbidden`             | The `User-Agent` header is missing, your company's account isn't active, or your role doesn't allow this action. | Read the `message`. If your account is suspended, cancelled or pending payment, contact your account manager. |
| `404 Not Found`             | The resource doesn't exist, or it belongs to another company.                                                    | Check the ID.                                                                                                 |
| `409 Conflict`              | The request is valid, but the resource is in a state that prevents it right now.                                 | Read the `message`. Retrying later may succeed.                                                               |
| `413 Payload Too Large`     | The file is larger than the limit that applies to it. See [File size limits](#file-size-limits).                 | Split the file or upload a smaller one.                                                                       |
| `429 Too Many Requests`     | You went over the rate limit.                                                                                    | Wait for the number of seconds in the `Retry-After` header, then try again.                                   |
| `500 Internal Server Error` | Something failed on our side.                                                                                    | Try again. If it keeps happening, contact support with the `correlation_id`.                                  |

### File size limits

Two limits apply to files you send:

* **Per request:** `POST /api/file/uploadfile` accepts a request of up to **250 MB**. A larger request is refused with `413 Payload Too Large` and a body that holds a `message` and `max_bytes` (the limit, in bytes).
* **Per company:** each company has a **largest file accepted** setting, which an administrator can change on the Cloud Settings page. When the setting is blank, the limit is **1 GB**. A file over it is refused with `413 Payload Too Large`, and the `message` names the file, its size and the limit. A file that Alfred downloads from a link, an email or a remote source is not refused with a status code, because there is no request to answer. It fails on its job with the same sentence.

{% hint style="warning" %}
**Changed in v1.130.0.** The company limit is now enforced everywhere a file arrives, and it defaults to 1 GB. Before, only Alfred's own limits applied. If you send files larger than 1 GB, ask your administrator to raise the setting.
{% endhint %}

### Rate limits

Alfred allows **2,500 requests per minute for each endpoint**. The count is kept separately for each credential (each API key, token or user) and for each IP address, so a busy endpoint does not use up your allowance on the others. Every response to an authenticated request includes headers that show the limit and how many requests you have left for that endpoint in the current minute:

| Header                  | Meaning                                                     |
| ----------------------- | ----------------------------------------------------------- |
| `X-RateLimit-Limit`     | The number of requests allowed per minute.                  |
| `X-RateLimit-Remaining` | The number of requests you have left in the current minute. |

If you exceed the limit, Alfred responds with `429 Too Many Requests` and a `Retry-After` header with the number of seconds to wait. Requests that are refused still count toward the limit, so wait for the time in `Retry-After` instead of retrying right away.

{% hint style="info" %}
Because processing is asynchronous, your integration will usually check back for results. Space those checks a few seconds apart, or use the [Event API](https://docs.tagshelf.dev/event-api.md) so that Alfred notifies you when something changes.
{% endhint %}


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.tagshelf.dev/endpoints/api-conventions.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
