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

# Cometly API integration

> Activate the Cometly API in your space and create a Cometly API token, so your own systems can send leads, sales and other events to Cometly.

The Cometly API lets you send events from any platform in your tech stack. An event is an action someone takes on the way to becoming a customer, such as a lead, a booked call or a purchase. To use the API, you activate it in your space (a workspace with its own settings, integrations and data) and create a Cometly API token, the key your requests sign in with.

This matters when a conversion happens somewhere Cometly has no ready-made integration for, such as your own app or back office. Once those events reach Cometly, they are attributed to your ads like any other event, so you can see which campaign, ad set and ad produced each one. For endpoints, request formats and examples, see the [Developer Docs](https://docs.cometly.com/api-reference/overview.md).

## Activate the API and create a token

You need the **Administrator** or **Owner** role in the space to see the **Cometly API** card.

1. In Cometly, click **Integrations** in the left sidebar.
2. Select the **Webhooks & API** category and click the **Cometly API** card.
3. Click **Activate Cometly API**.
4. Under **Manage API tokens**, enter a **Token Name** and click **Create Token**.
5. Copy the token straight away. For security reasons, it is not shown again.

![The Cometly API page with the API activated, showing step 2 Manage API tokens, the Token Name field, one token under Your Tokens, and an arrow pointing at the Create Token button.](https://mintcdn.com/cometly/4NU5YV9iL1PADmGE/images/integrations/api/01.webp?fit=max\&auto=format\&n=4NU5YV9iL1PADmGE\&q=85\&s=027e7e69946e5ebf25c9fb6ae32cd07e)

Your tokens are listed under **Your Tokens** with their created and last used dates. Delete a token there when you no longer need it. Any application or integration using a deleted token stops working immediately.

## Check it worked

The **Cometly API** card now shows **Cometly API activated**, and your new token appears under **Your Tokens** with its created date. After your application sends its first request, the token's last used date tells you when it was last used.

## Frequently asked questions

### Should I use the Cometly API or a webhook to send events?

Use a webhook for most integrations: you set it up in Cometly without writing code, and it works with any platform that can send webhooks. Use the API for custom implementations where you need full control over when and how events are sent, such as server-side tracking from your own application. [Sending data to Cometly](https://docs.cometly.com/concepts/sending-data-to-cometly.md) compares the two.

### How do I use my Cometly API token in a request?

Send the token in the `Authorization` header of every request, using the Bearer scheme. [Authentication](https://docs.cometly.com/introduction/authentication.md) lists the required headers with an example request. For help with the API, contact [developers@cometly.com](mailto:developers@cometly.com).

### How many API tokens can I create in Cometly?

A space can hold up to 25 API tokens at a time. When you reach that number, delete a token you no longer need before you create a new one. A separate, clearly named token for each application makes it easy to delete one without affecting the others.

## Next steps

* [API reference overview](https://docs.cometly.com/api-reference/overview.md)
* [Authentication](https://docs.cometly.com/introduction/authentication.md)
* [Sending data to Cometly](https://docs.cometly.com/concepts/sending-data-to-cometly.md)
* [Create an event with the API](https://docs.cometly.com/api-reference/endpoint/create-event.md)
* [Cometly webhooks integration](https://docs.cometly.com/integrations/webhooks.md)

Still have questions or need a hand? We're happy to help. Reach our team at [support@cometly.com](mailto:support@cometly.com).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.