These APIs can be called from the backend using your PropelAuth API Key. These APIs are used to validate, create, and delete API Keys for your users - which are separate from your PropelAuth API Key.
These can also be referred to as M2M (Machine to Machine) Keys or Service Accounts.
{ metadata: {"customKey":"customValue" },// This is only included if the API key is associated with a user user: { userId:"31c41c16-c281-44ae-9602-8a047e3bf33d", email:"test@example.com",// ... },// This is only included if the API key is associated with an organization org: { orgId:"1189c444-8a2d-4c41-8b4b-ae43ce79a492", orgName:"Example Organization",// ... },// This is only included if the API key is associated // with BOTH a user and an organization userInOrg: { userAssignedRole:"Guest", userPermissions: ["CanReadProjectList"],// ... }}
{"metadata": {"customKey":"customValue" },// This is only included if the API key is associated with a user"user": {"user_id":"31c41c16-c281-44ae-9602-8a047e3bf33d","email":"test@example",// ... },// This is only included if the API key is associated with an organization"org": {"org_id":"1189c444-8a2d-4c41-8b4b-ae43ce79a492","org_name":"Example Organization",// ... },// This is only included if the API key is associated// with BOTH a user and an organization"user_in_org": {"userAssignedRole":"Guest","userPermissions": ["CanReadProjectList"],// ... }}
ValidateApiKeyResponse { metadata: Some(serde_json::json!({"customKey":"customValue" }),// This is only included if the API key is associated with a user user: Some(UserMetadata { user_id:"31c41c16-c281-44ae-9602-8a047e3bf33d".to_string(), email:"test@example.com".to_string(),// ... }),// This is only included if the API key is associated with an organization org: Some(OrgMetadata { org_id:"1189c444-8a2d-4c41-8b4b-ae43ce79a492".to_string(), org_name:"Example Organization".to_string(),// ... }),// This is only included if the API key is associated// with BOTH a user and an organization user_in_org: Some(UserInOrg { user_assigned_role:"Guest".to_string(), user_permissions: vec!["CanReadProjectList".to_string()],// ... }),}
APIKeyValidation { Metadata: map[string]interface{}{"customKey":"customValue", },// This is only included if the API key is associated with a user User: &UserMetadata{ UserID:"31c41c16-c281-44ae-9602-8a047e3bf33d", Email:"test@example.com",// ... },// This is only included if the API key is associated with an organization Org: &APIKeyOrgMetadata{ OrgID:"1189c444-8a2d-4c41-8b4b-ae43ce79a492", OrgName:"Example Organization",// ... },// This is only included if the API key is associated// with BOTH a user and an organization UserInOrg: &OrgMemberInfoFromToken{ UserAssignedRole:"Guest", UserPermissions: []string{"CanReadProjectList"},// ... },}
{"metadata": {"customKey":"customValue" },// This is only included if the API key is associated with a user"user": {"user_id":"31c41c16-c281-44ae-9602-8a047e3bf33d","email":"test@example",// ... },// This is only included if the API key is associated with an organization"org": {"org_id":"1189c444-8a2d-4c41-8b4b-ae43ce79a492","org_name":"Example Organization",// ... },// This is only included if the API key is associated// with BOTH a user and an organization"user_in_org": {"userAssignedRole":"Guest","userPermissions": ["CanReadProjectList"],// ... }}
// Note: This is a convenience function implemented in the client libraries.// If you are using curl, you will need to check the response for validate_api_key // for the "user" field.
A convenience function that both validates an API key and makes sure it is assigned to an organization. It may be assigned to a user within that organization, but it must be associated with an organization.
{ metadata: {"customKey":"customValue" }, org: { orgId:"1189c444-8a2d-4c41-8b4b-ae43ce79a492", orgName:"Example Organization",// ... },// These two fields are only included if the API key is also associated with a user user: { userId:"31c41c16-c281-44ae-9602-8a047e3bf33d", email:"test@example.com",// ... }, userInOrg: { userAssignedRole:"Guest", userPermissions: ["CanReadProjectList"],// ... }}
{"metadata": {"customKey":"customValue" },"org": {"org_id":"1189c444-8a2d-4c41-8b4b-ae43ce79a492","org_name":"Example Organization",// ... },// These two fields are only included if the API key is also associated with a user"user": {"user_id":"31c41c16-c281-44ae-9602-8a047e3bf33d","email":"test@example",// ... },"user_in_org": {"userAssignedRole":"Guest","userPermissions": ["CanReadProjectList"],// ... }}
ValidateOrgApiKeyResponse { metadata: Some(serde_json::json!({"customKey":"customValue" }), org: OrgMetadata { org_id:"1189c444-8a2d-4c41-8b4b-ae43ce79a492".to_string(), org_name:"Example Organization".to_string(),// ... },// These two fields are only included if the API key is also associated with a user user: Some(UserMetadata { user_id:"31c41c16-c281-44ae-9602-8a047e3bf33d".to_string(), email:"test@example.com".to_string(),// ... }), user_in_org: Some(UserInOrg { user_assigned_role:"Guest".to_string(), user_permissions: vec!["CanReadProjectList".to_string()],// ... }),}
OrgAPIKeyValidation { Metadata: map[string]interface{}{"customKey":"customValue", }, Org: &APIKeyOrgMetadata{ OrgID:"1189c444-8a2d-4c41-8b4b-ae43ce79a492", OrgName:"Example Organization",// ... },// These two fields are only included if the API key is also associated with a user User: &UserMetadata{ UserID:"31c41c16-c281-44ae-9602-8a047e3bf33d", Email:"test@example.com",// ... }, UserInOrg: &OrgMemberInfoFromToken{ UserAssignedRole:"Guest", UserPermissions: []string{"CanReadProjectList"},// ... },}
// Note: This is a convenience function implemented in the client libraries.// If you are using curl, it will match the response for validate_api_key
Creates a new API key. This API key can be associated with a user, an organization, or no one.
If it's associated with a user, the user's information will be returned on validation. It will also invalidated if the user is blocked/deleted.
If it's associated with an organization, the organization's information will be returned on validation. It will also invalidated if the organization is deleted.
You can associate it with both a user and an organization, in which case both will be returned on validation, including the role and permissions of the user within the organization.
Finally, you can associate it with no one, in which case it will only be returned on validation if the API key is valid. In this case, the API key will not be invalidated if the user or organization is deleted.
For any API key, you can attach metadata, which will be returned on validation as well.
Required Permissions
Create End-user API Keys
Properties
Name
orgId
Type
string
Description
The ID of the organization to associate the API key with. If not provided, the API key will not be associated with an organization.
Name
userId
Type
string
Description
The ID of the user to associate the API key with. If not provided, the API key will not be associated with a user.
Name
expiresAtSeconds
Type
number
Description
A unix timestamp of when the API key should expire. If not provided, the API key will not expire.
Name
metadata
Type
{ [key: string]: any }
Description
Metadata to attach to the API key. This will be returned on validation.
{"api_key_id":"justAnId","created_at":1630425600,"expires_at_seconds":1640425600,"metadata": {"customKey":"customValue", },"user_id":"31c41c16-c281-44ae-9602-8a047e3bf33d","org_id":"1189c444-8a2d-4c41-8b4b-ae43ce79a492","display_name":"My API Key",}
Fetches the amount of times an API key was validated on a certain date. Either the API Key ID, user ID, or organization ID must be provided to filter the results.
Required Permissions
Read User Insights Data
Properties
Name
apiKeyId
Type
string
Description
The ID of the API ke.
Name
userId
Type
string
Description
The ID of the user
Name
orgId
Type
string
Description
The ID of the organization
Name
date *
Type
string
Description
The date to filter by. Must be in YYYY-MM-DD format
Imports an API key from a third-party system. This API key can be associated with a user, an organization, or no one.
If it's associated with a user, the user's information will be returned on validation. It will also invalidated if the user is blocked/deleted.
If it's associated with an organization, the organization's information will be returned on validation. It will also invalidated if the organization is deleted.
You can associate it with both a user and an organization, in which case both will be returned on validation, including the role and permissions of the user within the organization.
Finally, you can associate it with no one, in which case it will only be returned on validation if the API key is valid. In this case, the API key will not be invalidated if the user or organization is deleted.
For any API key, you can attach metadata, which will be returned on validation as well.
Required Permissions
Create End-user API Keys
Properties
Name
importedApiKey *
Type
string
Description
The API key string imported from a third-party system.
Name
orgId
Type
string
Description
The ID of the organization to associate the API key with. If not provided, the API key will not be associated with an organization.
Name
userId
Type
string
Description
The ID of the user to associate the API key with. If not provided, the API key will not be associated with a user.
Name
expiresAtSeconds
Type
number
Description
A unix timestamp of when the API key should expire. If not provided, the API key will not expire.
Name
metadata
Type
{ [key: string]: any }
Description
Metadata to attach to the API key. This will be returned on validation.
{ metadata: {"customKey":"customValue" },// This is only included if the API key is associated with a user user: { userId:"31c41c16-c281-44ae-9602-8a047e3bf33d", email:"test@example.com",// ... },// This is only included if the API key is associated with an organization org: { orgId:"1189c444-8a2d-4c41-8b4b-ae43ce79a492", orgName:"Example Organization",// ... },// This is only included if the API key is associated // with BOTH a user and an organization userInOrg: { userAssignedRole:"Guest", userPermissions: ["CanReadProjectList"],// ... }}
{"metadata": {"customKey":"customValue" },// This is only included if the API key is associated with a user"user": {"user_id":"31c41c16-c281-44ae-9602-8a047e3bf33d","email":"test@example",// ... },// This is only included if the API key is associated with an organization"org": {"org_id":"1189c444-8a2d-4c41-8b4b-ae43ce79a492","org_name":"Example Organization",// ... },// This is only included if the API key is associated// with BOTH a user and an organization"user_in_org": {"userAssignedRole":"Guest","userPermissions": ["CanReadProjectList"],// ... }}
ValidateApiKeyResponse { metadata: Some(serde_json::json!({"customKey":"customValue" }),// This is only included if the API key is associated with a user user: Some(UserMetadata { user_id:"31c41c16-c281-44ae-9602-8a047e3bf33d".to_string(), email:"test@example.com".to_string(),// ... }),// This is only included if the API key is associated with an organization org: Some(OrgMetadata { org_id:"1189c444-8a2d-4c41-8b4b-ae43ce79a492".to_string(), org_name:"Example Organization".to_string(),// ... }),// This is only included if the API key is associated// with BOTH a user and an organization user_in_org: Some(UserInOrg { user_assigned_role:"Guest".to_string(), user_permissions: vec!["CanReadProjectList".to_string()],// ... }),}
APIKeyValidation { Metadata: map[string]interface{}{"customKey":"customValue", },// This is only included if the API key is associated with a user User: &UserMetadata{ UserID:"31c41c16-c281-44ae-9602-8a047e3bf33d", Email:"test@example.com",// ... },// This is only included if the API key is associated with an organization Org: &APIKeyOrgMetadata{ OrgID:"1189c444-8a2d-4c41-8b4b-ae43ce79a492", OrgName:"Example Organization",// ... },// This is only included if the API key is associated// with BOTH a user and an organization UserInOrg: &OrgMemberInfoFromToken{ UserAssignedRole:"Guest", UserPermissions: []string{"CanReadProjectList"},// ... },}
{"metadata": {"customKey":"customValue" },// This is only included if the API key is associated with a user"user": {"user_id":"31c41c16-c281-44ae-9602-8a047e3bf33d","email":"test@example",// ... },// This is only included if the API key is associated with an organization"org": {"org_id":"1189c444-8a2d-4c41-8b4b-ae43ce79a492","org_name":"Example Organization",// ... },// This is only included if the API key is associated// with BOTH a user and an organization"user_in_org": {"userAssignedRole":"Guest","userPermissions": ["CanReadProjectList"],// ... }}