# POST /platform/v1/ens-callbacks

Registers a new callback to receive event notifications. You must register and verify your callback before you use it in a subscription.

## JSON Parameters

| Name           | Type    | Description                                                                                                                                                                                                                                                       |
| -------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `callbackName` | string  | Required. The name of the callback.                                                                                                                                                                                                                               |
| `url`          | string  | Required. The URL of the customer callback that receives event notifications in the format `https://host`[/path]. Ports and query string aren’t supported. The URL must be syntactically correct and not already registered as a callback URL.                    |
| `maxBatchSize` | integer | The maximum number of events that this callback can receive in a single call. The default value is 1,000. For the minimum and maximum batch sizes, see [API Limits and Guidelines](https://help.salesforce.com/s/articleView?id=mktg.mc_overview_limits_api.htm). |

## Usage

Your URL endpoint must be online and reachable before you create a callback. The Event Notification Service immediately attempts to post verification details to the endpoint.

If your callback doesn’t respond within 30 seconds or returns an HTTP response other than `200 OK`, the callback creation request fails with a `400 Bad Request` status. In this situation, the response includes a description of the failure, similar to this example.

```
"MCMS_UWH_Runtime_GeneralFailure_probeCallbackLiveness: CallbackId is 08b67f0e-5be8-4673-97e9-682c133f778c. Could not verify callback url `'https://example.com'`. Please test that the url is reachable with a https POST call and returns a 200 http status code. To retry please delete the callback and create it again. Status: NameResolutionFailure. The remote name could not be resolved: 'example.com'"
```

### Example Request

```json
Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com
POST /platform/v1/ens-callbacks
Content-Type: application/json
Authorization: Bearer YOUR_ACCESS_TOKEN

[
  {
    "callbackName": "cb1",
    "url": "https://example.com/",
    "maxBatchSize": 1000
  }
]
```

### Example Response

```json
HTTP/1.1 201 Created

[
  {
    "callbackName": "cb1",
    "callbackId": "65b885ab-c2b4-46fe-85d0-d6cb8be8057d",
    "url": "https://example.com/",
    "signatureKey":"V27FXfqI3DnhfQW1bhFDeJixpt8eDAY5R24UJI3cK6M=",
    "maxBatchSize": 1000
  }
]
```

### HTTP Responses

| Response         | Reason                                          |
| ---------------- | ----------------------------------------------- |
| 201 Created      | The callback was created.                       |
| 304 No Change    | The callback already exists on the server.      |
| 400 Bad Request  | The server was unable to process the request.   |
| 403 Forbidden    | The server was unable to authorize the request. |
| 500 Server Error | An internal error occurred.                     |

## See Also

- [Event Notification Service](/docs/marketing/marketing-cloud/guide/ens.md)
- [Verify Callback](/docs/marketing/marketing-cloud/references/mc_rest_event_notification/verifyCallback.md)
