> For the complete documentation index, see [llms.txt](https://ajaib.gitbook.io/ajaib-exchange-open-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ajaib.gitbook.io/ajaib-exchange-open-api/getting-started/api-security/generate-api-key.md).

# Generate API Key

This endpoint allows you to exchange your Ed25519 public key for an API Key.

<mark style="color:green;">`POST`</mark> `/auth/v1/api-key`

**Headers**

| Name          | Value                               |
| ------------- | ----------------------------------- |
| Content-Type  | `application/x-www-form-urlencoded` |
| Authorization | \<User JWT Token>                   |

**Body**

| Name             | Description                             |
| ---------------- | --------------------------------------- |
| `public_key_pem` | Ed25519 public key (**base64 encoded**) |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "code": "200000",
  "message": "API key successfully generated",
  "data": {
    "api_key": "<THIS_IS_THE_API_KEY>"
  }
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "code": "400000",
  "message": "Invalid Ed25519 public key",
  "data": null
}
```

{% endtab %}
{% endtabs %}

**WARNING: DO NOT SHARE YOUR API KEY WITH ANYONE.**
