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.update_api_key(api_key_id="tok_lpbV0DgRq4AWz", data={
"id": "tok_lpbV0DgRq4AWz",
"type": latitudesh_python_sdk.UpdateAPIKeyType.API_KEYS,
"attributes": {
"name": "Updated Name",
},
})
# Handle response
print(res){
"data": {
"id": "tok_lpbV0DgRq4AWz",
"type": "api_keys",
"attributes": {
"name": "Updated Name",
"token_last_slice": "c10e6",
"api_version": "2023-06-01",
"read_only": false,
"allowed_ips": null,
"created_at": "2026-01-14T15:56:30+00:00",
"updated_at": "2026-01-14T15:56:30+00:00",
"last_used_at": null,
"user": {
"id": "user_YLMV5L9oYRFoe4Jo4l2PCGKr8bBa",
"email": "jaime@ullrich.example"
}
}
},
"meta": {}
}Update API Key settings (name, read_only, allowed_ips) without rotating the token. Use PUT to rotate the token.
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.update_api_key(api_key_id="tok_lpbV0DgRq4AWz", data={
"id": "tok_lpbV0DgRq4AWz",
"type": latitudesh_python_sdk.UpdateAPIKeyType.API_KEYS,
"attributes": {
"name": "Updated Name",
},
})
# Handle response
print(res){
"data": {
"id": "tok_lpbV0DgRq4AWz",
"type": "api_keys",
"attributes": {
"name": "Updated Name",
"token_last_slice": "c10e6",
"api_version": "2023-06-01",
"read_only": false,
"allowed_ips": null,
"created_at": "2026-01-14T15:56:30+00:00",
"updated_at": "2026-01-14T15:56:30+00:00",
"last_used_at": null,
"user": {
"id": "user_YLMV5L9oYRFoe4Jo4l2PCGKr8bBa",
"email": "jaime@ullrich.example"
}
}
},
"meta": {}
}Was this page helpful?