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": "38d2bcabe06f43d93dc99c672a1b4ae2c5bc",
"token_last_slice": "2c5bc",
"api_version": "2023-06-01",
"created_at": "2025-07-16T18:36:26+00:00",
"updated_at": "2025-07-16T18:36:26+00:00",
"last_used_at": null,
"user": {
"id": "user_W3oeKxYvbWIQlBGElMVWsrK2Qyw",
"email": "[email protected]"
}
}
},
"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": "38d2bcabe06f43d93dc99c672a1b4ae2c5bc",
"token_last_slice": "2c5bc",
"api_version": "2023-06-01",
"created_at": "2025-07-16T18:36:26+00:00",
"updated_at": "2025-07-16T18:36:26+00:00",
"last_used_at": null,
"user": {
"id": "user_W3oeKxYvbWIQlBGElMVWsrK2Qyw",
"email": "[email protected]"
}
}
},
"meta": {}
}Created
Show child attributes
api_keys Show child attributes
Name of the API Key
The API version associated with this API Key
The last 5 characters of the token created for this API Key
The last time a request was made to the API using this API Key
The time when the API Key was created
The time when the API Key was updated
Was this page helpful?