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

# Generating Embed Token (Deprecated)

> Learn how to generate embed token for embedding your agent's result in your website

> [!WARNING]
>
> **Deprecation Notice**
>
> All embedding features are being deprecated and will be removed from shortly.\
> We recommend that you do not build new integrations using this feature.
>
> **Recommended Alternative:** We recommend integrating Cekura into your platform via our [APIs](https://docs.cekura.ai/api-reference). We also have an [MCP server](https://docs.cekura.ai/mcp) to make it easier for you — simply ask Claude Code to use the Cekura MCP and get a UI quickly!
>
> If you have existing integrations using embedding, please plan to migrate to our APIs before the removal date.

## Overview

This documentation covers how to generate tokens required for embedding Cekura agents in your website or application.

## Base URL

```
https://api.cekura.ai
```

## Authentication Endpoint

### Generate Agent Embed Token

```
POST /user/v1/embedded/login/
```

This endpoint generates access and refresh tokens needed for embedding an agent in your application.

### Request Headers

| Header | Description |
| - | - |
| Content-Type | application/json |

### Request Body

```json theme={null}
{
    "api_key": "YOUR_API_KEY",
    "agent_id": 1
}
```

#### Parameters

* `api_key` (string, required): Your unique API key for authentication
* `agent_id` (integer, required): The unique identifier of the agent you want to embed

### Response

A successful request will return both refresh and access tokens required for agent embedding.

#### Success Response Example

```json theme={null}
{
    "refresh": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "access": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
```

#### Response Fields

* `refresh` (string): JWT refresh token used to obtain new access tokens when they expire
* `access` (string): JWT access token used for embedding the agent

### Error Responses

| Status Code | Description |
| - | - |
| 400 | Invalid request parameters |
| 401 | Invalid or missing API key |
| 403 | Unauthorized access |
| 500 | Internal server error |

## Implementation Steps

1. Obtain your API key from the Cekura dashboard
2. Make a POST request to the token generation endpoint
3. Store both the access and refresh tokens securely
4. Use these tokens when implementing the agent embed widget
5. Implement token refresh logic to maintain continuous agent functionality

## Token Usage

* The access token is required when initializing the agent embed widget
* Access tokens expire after 24 hours (1 day)
* Access tokens have a limited lifetime and will need to be refreshed
* Use the refresh token to obtain new access tokens when they expire

## Security Considerations

* Store your API key securely
* Use HTTPS for all API calls
* Never expose your API key or tokens in client-side code
* Implement proper error handling for failed token generation
* Store tokens securely and clear them when removing the agent embed


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