# 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: 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.mithril.ai/compute-api/compute-api-reference/api-keys.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.
