Permissions
Manage user or token permissions. For this endpoint, you should send an array of objects (in JSON format) as the body of the request. If you send a combination of resource_type and resource_id that already exists, the permission is updated. If the combination doesn't exist, the permission is created. Permissions of an expired API token cannot be updated; such requests are rejected with a 422 error.
Pass the API token in the Api-Token
Unique account access ID
5142Returns message about successful update of permissions.
Returns unauthorized error message. Check your credentials.
Returns forbidden error message. Check your permissions.
Returns not found error message
Validation error or other business rule violation
curl -X PUT https://mailtrap.io/api/account_accesses/{account_access_id}/permissions/bulk \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"permissions": [
{"resource_id": "3281", "resource_type": "account", "access_level": "viewer"}
]
}'
{
"message": "Permissions have been updated!"
}Get all resources in your account (Sandboxes, Projects, Domains, Email Campaigns, Billing and Account itself) to which the token has admin access.
Pass the API token in the Api-Token
Returns the resources nested according to their hierarchy.
- access_level in this response represents the access level of the token used to make the request.
Nested resource tree for permission management. type values include account, project, sandbox,
domain, email_template_permission_scope, email_campaign_permission_scope, and others.
Returns unauthorized error message. Check your credentials.
Returns forbidden error message. Check your permissions.
curl -X GET https://mailtrap.io/api/permissions/resources \
-H 'Authorization: Bearer YOUR_API_KEY'
[
{
"id": 1774100,
"name": "Account",
"type": "account",
"access_level": 100,
"resources": [
{
"id": 1774100,
"name": "Templates",
"type": "email_template_permission_scope",
"access_level": 100,
"resources": []
},
{
"id": 2550469,
"name": "My Project",
"type": "project",
"access_level": 100,
"resources": [
{
"id": 4117907,
"name": "My Sandbox",
"type": "sandbox",
"access_level": 100,
"resources": []
}
]
}
]
}
]Last updated
Was this helpful?

