# Create a destination

> Create a destination that receives the workspace's logs and metrics over OTLP/HTTP, such as Grafana Cloud, Honeycomb, Datadog, New Relic, Dynatrace, Elastic or your own collector.

> Nevia is in early access for selected teams. The CLI installs with `curl -fsSL https://get.nevia.cloud | sh`, and the MCP server is at https://api.nevia.cloud/mcp. A person signs in once in the browser.
> Setup, sign-in and requesting access: [SKILL.md](https://nevia.cloud/SKILL.md). When Nevia fits and when it doesn't: [why.md](https://nevia.cloud/why.md).

> For the complete documentation index, see [llms.txt](https://nevia.cloud/llms.txt). This page's HTML version: https://nevia.cloud/docs/reference/api/observability/createDestination

`POST https://api.nevia.cloud/v1/destinations`

## Authorization

- `bearerAuth`: HTTP bearer in the Authorization header

Send the token in the `Authorization: Bearer <token>` header. See [Authenticate](https://nevia.cloud/docs/reference/api.md#authenticate).

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `Idempotency-Key` | header | string | yes | Required for this non-idempotent request. Clients generate one key per action and preserve it across transport retries. Within the retained window, repeats return the recorded result and different input with the same key is 409. Keys expire 10 minutes after admission, or 120 seconds after success or terminal failure, whichever is earlier. Reusing an expired key can execute new work. The API tracks at most 100,000 requests across replicas. New keys at capacity receive 429 with Retry-After of 600–630 seconds. Length `1 <= length <= 255`. |

## Request body

Content type: `application/json`, required

Schema: `DestinationCreateRequest`

| Field | Type | Required | Description |
|---|---|---|---|
| `workspace` | string | yes | Workspace id: 27 lowercase letters and digits. Match `^[A-Za-z0-9_-]{1,64}$`. |
| `name` | string | no | A label for people. Defaults to the endpoint's host. Length `1 <= length <= 100`. |
| `preset` | string | no | A vendor whose endpoint and credential header the destination takes from its `region`, or whose credential header the destination takes when you give your own `endpoint`. `endpoint` and `region` are mutually exclusive and the API rejects giving both. `x-enum-details` gives each preset's facts as data: `label`, `regions` (null when `endpoint` is required), `endpoint_help`, `credentials` (each field it takes, with what to give), `header`, `fixed_headers` and the metric `temporality` it accepts. - `datadog`: Datadog. Give `api_key`, which goes in the `dd-api-key` header. Set `region` to `us1` (https://otlp.datadoghq.com), `us3` (https://otlp.us3.datadoghq.com), `us5` (https://otlp.us5.datadoghq.com), `eu1` (https://otlp.datadoghq.eu), `ap1` (https://otlp.ap1.datadoghq.com), `ap2` (https://otlp.ap2.datadoghq.com) or `uk1` (https://otlp.uk1.datadoghq.com), or leave it for `us1`. Every request also carries `dd-otel-metric-config: {"resource_attributes_as_tags":true}`. Its metrics intake accepts only delta sums, so counters go out as the change since their previous point. - `dynatrace`: Dynatrace. Give `api_key`, which goes in the `authorization` header. `endpoint` is required: Your environment's OTLP endpoint, such as `https://abc12345.live.dynatrace.com/api/v2/otlp`. Its metrics intake accepts only delta sums, so counters go out as the change since their previous point. - `elastic`: Elastic. Give `api_key`, which goes in the `authorization` header. `endpoint` is required: Your project's or deployment's managed OTLP endpoint, from its OpenTelemetry setup page. Counters go out cumulative, as stored. - `grafana_cloud`: Grafana Cloud. Give `instance_id` and `api_key`, which go in the `authorization` header. `endpoint` is required: Your stack's OTLP gateway, such as `https://otlp-gateway-prod-eu-west-2.grafana.net/otlp`. Counters go out cumulative, as stored. - `honeycomb`: Honeycomb. Give `api_key`, which goes in the `x-honeycomb-team` header. Set `region` to `us` (https://api.honeycomb.io) or `eu` (https://api.eu1.honeycomb.io), or leave it for `us`. Counters go out cumulative, as stored. - `new_relic`: New Relic. Give `api_key`, which goes in the `api-key` header. Set `region` to `us` (https://otlp.nr-data.net) or `eu` (https://otlp.eu01.nr-data.net), or leave it for `us`. Counters go out cumulative, as stored. One of `datadog` · `dynatrace` · `elastic` · `grafana_cloud` · `honeycomb` · `new_relic`. |
| `endpoint` | string (uri) | no | Required unless the `preset` has regions. Give this or `region`, not both. Length `length <= 2048`. |
| `region` | string | no | With a `preset` that has regions, which one to send to. Defaults to its first. Each preset's are in its `x-enum-details`. Match `^[a-z0-9]{1,16}$`. |
| `instance_id` | string | no | With a `preset` that takes it (`grafana_cloud`), the account's instance ID. It goes in the credential header with `api_key`, so it is write-only too. Length `1 <= length <= 128`. |
| `api_key` | string | no | With a `preset`, its key or token, which goes in its credential header. Write-only. Length `1 <= length`. |
| `headers` | DestinationHeaders | no | HTTP headers sent with every request, such as the vendor's API key. Write-only: no response returns a value. At most 16, each value at most 4096 bytes and all of them at most 8192 bytes as JSON. Names ignore case. |
| `signals` | array<DestinationSignal> | no | What it receives. Defaults to both. Default `["logs","metrics"]`. Items `1 <= items`. |
| `projects` | array<ProjectId> | no | Only resources in these projects. Defaults to every resource in the workspace. Default `[]`. Items `items <= 100`. |

## Behavior

Records go out as stored, in the OTel data model, with `service.name` set to the resource's name and `service.instance.id` to its id. A `preset` fills in its vendor's endpoint for `region` and builds its vendor's credential header from its credential fields (`api_key`, and `instance_id` for Grafana Cloud). Header values are write-only. Header values are never read back. Saving sends one test record per signal: a log record with the body `Nevia test record` and a gauge `nevia.destination.test` of 1, on a resource with `service.name` `nevia`. `test` says how the destination answered each, as a code and its HTTP status, and `delivery` starts from it. The destination is saved whatever it answered, so fix it with `PATCH` and read the new `test`.

## Example request

### cURL

```bash
curl -X POST "https://api.nevia.cloud/v1/destinations" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Idempotency-Key: 8f1c2a7e-3b4d-4c5e-9f0a-1b2c3d4e5f60" \
  -H "Content-Type: application/json" \
  -d '{
    "workspace": "01d4cnjjq40hnnh0nwmkg35nv2h",
    "preset": "honeycomb",
    "region": "eu",
    "api_key": "<api key>"
  }'
```

### JavaScript

```js
const body = JSON.stringify({
  "workspace": "01d4cnjjq40hnnh0nwmkg35nv2h",
  "preset": "honeycomb",
  "region": "eu",
  "api_key": "<api key>"
})

fetch("https://api.nevia.cloud/v1/destinations", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": `Bearer ${process.env.TOKEN}`,
    "Idempotency-Key": "8f1c2a7e-3b4d-4c5e-9f0a-1b2c3d4e5f60"
  },
  body
})
```

### Python

```python
import os
import requests

url = "https://api.nevia.cloud/v1/destinations"
body = """{
  "workspace": "01d4cnjjq40hnnh0nwmkg35nv2h",
  "preset": "honeycomb",
  "region": "eu",
  "api_key": "<api key>"
}"""
response = requests.request("POST", url, data = body, headers = {
  "Content-Type": "application/json", 
  "Authorization": f"Bearer {os.environ['TOKEN']}", 
  "Idempotency-Key": "8f1c2a7e-3b4d-4c5e-9f0a-1b2c3d4e5f60"
})

print(response.text)
```

## Responses

### 201

The destination and its answer to the test records.

Content type: `application/json`

Schema: `DestinationWriteResponse`

The destination and its answer to the test records just sent

| Field | Type | Required | Description |
|---|---|---|---|
| `destination` | Destination | yes | An OTLP/HTTP endpoint the workspace exports its telemetry to, without its header values. |
| `test` | DestinationTest | yes | The destination's answer to one test record per signal it receives. |

Example:

```json
{
  "destination": {
    "id": "01d30cbpnr2g96ry9h5kkkhd6db",
    "workspace": "01d4cnjjq40hnnh0nwmkg35nv2h",
    "name": "Honeycomb production",
    "endpoint": "https://api.honeycomb.io",
    "preset": "honeycomb",
    "header_names": [
      "x-honeycomb-team"
    ],
    "signals": [
      "logs"
    ],
    "projects": [
      "01ck8y1dm5qqnf88mytnh4m0h4g"
    ],
    "delivery": {
      "status": "delivering",
      "last_error": {
        "code": "delivered",
        "http_status": 503,
        "failed_at": "2026-09-10T12:34:56Z"
      },
      "last_delivered_at": "2026-09-10T12:34:56Z",
      "dropped": 0
    },
    "created_by": "01d4cnjmn4fbb1r5btxb5mypv62",
    "updated_by": "01d4cnjmn4fbb1r5btxb5mypv62",
    "created_at": "2026-09-10T12:34:56Z",
    "updated_at": "2026-09-10T12:34:56Z",
    "deleted_at": "2026-09-10T12:34:56Z"
  },
  "test": {
    "logs": {
      "code": "delivered",
      "http_status": 200
    },
    "metrics": {
      "code": "delivered",
      "http_status": 200
    }
  }
}
```

### 400

`validation_failed`: malformed body, unknown field, or invalid id or name. Fix `details.field` and retry. `validation_failed`: no endpoint was given and the preset has none, a `region` the preset lacks, a credential field missing for the preset or given without one, or the endpoint is not https. `field` names the field.

Content type: `application/json`

Schema: `ErrorEnvelope`

Body of every error response

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | Error | yes |  |

Example `validation_failed: malformed body, unknown field, or invalid id or name. Fix \`details.field\` and retry`:

```json
{
  "error": {
    "code": "validation_failed",
    "message": "Unknown field `colour` in the request body. Remove it; request bodies are strict.",
    "details": {
      "field": "colour",
      "in": "body"
    }
  }
}
```

Example `validation_failed: no endpoint was given and the preset has none, a \`region\` the preset lacks, a credential field missing for the preset or given without one, or the endpoint is not https. \`field\` names the field`:

```json
{
  "error": {
    "code": "validation_failed",
    "message": "Invalid `instance_id` in the request body: the grafana_cloud preset builds its header from `instance_id` and `api_key`; give every one.",
    "details": {
      "field": "instance_id",
      "in": "body"
    }
  }
}
```

### 401

`unauthorized`: the credential is missing, malformed, expired, or revoked. Send a valid bearer token.

Content type: `application/json`

Schema: `ErrorEnvelope`

Body of every error response

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | Error | yes |  |

Example `unauthorized`:

```json
{
  "error": {
    "code": "unauthorized",
    "message": "Missing credential. Send `Authorization: Bearer <token>` with an access token.",
    "details": {}
  }
}
```

### 403

`forbidden`: the token is read-only or scoped elsewhere, or the role cannot do this. Use a token or role that allows it.

Content type: `application/json`

Schema: `ErrorEnvelope`

Body of every error response

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | Error | yes |  |

Example `forbidden`:

```json
{
  "error": {
    "code": "forbidden",
    "message": "You can view computer 01d4cnjk3xg90y576w8y6t4gdwm but your role does not allow computer#edit. Ask a workspace admin to change your role (PATCH /v1/workspaces/{ws}/access/{principal}).",
    "details": {
      "computer": "01d4cnjk3xg90y576w8y6t4gdwm",
      "permission": "computer#edit"
    }
  }
}
```

### 404

`not_found`: the workspace does not exist or you cannot see it, or a project in `projects` is not one of its projects. Both return the same response.

Content type: `application/json`

Schema: `ErrorEnvelope`

Body of every error response

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | Error | yes |  |

Example `not_found`:

```json
{
  "error": {
    "code": "not_found",
    "message": "Workspace 01d4cnjjq40hnnh0nwmkg35nv2h was not found. List the workspaces you can access with GET /v1/workspaces.",
    "details": {
      "workspace": "01d4cnjjq40hnnh0nwmkg35nv2h"
    }
  }
}
```

### 409

`limit_exceeded`: the workspace already has 10 destinations. `idempotency_conflict`: the `Idempotency-Key` was already used with a different body.

Content type: `application/json`

Schema: `ErrorEnvelope`

Body of every error response

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | Error | yes |  |

Example `limit_exceeded`:

```json
{
  "error": {
    "code": "limit_exceeded",
    "message": "Workspace 01d4cnjjq40hnnh0nwmkg35nv2h already has 10 destinations, the most allowed. Delete one first.",
    "details": {
      "kind": "destination",
      "scope": "workspace",
      "count": 10,
      "limit": 10,
      "workspace": "01d4cnjjq40hnnh0nwmkg35nv2h"
    }
  }
}
```

Example `idempotency_conflict`:

```json
{
  "error": {
    "code": "idempotency_conflict",
    "message": "Idempotency-Key 8f1c2a7e-3b4d-4c5e-9f0a-1b2c3d4e5f60 was already used for a different POST /v1/destinations request. Use a new key for a new request.",
    "details": {
      "idempotency_key": "8f1c2a7e-3b4d-4c5e-9f0a-1b2c3d4e5f60"
    }
  }
}
```

### 422

`not_supported`: the platform has no secret store for destination headers. Reads still work.

Content type: `application/json`

Schema: `ErrorEnvelope`

Body of every error response

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | Error | yes |  |

Example `not_supported`:

```json
{
  "error": {
    "code": "not_supported",
    "message": "Destinations are not available on this platform: it has no secret store for their headers.",
    "details": {}
  }
}
```

### 429

`rate_limited`: slow down. Retry after `Retry-After`.

Content type: `application/json`

Schema: `ErrorEnvelope`

Body of every error response

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | Error | yes |  |

Example `rate_limited`:

```json
{
  "error": {
    "code": "rate_limited",
    "message": "Too many requests. Retry after 2 seconds.",
    "details": {
      "retry_after_seconds": 2
    }
  }
}
```

### 500

`request_failed`, or the failed action's own code, such as `creation_failed`, `authorization_failed` or `command_execution_failed`. The diagnostic stays in server logs.

Content type: `application/json`

Schema: `ErrorEnvelope`

Body of every error response

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | Error | yes |  |

Example `request_failed`:

```json
{
  "error": {
    "code": "request_failed",
    "message": "request failed",
    "details": {}
  }
}
```

### 503

The action is temporarily unavailable, named by its code (`creation_failed`, `wake_failed`, ...). Wait at least `Retry-After` seconds (60 by default). `details.retryable` says whether repeating the request is safe. Keep the original `Idempotency-Key`. Signing in again does not help.

Content type: `application/json`

Schema: `ErrorEnvelope`

Body of every error response

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | Error | yes |  |

Example `creation_failed`:

```json
{
  "error": {
    "code": "creation_failed",
    "message": "The computer could not be created. Try again later.",
    "details": {
      "retryable": true
    }
  }
}
```
