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

# Authentication

> Learn how to authenticate with DomoAI Enterprise API using API keys

DomoAI Enterprise API uses Bearer Token authentication based on API Keys. Each API key is associated with your organization for secure access.

## Organization Status Restrictions

When an organization is in the `BANNED` state, Open APIs authenticated with a valid API key whose organization is banned will be denied access.

* Open APIs authenticated with a valid API key whose organization is banned return HTTP `403` with error code `4002` and message `Organization is banned`.

## Get Your API Key

To authenticate with DomoAI Enterprise API, you'll need an API key.

Visit the [Dashboard - API Keys](https://platform.domoai.com/api-keys) to generate your API key and manage your organization settings.

## Authentication Examples

### Video Generation Request

Include your API key in the Authorization header of every request:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.domoai.com/v1/video/text2video" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer <YOUR_API_KEY>" \
    -d '{
      "prompt": "A beautiful sunset over mountains with golden clouds",
      "model": "t2v-2.4-faster",
      "duration": 5
    }'
  ```

  ```javascript JavaScript/Node.js theme={null}
  const response = await fetch('https://api.domoai.com/v1/video/text2video', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer <YOUR_API_KEY>'
    },
    body: JSON.stringify({
      prompt: 'A beautiful sunset over mountains with golden clouds',
      model: 't2v-2.4-faster',
      duration: 5
    })
  });

  const result = await response.json();
  console.log('Task ID:', result.data.task_id);
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.domoai.com/v1/video/text2video"
  headers = {
      "Content-Type": "application/json",
      "Authorization": "Bearer <YOUR_API_KEY>"
  }
  data = {
      "prompt": "A beautiful sunset over mountains with golden clouds",
      "model": "t2v-2.4-faster",
      "duration": 5
  }

  response = requests.post(url, headers=headers, json=data)
  result = response.json()
  print(f"Task ID: {result['data']['task_id']}")
  ```
</CodeGroup>

### Check Task Status

<CodeGroup>
  ```bash cURL theme={null}
  curl -H "Authorization: Bearer <YOUR_API_KEY>" \
    "https://api.domoai.com/v1/tasks/<YOUR_TASK_ID>"
  ```

  ```javascript JavaScript theme={null}
  const taskId = "<YOUR_TASK_ID>";
  const response = await fetch(`https://api.domoai.com/v1/tasks/${taskId}`, {
    headers: {
      'Authorization': 'Bearer <YOUR_API_KEY>'
    }
  });

  const task = await response.json();
  console.log('Status:', task.data.status);
  if (task.data.status === 'COMPLETED') {
    console.log('Video URL:', task.data.video_url);
  }
  ```

  ```python Python theme={null}
  import requests

  task_id = "<YOUR_TASK_ID>"

  response = requests.get(
      f"https://api.domoai.com/v1/tasks/{task_id}",
      headers={"Authorization": "Bearer <YOUR_API_KEY>"}
  )

  task = response.json()
  print(f"Status: {task['data']['status']}")
  if task['data']['status'] == 'COMPLETED':
      print(f"Video URL: {task['data']['video_url']}")
  ```
</CodeGroup>

### Expected Response Format

**Successful Authentication Response:**

```json theme={null}
{
  "data": {
    "task_id": "<YOUR_TASK_ID>"
  }
}
```

**Authentication Error Response:**

```json theme={null}
{
    "detail": "Invalid or revoked API Key"
}
```

## Next Steps

Ready to start building? Here are your next steps:

<CardGroup cols={1}>
  <Card title="API Reference" icon="book" href="/api-reference/introduction">
    Browse our complete API documentation
  </Card>
</CardGroup>
