Skip to content

Create a role

POST
/v1/admin/merchants/{merchant_id}/roles/

Creates a role. Its permissions are limited to the base permissions of the merchant. Without permissions, the role gets the merchant's base permissions. Roles can't hold payment method permissions.

Authorization

apiKey
headerAuthorizationBasic <token>

HTTP Basic authentication with an admin API key as the username and an empty password.

Path Parameters

merchant_id*string

The ID of the merchant.

Formatuuid

Request Body

application/json
  1. body
name*string
description?string
permissions?

Permissions by path, such as /orders/**, with per HTTP method (GET, POST, PUT, DELETE or * for all) true or false. Payment methods are permissions on /payment-methods/<method>/ with POST. See Permissions.

field_permissions?

Field-level read and write restrictions per resource: { resource: { field: { read, write } } }.

max_allowed_correction_amount?integer

The highest correction amount users with this role may create.

Response Body

The role is created.

application/json
  1. response
id?string
Formatuuid
created?string
Formatdate-time
modified?|
Formatdate-time
name*string
description?string
permissions?

Permissions by path, such as /orders/**, with per HTTP method (GET, POST, PUT, DELETE or * for all) true or false. Payment methods are permissions on /payment-methods/<method>/ with POST. See Permissions.

field_permissions?

Field-level read and write restrictions per resource: { resource: { field: { read, write } } }.

max_allowed_correction_amount?integer

The highest correction amount users with this role may create.

curl -X POST 'https://api.example.com/v1/admin/merchants/497f6eca-6276-4993-bfeb-53cbbbba6f08/roles/' \  --user "$API_KEY:" \  -H 'Content-Type: application/json' \  -d '{  "name": "Merchant administrator",  "permissions": {    "/merchants/self/": {      "GET": true    },    "/merchants/self/*/**": {      "*": true    },    "/merchants/self/projects/**": {      "GET": true    },    "/reports/*/merchants/self/**": {      "GET": true    },    "/search/*/": {      "POST": true    },    "/orders/**": {      "*": true    }  }}'
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "created": "2019-08-24T14:15:22Z",  "modified": "2019-08-24T14:15:22Z",  "name": "Merchant administrator",  "description": "string",  "permissions": {    "property1": {      "GET": true,      "POST": true,      "PUT": true,      "DELETE": true,      "*": true    },    "property2": {      "GET": true,      "POST": true,      "PUT": true,      "DELETE": true,      "*": true    }  },  "field_permissions": {    "property1": {      "property1": {        "read": true,        "write": true      },      "property2": {        "read": true,        "write": true      }    },    "property2": {      "property1": {        "read": true,        "write": true      },      "property2": {        "read": true,        "write": true      }    }  },  "max_allowed_correction_amount": 0}