import latitudesh_python_sdk
from latitudesh_python_sdk import Latitudesh
import os
with Latitudesh(
bearer=os.getenv("LATITUDESH_BEARER", ""),
) as latitudesh:
res = latitudesh.api_keys.create(data={
"type": latitudesh_python_sdk.CreateAPIKeyType.API_KEYS,
"attributes": {
"name": "App Token",
},
})
# Handle response
print(res){
"data": {
"id": "tok_ez2A3DVldnawP",
"type": "api_keys",
"attributes": {
"name": "App Token",
"token": "54ebfcfa2ad7f9fe0d4e081306554174d063",
"token_last_slice": "4d063",
"api_version": "2023-06-01",
"read_only": false,
"allowed_ips": [],
"created_at": "2026-01-14T15:56:29+00:00",
"updated_at": "2026-01-14T15:56:29+00:00",
"last_used_at": null,
"user": {
"id": "user_pVkpyK2aoVUlax6Zzx1pfrGe4wr",
"email": "nathanael@bartoletti-streich.test"
}
}
},
"meta": {}
}Create a new API Key that is tied to the current user account. The created API key is only listed ONCE upon creation. It can however be regenerated or deleted.
import latitudesh_python_sdk
from latitudesh_python_sdk import Latitudesh
import os
with Latitudesh(
bearer=os.getenv("LATITUDESH_BEARER", ""),
) as latitudesh:
res = latitudesh.api_keys.create(data={
"type": latitudesh_python_sdk.CreateAPIKeyType.API_KEYS,
"attributes": {
"name": "App Token",
},
})
# Handle response
print(res){
"data": {
"id": "tok_ez2A3DVldnawP",
"type": "api_keys",
"attributes": {
"name": "App Token",
"token": "54ebfcfa2ad7f9fe0d4e081306554174d063",
"token_last_slice": "4d063",
"api_version": "2023-06-01",
"read_only": false,
"allowed_ips": [],
"created_at": "2026-01-14T15:56:29+00:00",
"updated_at": "2026-01-14T15:56:29+00:00",
"last_used_at": null,
"user": {
"id": "user_pVkpyK2aoVUlax6Zzx1pfrGe4wr",
"email": "nathanael@bartoletti-streich.test"
}
}
},
"meta": {}
}Was this page helpful?