client.users.post_api_keysο
A method of the Users endpoint.
- post_api_keys(id: str, expires_in: int, name: str, *, constraints: List[dict] = None) Responseο
Create a new API key belonging to the logged-in user
API URL:
POST /users/{id}/api_keysimport civis client = civis.APIClient() response = client.users.post_api_keys(...)
- Parameters:
- idstr
The ID of the user or βmeβ.
- expires_inint
The number of seconds the key should last for.
- namestr
The name of the API key.
- constraintsList[dict], optional
Constraints on the abilities of the created key.
- constraintstr
The path matcher of the constraint.
- constraint_typestr
The type of constraint (exact/prefix/regex/verb).
- get_allowedbool
Whether the constraint allows GET requests.
- head_allowedbool
Whether the constraint allows HEAD requests.
- post_allowedbool
Whether the constraint allows POST requests.
- put_allowedbool
Whether the constraint allows PUT requests.
- patch_allowedbool
Whether the constraint allows PATCH requests.
- delete_allowedbool
Whether the constraint allows DELETE requests.
- Returns:
civis.Response- idint
The ID of the API key.
- namestr
The name of the API key.
- expires_atstr (date-time)
The date and time when the key expired.
- created_atstr (date-time)
The date and time when the key was created.
- revoked_atstr (date-time)
The date and time when the key was revoked.
- last_used_atstr (date-time)
The date and time when the key was last used.
- scopesList[str]
The scopes which the key is permissioned on.
- use_countint
The number of times the key has been used.
- expiredbool
True if the key has expired.
- activebool
True if the key has neither expired nor been revoked.
- constraintsList[
civis.Response] Constraints on the abilities of the created key
- constraintstr
The path matcher of the constraint.
- constraint_typestr
The type of constraint (exact/prefix/regex/verb).
- get_allowedbool
Whether the constraint allows GET requests.
- head_allowedbool
Whether the constraint allows HEAD requests.
- post_allowedbool
Whether the constraint allows POST requests.
- put_allowedbool
Whether the constraint allows PUT requests.
- patch_allowedbool
Whether the constraint allows PATCH requests.
- delete_allowedbool
Whether the constraint allows DELETE requests.
- constraintsList[
- tokenstr
The API key.