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

# Authentication

> How to authenticate with the Writesonic GEO API using your API key.

All API requests require an `X-API-KEY` header with your Writesonic API key.

```bash theme={"system"}
curl --request POST \
  --url https://api.writesonic.com/v2/geo/business/prompts \
  --header 'Content-Type: application/json' \
  --header 'X-API-KEY: <your-api-key>' \
  --data '{
    "project_id": "your-project-id"
  }'
```

## How to Find Your API Key

<Steps>
  <Step title="Log in to Writesonic">
    Go to [app.writesonic.com](https://app.writesonic.com) and sign in with your account.
  </Step>

  <Step title="Open the API Dashboard">
    Hover over your profile picture in the top-right corner and select **API Dashboard** from the menu.
  </Step>

  <Step title="Activate the API">
    Find the activation toggle and switch it **on** to enable API access.
  </Step>

  <Step title="Reveal your API key">
    Click the **Reveal API Key** button. Your key will be displayed — click to copy it.
  </Step>
</Steps>

<Warning>
  Never commit your API key to public repositories (GitHub, GitLab, Bitbucket) or store it in client-side code. Use environment variables or a secrets manager.
</Warning>

## Base URL

All GEO API endpoints use the following base URL:

```
https://api.writesonic.com
```

## Authentication Header

| Header         | Value                   | Required |
| -------------- | ----------------------- | -------- |
| `X-API-KEY`    | Your Writesonic API key | Yes      |
| `Content-Type` | `application/json`      | Yes      |

## Error Responses

| Status Code | Meaning                                    |
| ----------- | ------------------------------------------ |
| `401`       | Missing or invalid API key                 |
| `403`       | API key valid but insufficient permissions |
| `422`       | Validation error in request body           |
| `429`       | Rate limit exceeded                        |
