> For the complete documentation index, see [llms.txt](https://guides.ia.numerique.gouv.fr/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guides.ia.numerique.gouv.fr/albert-api/api-reference/liste-des-endpoint/keys.md).

# Keys

## Get Keys

> Get all your keys.

```json
{"openapi":"3.1.0","info":{"title":"Albert API","version":"0.8.0"},"tags":[{"name":"Keys"}],"servers":[{"url":"https://albert.api.etalab.gouv.fr"}],"security":[{"HTTPBearer":[]}],"components":{"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}},"schemas":{"SortField":{"type":"string","enum":["id","name","created"],"title":"SortField"},"SortOrder":{"type":"string","enum":["asc","desc"],"title":"SortOrder"},"KeysResponse":{"properties":{"object":{"type":"string","const":"list","title":"Object","description":"Type of the object.","default":"list"},"total":{"type":"integer","title":"Total","description":"Total number of keys."},"offset":{"type":"integer","title":"Offset","description":"Offset of the keys list."},"limit":{"type":"integer","title":"Limit","description":"Limit of the keys list."},"data":{"items":{"$ref":"#/components/schemas/KeyResponse"},"type":"array","title":"Data","description":"List of keys."}},"additionalProperties":true,"type":"object","required":["total","offset","limit","data"],"title":"KeysResponse"},"KeyResponse":{"properties":{"object":{"type":"string","const":"key","title":"Object","description":"Type of the object.","default":"key"},"id":{"type":"integer","title":"Id","description":"ID of the key."},"name":{"type":"string","title":"Name","description":"Name of the key."},"value":{"type":"string","title":"Value","description":"Value of the key."},"user_id":{"type":"integer","title":"User Id","description":"ID of the user that owns the key."},"expires":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Expires","description":"Time of expiration, as Unix timestamp. If None, the key never expires."},"created":{"type":"integer","title":"Created","description":"Time of creation, as Unix timestamp."}},"additionalProperties":true,"type":"object","required":["id","name","value","user_id","created"],"title":"KeyResponse"},"api__infrastructure__fastapi__documentation__HTTPExceptionModel":{"properties":{"status_code":{"type":"integer","title":"Status Code"},"detail":{"type":"string","title":"Detail"},"headers":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Headers"}},"type":"object","required":["status_code","detail"],"title":"HTTPExceptionModel"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v1/keys":{"get":{"tags":["Keys"],"summary":"Get Keys","description":"Get all your keys.","operationId":"get_keys_v1_keys_get","parameters":[{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Number of keys to skip.","default":0,"title":"Offset"},"description":"Number of keys to skip."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Maximum number of keys to return.","default":10,"title":"Limit"},"description":"Maximum number of keys to return."},{"name":"sort_by","in":"query","required":false,"schema":{"$ref":"#/components/schemas/SortField","description":"Field to sort by.","default":"id"},"description":"Field to sort by."},{"name":"sort_order","in":"query","required":false,"schema":{"$ref":"#/components/schemas/SortOrder","description":"Sort order.","default":"asc"},"description":"Sort order."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KeysResponse"}}}},"401":{"description":"Invalid authentication scheme.<br>Invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__infrastructure__fastapi__documentation__HTTPExceptionModel"}}}},"403":{"description":"Your account has expired. Please contact support to renew your account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__infrastructure__fastapi__documentation__HTTPExceptionModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Create Key

> Create a new API key for the authenticated user.

```json
{"openapi":"3.1.0","info":{"title":"Albert API","version":"0.8.0"},"tags":[{"name":"Keys"}],"servers":[{"url":"https://albert.api.etalab.gouv.fr"}],"security":[{"HTTPBearer":[]}],"components":{"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}},"schemas":{"CreateKeyBody":{"properties":{"name":{"type":"string","minLength":1,"title":"Name","description":"Name of the key."},"expires":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Expires","description":"Expiration time, as Unix timestamp. If None, uses the configured maximum key lifetime when set, otherwise the key never expires."}},"additionalProperties":true,"type":"object","required":["name"],"title":"CreateKeyBody"},"KeyResponse":{"properties":{"object":{"type":"string","const":"key","title":"Object","description":"Type of the object.","default":"key"},"id":{"type":"integer","title":"Id","description":"ID of the key."},"name":{"type":"string","title":"Name","description":"Name of the key."},"value":{"type":"string","title":"Value","description":"Value of the key."},"user_id":{"type":"integer","title":"User Id","description":"ID of the user that owns the key."},"expires":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Expires","description":"Time of expiration, as Unix timestamp. If None, the key never expires."},"created":{"type":"integer","title":"Created","description":"Time of creation, as Unix timestamp."}},"additionalProperties":true,"type":"object","required":["id","name","value","user_id","created"],"title":"KeyResponse"},"api__infrastructure__fastapi__documentation__HTTPExceptionModel":{"properties":{"status_code":{"type":"integer","title":"Status Code"},"detail":{"type":"string","title":"Detail"},"headers":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Headers"}},"type":"object","required":["status_code","detail"],"title":"HTTPExceptionModel"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v1/keys":{"post":{"tags":["Keys"],"summary":"Create Key","description":"Create a new API key for the authenticated user.","operationId":"create_key_v1_keys_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateKeyBody","description":"The key creation request."}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KeyResponse"}}}},"400":{"description":"Key expiration timestamp cannot be greater than {max_expiration_days} days from now.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__infrastructure__fastapi__documentation__HTTPExceptionModel"}}}},"401":{"description":"Invalid authentication scheme.<br>Invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__infrastructure__fastapi__documentation__HTTPExceptionModel"}}}},"403":{"description":"Your account has expired. Please contact support to renew your account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__infrastructure__fastapi__documentation__HTTPExceptionModel"}}}},"404":{"description":"User {user_id}|{email} not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__infrastructure__fastapi__documentation__HTTPExceptionModel"}}}},"409":{"description":"Key {name} already exists.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__infrastructure__fastapi__documentation__HTTPExceptionModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Get Keys

> Get all your keys.

```json
{"openapi":"3.1.0","info":{"title":"Albert API","version":"0.8.0"},"tags":[{"name":"Keys"}],"servers":[{"url":"https://albert.api.etalab.gouv.fr"}],"security":[{"HTTPBearer":[]}],"components":{"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}},"schemas":{"SortField":{"type":"string","enum":["id","name","created"],"title":"SortField"},"SortOrder":{"type":"string","enum":["asc","desc"],"title":"SortOrder"},"KeysResponse":{"properties":{"object":{"type":"string","const":"list","title":"Object","description":"Type of the object.","default":"list"},"total":{"type":"integer","title":"Total","description":"Total number of keys."},"offset":{"type":"integer","title":"Offset","description":"Offset of the keys list."},"limit":{"type":"integer","title":"Limit","description":"Limit of the keys list."},"data":{"items":{"$ref":"#/components/schemas/KeyResponse"},"type":"array","title":"Data","description":"List of keys."}},"additionalProperties":true,"type":"object","required":["total","offset","limit","data"],"title":"KeysResponse"},"KeyResponse":{"properties":{"object":{"type":"string","const":"key","title":"Object","description":"Type of the object.","default":"key"},"id":{"type":"integer","title":"Id","description":"ID of the key."},"name":{"type":"string","title":"Name","description":"Name of the key."},"value":{"type":"string","title":"Value","description":"Value of the key."},"user_id":{"type":"integer","title":"User Id","description":"ID of the user that owns the key."},"expires":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Expires","description":"Time of expiration, as Unix timestamp. If None, the key never expires."},"created":{"type":"integer","title":"Created","description":"Time of creation, as Unix timestamp."}},"additionalProperties":true,"type":"object","required":["id","name","value","user_id","created"],"title":"KeyResponse"},"api__infrastructure__fastapi__documentation__HTTPExceptionModel":{"properties":{"status_code":{"type":"integer","title":"Status Code"},"detail":{"type":"string","title":"Detail"},"headers":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Headers"}},"type":"object","required":["status_code","detail"],"title":"HTTPExceptionModel"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v1/me/keys":{"get":{"tags":["Keys"],"summary":"Get Keys","description":"Get all your keys.","operationId":"get_keys_v1_me_keys_get","deprecated":true,"parameters":[{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Number of keys to skip.","default":0,"title":"Offset"},"description":"Number of keys to skip."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Maximum number of keys to return.","default":10,"title":"Limit"},"description":"Maximum number of keys to return."},{"name":"sort_by","in":"query","required":false,"schema":{"$ref":"#/components/schemas/SortField","description":"Field to sort by.","default":"id"},"description":"Field to sort by."},{"name":"sort_order","in":"query","required":false,"schema":{"$ref":"#/components/schemas/SortOrder","description":"Sort order.","default":"asc"},"description":"Sort order."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KeysResponse"}}}},"401":{"description":"Invalid authentication scheme.<br>Invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__infrastructure__fastapi__documentation__HTTPExceptionModel"}}}},"403":{"description":"Your account has expired. Please contact support to renew your account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__infrastructure__fastapi__documentation__HTTPExceptionModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Create Key

> Create a new API key for the authenticated user.

```json
{"openapi":"3.1.0","info":{"title":"Albert API","version":"0.8.0"},"tags":[{"name":"Keys"}],"servers":[{"url":"https://albert.api.etalab.gouv.fr"}],"security":[{"HTTPBearer":[]}],"components":{"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}},"schemas":{"CreateKeyBody":{"properties":{"name":{"type":"string","minLength":1,"title":"Name","description":"Name of the key."},"expires":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Expires","description":"Expiration time, as Unix timestamp. If None, uses the configured maximum key lifetime when set, otherwise the key never expires."}},"additionalProperties":true,"type":"object","required":["name"],"title":"CreateKeyBody"},"KeyResponse":{"properties":{"object":{"type":"string","const":"key","title":"Object","description":"Type of the object.","default":"key"},"id":{"type":"integer","title":"Id","description":"ID of the key."},"name":{"type":"string","title":"Name","description":"Name of the key."},"value":{"type":"string","title":"Value","description":"Value of the key."},"user_id":{"type":"integer","title":"User Id","description":"ID of the user that owns the key."},"expires":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Expires","description":"Time of expiration, as Unix timestamp. If None, the key never expires."},"created":{"type":"integer","title":"Created","description":"Time of creation, as Unix timestamp."}},"additionalProperties":true,"type":"object","required":["id","name","value","user_id","created"],"title":"KeyResponse"},"api__infrastructure__fastapi__documentation__HTTPExceptionModel":{"properties":{"status_code":{"type":"integer","title":"Status Code"},"detail":{"type":"string","title":"Detail"},"headers":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Headers"}},"type":"object","required":["status_code","detail"],"title":"HTTPExceptionModel"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v1/me/keys":{"post":{"tags":["Keys"],"summary":"Create Key","description":"Create a new API key for the authenticated user.","operationId":"create_key_v1_me_keys_post","deprecated":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateKeyBody","description":"The key creation request."}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KeyResponse"}}}},"400":{"description":"Key expiration timestamp cannot be greater than {max_expiration_days} days from now.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__infrastructure__fastapi__documentation__HTTPExceptionModel"}}}},"401":{"description":"Invalid authentication scheme.<br>Invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__infrastructure__fastapi__documentation__HTTPExceptionModel"}}}},"403":{"description":"Your account has expired. Please contact support to renew your account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__infrastructure__fastapi__documentation__HTTPExceptionModel"}}}},"404":{"description":"User {user_id}|{email} not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__infrastructure__fastapi__documentation__HTTPExceptionModel"}}}},"409":{"description":"Key {name} already exists.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__infrastructure__fastapi__documentation__HTTPExceptionModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Get Key

> Get one of your API keys by ID.

```json
{"openapi":"3.1.0","info":{"title":"Albert API","version":"0.8.0"},"tags":[{"name":"Keys"}],"servers":[{"url":"https://albert.api.etalab.gouv.fr"}],"security":[{"HTTPBearer":[]}],"components":{"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}},"schemas":{"KeyResponse":{"properties":{"object":{"type":"string","const":"key","title":"Object","description":"Type of the object.","default":"key"},"id":{"type":"integer","title":"Id","description":"ID of the key."},"name":{"type":"string","title":"Name","description":"Name of the key."},"value":{"type":"string","title":"Value","description":"Value of the key."},"user_id":{"type":"integer","title":"User Id","description":"ID of the user that owns the key."},"expires":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Expires","description":"Time of expiration, as Unix timestamp. If None, the key never expires."},"created":{"type":"integer","title":"Created","description":"Time of creation, as Unix timestamp."}},"additionalProperties":true,"type":"object","required":["id","name","value","user_id","created"],"title":"KeyResponse"},"api__infrastructure__fastapi__documentation__HTTPExceptionModel":{"properties":{"status_code":{"type":"integer","title":"Status Code"},"detail":{"type":"string","title":"Detail"},"headers":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Headers"}},"type":"object","required":["status_code","detail"],"title":"HTTPExceptionModel"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v1/keys/{key_id}":{"get":{"tags":["Keys"],"summary":"Get Key","description":"Get one of your API keys by ID.","operationId":"get_key_v1_keys__key_id__get","parameters":[{"name":"key_id","in":"path","required":true,"schema":{"type":"integer","description":"The ID of the key to get.","title":"Key Id"},"description":"The ID of the key to get."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KeyResponse"}}}},"401":{"description":"Invalid authentication scheme.<br>Invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__infrastructure__fastapi__documentation__HTTPExceptionModel"}}}},"403":{"description":"Your account has expired. Please contact support to renew your account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__infrastructure__fastapi__documentation__HTTPExceptionModel"}}}},"404":{"description":"Key {key_id} not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__infrastructure__fastapi__documentation__HTTPExceptionModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Delete Key

> Delete an API key.

```json
{"openapi":"3.1.0","info":{"title":"Albert API","version":"0.8.0"},"tags":[{"name":"Keys"}],"servers":[{"url":"https://albert.api.etalab.gouv.fr"}],"security":[{"HTTPBearer":[]}],"components":{"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}},"schemas":{"KeyResponse":{"properties":{"object":{"type":"string","const":"key","title":"Object","description":"Type of the object.","default":"key"},"id":{"type":"integer","title":"Id","description":"ID of the key."},"name":{"type":"string","title":"Name","description":"Name of the key."},"value":{"type":"string","title":"Value","description":"Value of the key."},"user_id":{"type":"integer","title":"User Id","description":"ID of the user that owns the key."},"expires":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Expires","description":"Time of expiration, as Unix timestamp. If None, the key never expires."},"created":{"type":"integer","title":"Created","description":"Time of creation, as Unix timestamp."}},"additionalProperties":true,"type":"object","required":["id","name","value","user_id","created"],"title":"KeyResponse"},"api__infrastructure__fastapi__documentation__HTTPExceptionModel":{"properties":{"status_code":{"type":"integer","title":"Status Code"},"detail":{"type":"string","title":"Detail"},"headers":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Headers"}},"type":"object","required":["status_code","detail"],"title":"HTTPExceptionModel"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v1/keys/{key_id}":{"delete":{"tags":["Keys"],"summary":"Delete Key","description":"Delete an API key.","operationId":"delete_key_v1_keys__key_id__delete","parameters":[{"name":"key_id","in":"path","required":true,"schema":{"type":"integer","description":"The ID of the key to delete.","title":"Key Id"},"description":"The ID of the key to delete."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KeyResponse"}}}},"401":{"description":"Invalid authentication scheme.<br>Invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__infrastructure__fastapi__documentation__HTTPExceptionModel"}}}},"403":{"description":"Your account has expired. Please contact support to renew your account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__infrastructure__fastapi__documentation__HTTPExceptionModel"}}}},"404":{"description":"Key {key_id} not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__infrastructure__fastapi__documentation__HTTPExceptionModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Get Key

> Get one of your API keys by ID.

```json
{"openapi":"3.1.0","info":{"title":"Albert API","version":"0.8.0"},"tags":[{"name":"Keys"}],"servers":[{"url":"https://albert.api.etalab.gouv.fr"}],"security":[{"HTTPBearer":[]}],"components":{"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}},"schemas":{"KeyResponse":{"properties":{"object":{"type":"string","const":"key","title":"Object","description":"Type of the object.","default":"key"},"id":{"type":"integer","title":"Id","description":"ID of the key."},"name":{"type":"string","title":"Name","description":"Name of the key."},"value":{"type":"string","title":"Value","description":"Value of the key."},"user_id":{"type":"integer","title":"User Id","description":"ID of the user that owns the key."},"expires":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Expires","description":"Time of expiration, as Unix timestamp. If None, the key never expires."},"created":{"type":"integer","title":"Created","description":"Time of creation, as Unix timestamp."}},"additionalProperties":true,"type":"object","required":["id","name","value","user_id","created"],"title":"KeyResponse"},"api__infrastructure__fastapi__documentation__HTTPExceptionModel":{"properties":{"status_code":{"type":"integer","title":"Status Code"},"detail":{"type":"string","title":"Detail"},"headers":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Headers"}},"type":"object","required":["status_code","detail"],"title":"HTTPExceptionModel"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v1/me/keys/{key_id}":{"get":{"tags":["Keys"],"summary":"Get Key","description":"Get one of your API keys by ID.","operationId":"get_key_v1_me_keys__key_id__get","deprecated":true,"parameters":[{"name":"key_id","in":"path","required":true,"schema":{"type":"integer","description":"The ID of the key to get.","title":"Key Id"},"description":"The ID of the key to get."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KeyResponse"}}}},"401":{"description":"Invalid authentication scheme.<br>Invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__infrastructure__fastapi__documentation__HTTPExceptionModel"}}}},"403":{"description":"Your account has expired. Please contact support to renew your account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__infrastructure__fastapi__documentation__HTTPExceptionModel"}}}},"404":{"description":"Key {key_id} not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__infrastructure__fastapi__documentation__HTTPExceptionModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}}}
```

## Delete Key

> Delete an API key.

```json
{"openapi":"3.1.0","info":{"title":"Albert API","version":"0.8.0"},"tags":[{"name":"Keys"}],"servers":[{"url":"https://albert.api.etalab.gouv.fr"}],"security":[{"HTTPBearer":[]}],"components":{"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}},"schemas":{"KeyResponse":{"properties":{"object":{"type":"string","const":"key","title":"Object","description":"Type of the object.","default":"key"},"id":{"type":"integer","title":"Id","description":"ID of the key."},"name":{"type":"string","title":"Name","description":"Name of the key."},"value":{"type":"string","title":"Value","description":"Value of the key."},"user_id":{"type":"integer","title":"User Id","description":"ID of the user that owns the key."},"expires":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Expires","description":"Time of expiration, as Unix timestamp. If None, the key never expires."},"created":{"type":"integer","title":"Created","description":"Time of creation, as Unix timestamp."}},"additionalProperties":true,"type":"object","required":["id","name","value","user_id","created"],"title":"KeyResponse"},"api__infrastructure__fastapi__documentation__HTTPExceptionModel":{"properties":{"status_code":{"type":"integer","title":"Status Code"},"detail":{"type":"string","title":"Detail"},"headers":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Headers"}},"type":"object","required":["status_code","detail"],"title":"HTTPExceptionModel"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v1/me/keys/{key_id}":{"delete":{"tags":["Keys"],"summary":"Delete Key","description":"Delete an API key.","operationId":"delete_key_v1_me_keys__key_id__delete","deprecated":true,"parameters":[{"name":"key_id","in":"path","required":true,"schema":{"type":"integer","description":"The ID of the key to delete.","title":"Key Id"},"description":"The ID of the key to delete."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KeyResponse"}}}},"401":{"description":"Invalid authentication scheme.<br>Invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__infrastructure__fastapi__documentation__HTTPExceptionModel"}}}},"403":{"description":"Your account has expired. Please contact support to renew your account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__infrastructure__fastapi__documentation__HTTPExceptionModel"}}}},"404":{"description":"Key {key_id} not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__infrastructure__fastapi__documentation__HTTPExceptionModel"}}}},"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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://guides.ia.numerique.gouv.fr/albert-api/api-reference/liste-des-endpoint/keys.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
