> ## Documentation Index
> Fetch the complete documentation index at: https://docs.genviral.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Analytics Target

> Add a tracked analytics account

Creates a tracked analytics target in the authenticated key scope.

## Body Parameters

<ParamField body="platform" type="string" required>
  Supported values: `tiktok`, `instagram`, `youtube`.
</ParamField>

<ParamField body="identifier" type="string" required>
  Account identifier/handle to track (for example `@brand`).
</ParamField>

<ParamField body="alias" type="string">
  Optional display name override.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://www.genviral.io/api/partner/v1/analytics/targets \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "platform": "tiktok",
      "identifier": "@brand",
      "alias": "Brand HQ"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "ok": true,
    "code": 201,
    "message": "Analytics target created",
    "data": {
      "target": {
        "id": "e7a7f417-56db-4320-9e9a-fd6fdabda09d",
        "user_id": "7f026314-7657-4b0f-bb45-8fd4c0b95fd7",
        "workspace_id": "4cb5d3fd-8c8f-4ed7-a17c-4ffb52c7e6ac",
        "platform": "tiktok",
        "identifier": "@brand",
        "normalized_identifier": "brand",
        "display_name": "Brand HQ",
        "last_refreshed_at": null
      },
      "created": true
    }
  }
  ```
</ResponseExample>

## Error Responses

* `400 invalid_json` - request body is not valid JSON
* `400 invalid_payload` - body must be a JSON object
* `400` - unsupported platform or missing identifier
* `401`/`403` - authentication failed or key lacks workspace access
* `500` - unexpected database/analytics service error

All error responses from analytics endpoints include an `error_code` field.
