---
title: "REST API: Add Space Role"
type: "wiki"
space: "Axero Documentation"
author: "Anonymous User"
created: 2011-03-29T08:13:45Z
updated: 2026-09-28T01:06:57Z
tags: ["API"]
url: "https://my.axerosolutions.com/spaces/5/axero-documentation/wiki/view/529/rest-api-add-space-role"
---

# REST API: Add Space Role

[Open API Guide](https://my.axerosolutions.com/spaces/5/axero-documentation/api-guide?id=529)
POST/api/spaces/\{SpaceID\}/roles

Add a role to a space. ResponseMessage is the string True and ResponseData is the new RoleID when the role was created. When the space already has a role with that name, ResponseMessage is False and ResponseData is 0.

## Request

### Request Header
| Header | Required | Value | Description |
| :--- | :--- | :--- | :--- |
| `Authorization` | YES | `Bearer YOUR_TOKEN` | Bearer token for the authenticated user. [Learn how to create Bearer tokens](https://my.axerosolutions.com/spaces/5/axero-documentation/wiki/view/108973/creating-bearer-tokens). |
| `Content-Type` | YES | `application/json` | Must be set to `application/json` |
### Required Parameters
| Parameter | Type | Required | Location | Description |
| :--- | :--- | :--- | :--- | :--- |
| `Role JSON` | String | YES | Body | The role to create, as a JSON object like the example below. RoleName and Description are both required. |
| `Description` | String | YES | Body | Human-readable description explaining what permissions or access this role grants. A JSON list instead of text answers HTTP 500 with an empty body. |
| `RoleName` | String | YES | Body | Display name for the role. It must be unused in the space, and the check ignores case: a name already in use answers 200 with ResponseMessage False and ResponseData 0. A JSON list instead of text answers HTTP 500 with an empty body. |
| `SpaceID` | Integer | YES | Path | Unique identifier for a particular space |
## Example

### Request Header

```
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
```

### Request URL

`https://your-site.com/api/spaces/123/roles`

### Request Body

```
{
    "Description":"A person who's job is to tests something, especially a new product.",
    "RoleName": "Tester"
}
```

### Success Response

```
{
  "IsError": false,
  "ResponseMessage": "True",
  "ResponseData": 2017
}
```

### Error Response

```
HTTP 500 with an empty body
```

## Error Handling

| Status Code | Likely Cause | Next Action |
| :--- | :--- | :--- |
| 500 Server Error | A required parameter is missing or is a JSON list instead of text. The endpoint fails with an empty body instead of reporting the problem. | Verify the request against the required parameters before treating the 500 as a server fault. |
| 401 Unauthorized | Missing or invalid Bearer token. | Check token validity. [Learn how to create Bearer tokens →](https://my.axerosolutions.com/spaces/5/axero-documentation/wiki/view/108973/creating-bearer-tokens) |
| 403 Forbidden | The caller is not a site administrator and does not have the Manage Role permission in the space. | Confirm the user has the required roles for this action. |
| 200 with ResponseMessage False | The space already has a role with this name \(the match ignores case\). ResponseData is 0 and no role is created. | Choose another name. |

## Rate Limits

While Axero does not enforce hard rate limits by default, we recommend the following best practices to ensure optimal performance:

- **Sustained Request Rate:** Do not exceed 5 API calls per second
- **Sequential Processing:** Wait for each request to complete before sending the next in automated workflows
- **Concurrent Connections:** If parallel processing is required, limit to 3 or fewer simultaneous requests
- **Response Timeout:** Ensure API responses complete within 15 seconds during testing

Axero may implement temporary rate restrictions if excessive API usage affects overall site performance. For high-volume integrations, contact Axero to discuss your requirements.
