[Tenjin API Reference](https://api-docs.tenjin.com/llms.txt) › [Campaign Management API](https://api-docs.tenjin.com/campaign-management-api.md) › Create a callback

- Campaign Management API OpenAPI spec: https://api-docs.tenjin.com/openapi/campaign-management-api.json

# Create a callback

- **Method:** `POST`
- **Path:** `/v2/apps/{app_id}/callbacks`
- **Operation ID:** `post_apps_app_id_callbacks`
- **Tags:** Callbacks

## Effective servers

- `https://api.tenjin.com`

## Authentication

- **Bearer**: HTTP bearer (`JWT`)

  Generate an access token on the [Access Tokens](https://dashboard.tenjin.com/dashboard/access_tokens) page of the Tenjin dashboard and send it as `Authorization: Bearer <access token>`. [API access tokens](https://tenjin.com/docs/api-access-tokens/) explains them.

## Path parameters

- **`app_id` (required)**: `string`, format: `uuid`, maxLength: `36`

  Id of the app

## Request body

**Required:** `true`

**Content type:** `application/json`

schema: `post_apps_app_id_callbacks_Request`

- **`callback_template_id` (required)**: `string`, format: `uuid`, maxLength: `36`

  Id of the callback template the callback is made from
- **`active`**: `boolean`

  Whether Tenjin sends the callback. Defaults to true when the callback is created
- **`customer_parameters`**: `object`

  A value for each parameter in the template's customer_parameters; creating a callback requires every one
- **`event`**: `string`, maxLength: `255`

  Event of the app that sends the callback
- **`name`**: `string`, maxLength: `255`

  Name of the callback
- **`user_filter`**: `string`, possible values: `"all", "channel", "channel_and_organic", "non_channel"`, maxLength: `255`

  Users the callback is sent for

**Example:**

```json
{
  "callback_template_id": "",
  "name": "",
  "active": true,
  "customer_parameters": {},
  "event": "",
  "user_filter": "all"
}
```

## Responses

### 201 The created callback

**Content type:** `application/json`

schema: `CallbackDocument`

- **`data` (required)**: `object`, schema: `CallbackResource`
  - **`attributes` (required)**: `object`
    - **`action` (required)**: `string`, possible values: `"ping", "ping_on_first", "notify_on_reengagement", "ping_adwords", "ping_adwords_deferred", "ping_adwords_post_install", "fetch_adwords_reengagement", "notify_adwords_reengagement", "ping_amazon", "ping_amazon_post_install", "fetch_amazon_reengagement", "notify_amazon_reengagement", "ping_facebook_deferred", "ping_facebook", "ping_facebook_post_install", "fetch_facebook_reengagement", "notify_facebook_reengagement", "ping_double_click_bid_manager", "fetch_double_click_bid_manager_reengagement", "ping_snapchat", "ping_snapchat_post_install", "fetch_snapchat_reengagement", "notify_snapchat_reengagement", "ping_tiktok", "ping_tiktok_post_install", "fetch_tiktok_reengagement", "notify_tiktok_reengagement", "san_callback"`

      What the callback does, such as `ping` or `ping_on_first`
    - **`active` (required)**: `boolean`

      Whether Tenjin sends the callback
    - **`callback_template_id` (required)**: `string | null`, format: `uuid`

      Id of the callback template the callback is made from
    - **`channel_id` (required)**: `integer | null`

      Id of the callback's channel
    - **`created_at` (required)**: `string`, format: `date-time`

      When the callback was created
    - **`customer_parameters` (required)**: `object`

      Value of each parameter the callback sets
    - **`event` (required)**: `string`

      Event that sends the callback
    - **`first_party` (required)**: `boolean | null`

      Whether this is a first-party (destination belongs to the advertiser) S2S callback
    - **`http_method` (required)**: `string`, possible values: `"GET", "POST"`

      HTTP method
    - **`name` (required)**: `string`

      Name of the callback
    - **`url` (required)**: `string | null`

      URL Tenjin calls. Macros such as `{{advertising_id}}` are filled in
    - **`user_filter` (required)**: `string | null`, possible values: `"all", "channel", "channel_and_organic", "non_channel", null`

      Users the callback is sent for
  - **`id` (required)**: `string`, format: `uuid`
  - **`type` (required)**: `string`, possible values: `"callback"`
- **`links` (required)**: `object`, schema: `Links`
  - **`self` (required)**: `string`, format: `uri`

    URL of this request
  - **`first`**: `string`, format: `uri`

    URL of the first page of a list
  - **`last`**: `string`, format: `uri`

    URL of the last page of a list
  - **`next`**: `string`, format: `uri`

    URL of the next page of a list
  - **`prev`**: `string`, format: `uri`

    URL of the previous page of a list
- **`meta` (required)**: `object`

  Always empty

**Example: The created callback**

```json
{
  "data": {
    "id": "1268b1a8-57b5-485d-a597-8fd88ea27849",
    "type": "callback",
    "attributes": {
      "name": "Facebook install",
      "event": "install",
      "action": "ping_on_first",
      "channel_id": 3,
      "url": "https://fake.facebook.com?ida={{advertising_id}}&impId={{click_id}}&trackingPartner=tenjin&eventTime={{time_in_ms}}",
      "http_method": "GET",
      "active": true,
      "customer_parameters": {
        "remote_app_id": "test"
      },
      "callback_template_id": "b7af0230-913b-416d-8043-06a4048cea30",
      "created_at": "2019-11-28T18:45:00.687Z",
      "user_filter": "all",
      "first_party": null
    }
  },
  "links": {
    "self": "https://api.tenjin.com/v2/apps/17ef8c1a-5729-456e-98db-ccc104bdf860/callbacks/1268b1a8-57b5-485d-a597-8fd88ea27849"
  },
  "meta": {}
}
```

### 400, 401, 403, 498, 503

- `400` A param is missing or invalid, a record is not found, or the request cannot be served
- `401` Missing or invalid credentials, or no access to the requested data
- `403` Invalid token, or the user's role does not allow the request
- `498` Expired token, or a token with an invalid signature
- `503` Read-only mode during maintenance; try again later

**Content type:** `application/json`

schema: `Error`

- **`error` (required)**: `string`

  What went wrong

**Example:**

```json
{
  "error": ""
}
```

## Schemas

- `Error` — shown above.
- `post_apps_app_id_callbacks_Request` — shown above.
- `CallbackDocument` — shown above.
- `Links` — shown above.
- `CallbackResource` — shown above.
