# Create an ingest token

> Make an ingest token for a project.

<div class="g1t-endpoint"><span class="g1t-method" data-method="post">POST</span><code>/workspaces/{workspace}/projects/{project}/observability/tokens</code></div>

Returns token and secret: the secret is shown this once, so keep it. Send it as `Authorization: Bearer &lt;secret>` (or `x-g1t-token`) with OTLP over HTTP to the project's endpoint. Needs the Admin role.

The secret is returned this once. Send it as `Authorization: Bearer &lt;secret>` (or the `x-g1t-token` header) with OTLP over HTTP, in JSON or protobuf, to `https://otel.g1t.sh/v1/traces`, `/v1/logs` and `/v1/metrics`, or to `/otlp/v1/…` on the API's own address. Needs the Admin role.

- **Authentication:** Required. Send an [access token](/reference/api/#authentication) as `Authorization: Bearer`.
- **MCP tool:** None. Signing in is on the REST API only.

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `workspace` | string | Yes | The workspace's slug, e.g. "flagon-io". |
| `project` | string | Yes | The project's slug, as in g1t.sh/{workspace}/{project}. |

## Body parameters

Send a JSON object. Names are `snake_case`, as in responses; the `camelCase` spelling is accepted too.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes | What it is for, such as the machine or collector that sends with it. |

## Example request

```sh
curl -X POST https://api.g1t.sh/workspaces/flagon-io/projects/g1t/observability/tokens \
  -H "Authorization: Bearer $G1T_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "fly.io collector"
  }'
```

## Example response

A successful request answers `200` with:

```json
{
  "token": {
    "id": "k3m9q2x7",
    "name": "fly.io collector",
    "hint": "g1to_prj_…9f3a",
    "created_by": "syntaqx",
    "created_us": 1791796364000000,
    "last_used_us": null,
    "managed": false
  },
  "secret": "g1to_prj_…"
}
```

## Errors

A failed request answers with one of these statuses and a body like `{"error": {"code": "not_found", "message": "Repository not found."}}`. See [errors](/reference/api/#errors).

| Status | Code | When |
| --- | --- | --- |
| 401 | `unauthenticated` | A token is required, or the one sent is not valid. |
| 403 | `forbidden` | The token is valid but not allowed to do this, such as a member-only change, or a token without the scope it needs. |
| 404 | `not_found` | It does not exist, or you cannot see it. |
| 409 | `conflict` | The request conflicts with the current state. |
| 422 | `invalid` | The input is not valid. `message` says which field and why. |
