# Create new api key

Create a new API key for programmatic access to the DeltaDeFi trading API. API keys provide a more permanent authentication method compared to JWT tokens.

***

## Create new API key

> Create new API key

```json
{"openapi":"3.1.1","info":{"title":"Espresso API Server","version":"1.0"},"security":[{"ApiKeyAuth":[]}],"paths":{"/accounts/new-api-key":{"get":{"description":"Create new API key","tags":["accounts"],"summary":"Create new API key","parameters":[{"schema":{"type":"string"},"description":"API Key","name":"X-API-KEY","in":"header","required":true}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/espresso_internal_api_response.CreateNewAPIKeyResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/espresso_internal_api_response.ErrorJSONWithCodeResponse"}}}}}}}},"components":{"schemas":{"espresso_internal_api_response.CreateNewAPIKeyResponse":{"type":"object","properties":{"api_key":{"type":"string"},"created_at":{"type":"string"}}},"espresso_internal_api_response.ErrorJSONWithCodeResponse":{"type":"object","properties":{"code":{"type":"integer"},"error":{"type":"string"}}}}}}
```

## Important Notes

{% hint style="warning" %}
**Security Warning:**

* Creating a new API key will invalidate your previous API key.
* Never share your API key or commit it to version control.
  {% endhint %}

{% hint style="info" %}
**Authentication:** You can authenticate this request using:

* Your current API key in the `X-API-KEY` header
  {% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.deltadefi.io/start-trading/developers/api-documentation/account/create-new-api-key.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
