# Create destination

URL: https://docs.hanzo.ai/docs/openapi/destination/post-destination-by-platform

> Stores the addressed platform's non-secret ids (its measurement, pixel or dataset ids) and seals its API credential into KMS under a path scoped to the caller's own org, then answers the same status card the read routes do — with live telling you whether the credential actually resolves right now.

`POST /v1/destination/{platform}`

> [Destination →](https://docs.hanzo.ai/docs/openapi/destination) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                                  |
| ------------- | ------------------------------------------------ |
| **Address**   | `https://api.hanzo.ai/v1/destination/{platform}` |
| **Method**    | `POST`                                           |
| **Operation** | `post_destination_by_platform`                   |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY`           |

Stores the addressed platform's non-secret ids (its measurement, pixel or dataset ids) and seals its API credential into KMS under a path scoped to the caller's own org, then answers the same status card the read routes do — with live telling you whether the credential actually resolves right now. The body's property NAMES are the platform's own: each field the platform declares, plus each secret under its camelCase name, so the accepted keys differ per platform and a missing REQUIRED field is refused. Connecting is an ORG ADMIN action — a validated member without the admin bit gets 403 — and it fails closed with 503 when the KMS master key is unavailable rather than persisting a destination whose secret was never sealed. The secret itself never appears in the response, in the store, or in a log line; only its NAME is ever published. Set enabled to false to keep the connection but stop the analytics fan-out to it.

## Request

2 fields, body `application/json`.

| Field      | In   | Type   | Required | Description |
| ---------- | ---- | ------ | -------- | ----------- |
| `platform` | path | string | yes      |             |
| `*`        | body | any    | —        |             |

## Response

| Status | Body              | Meaning |
| ------ | ----------------- | ------- |
| `2XX`  | DestinationStatus | Success |

`2XX` body — 16 fields.

| Field               | In   | Type                | Always | Description |
| ------------------- | ---- | ------------------- | ------ | ----------- |
| `account`           | body | string              | —      |             |
| `category`          | body | string              | —      |             |
| `config`            | body | object              | —      |             |
| `config.*`          | body | string              | —      |             |
| `connected`         | body | boolean             | —      |             |
| `enabled`           | body | boolean             | —      |             |
| `fields`            | body | DestinationField\[] | —      |             |
| `fields[].example`  | body | string              | —      |             |
| `fields[].key`      | body | string              | —      |             |
| `fields[].label`    | body | string              | —      |             |
| `fields[].required` | body | boolean             | —      |             |
| `live`              | body | boolean             | —      |             |
| `name`              | body | string              | —      |             |
| `pixel`             | body | boolean             | —      |             |
| `platform`          | body | string              | —      |             |
| `secrets`           | body | string\[]           | —      |             |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo destination add <platform>
```

**SDK**

**.ts**

```ts
import { Configuration, DestinationApi } from 'hanzoai';

const api = new DestinationApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postDestinationByPlatform({ platform: 'platform' });
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import DestinationApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = DestinationApi(client).post_destination_by_platform(platform='platform')
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.DestinationAPI.PostDestinationByPlatform(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, destination_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = destination_api::post_destination_by_platform(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.DestinationApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new DestinationApi(client).postDestinationByPlatform();
```

**HTTP**

```bash
curl -X POST https://api.hanzo.ai/v1/destination/<platform> \
  -H "Authorization: Bearer $HANZO_API_KEY"
```

**MCP**

MCP reaches **destination** through the `destination` tool, which names its 4 operations with its own verbs — this one among them, under a name only MCP declares. `describe` explains any of them:

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "list_destinations"
         }
       }
     }'
```

---

[Destination API](https://docs.hanzo.ai/docs/openapi/destination) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
