> For the complete documentation index, see [llms.txt](https://docs.mithril.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mithril.ai/compute-api/compute-api-reference/api-keys.md).

# API Keys

## Get Api Keys

> Get all API keys registered to the user

```json
{"openapi":"3.1.0","info":{"title":"Mithril","version":"1.0.0"},"servers":[{"url":"https://api.mithril.ai"}],"security":[{"MithrilAPIKey":[]}],"components":{"securitySchemes":{"MithrilAPIKey":{"type":"http","scheme":"bearer","bearerFormat":"fkey_<key>"}},"schemas":{"ApiKeyModel":{"properties":{"fid":{"type":"string","title":"Fid"},"name":{"type":"string","title":"Name"},"created_at":{"type":"string","format":"datetime","title":"Created At"},"expires_at":{"type":"string","format":"datetime","title":"Expires At"},"deactivated_at":{"type":"string","format":"datetime","nullable":true},"snippet":{"type":"string","title":"Snippet"}},"type":"object","required":["fid","name","created_at","expires_at","snippet"],"title":"ApiKeyModel"}}},"paths":{"/v2/api-keys":{"get":{"tags":["API Keys"],"summary":"Get Api Keys","description":"Get all API keys registered to the user","operationId":"get_api_keys_v2_api_keys_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ApiKeyModel"},"type":"array","title":"Response Get Api Keys V2 Api Keys Get"}}}},"401":{"description":"Invalid credentials"}}}}}}
```

## Create Api Key

> Create a new API key

```json
{"openapi":"3.1.0","info":{"title":"Mithril","version":"1.0.0"},"servers":[{"url":"https://api.mithril.ai"}],"security":[{"MithrilAPIKey":[]}],"components":{"securitySchemes":{"MithrilAPIKey":{"type":"http","scheme":"bearer","bearerFormat":"fkey_<key>"}},"schemas":{"CreateApiKeyRequest":{"properties":{"name":{"type":"string","title":"Name"},"expires_at":{"type":"string","format":"datetime","title":"Expires At"}},"type":"object","required":["name","expires_at"],"title":"CreateApiKeyRequest"},"CreateApiKeyResponse":{"properties":{"fid":{"type":"string","title":"Fid"},"name":{"type":"string","title":"Name"},"created_at":{"type":"string","format":"datetime","title":"Created At"},"expires_at":{"type":"string","format":"datetime","title":"Expires At"},"deactivated_at":{"type":"string","format":"datetime","nullable":true},"snippet":{"type":"string","title":"Snippet"},"secret":{"type":"string","title":"Secret"}},"type":"object","required":["fid","name","created_at","expires_at","snippet","secret"],"title":"CreateApiKeyResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"oneOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v2/api-keys":{"post":{"tags":["API Keys"],"summary":"Create Api Key","description":"Create a new API key","operationId":"create_api_key_v2_api_keys_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateApiKeyRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateApiKeyResponse"}}}},"400":{"description":"Invalid request parameters"},"401":{"description":"Invalid credentials"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Revoke Api Key

> Revoke an API key

```json
{"openapi":"3.1.0","info":{"title":"Mithril","version":"1.0.0"},"servers":[{"url":"https://api.mithril.ai"}],"security":[{"MithrilAPIKey":[]}],"components":{"securitySchemes":{"MithrilAPIKey":{"type":"http","scheme":"bearer","bearerFormat":"fkey_<key>"}},"schemas":{"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"oneOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v2/api-keys/{key_fid}":{"delete":{"tags":["API Keys"],"summary":"Revoke Api Key","description":"Revoke an API key","operationId":"revoke_api_key_v2_api_keys__key_fid__delete","parameters":[{"name":"key_fid","in":"path","required":true,"schema":{"type":"string","title":"Key Fid"}}],"responses":{"204":{"description":"Successful Response"},"400":{"description":"Invalid request"},"401":{"description":"Invalid credentials"},"404":{"description":"API key not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.mithril.ai/compute-api/compute-api-reference/api-keys.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
