---
title: "Write a role."
method: POST
path: "/access/roles"
tags: ["Access Management: Role Operations"]
---

# Write a role.

`POST /access/roles`

## Request

- Base URL: `https://replace-with-account.api.decodable.co/v1alpha2`
- URL: `https://replace-with-account.api.decodable.co/v1alpha2/access/roles`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/decodable/apis/decodable-control-plane/docs/access/roles/post.ts> (a function with typed inputs; its response is checked against the schema)

Create new if no id; modify existing with a given id.

Requires permission matching: `role:write:<name>`.

## Request body

- object: Common role fields in requests and responses.
  - `id` string: An opaque ID, created by Decodable, that uniquely identifies a resource.
  - `name` string, required: The role name.
  - `description` string: The role description.

## Response `200`

A role post response.

- Role: Common role fields in requests and responses.
  - `id` string: An opaque ID, created by Decodable, that uniquely identifies a resource.
  - `name` string, required: The role name.
  - `description` string: The role description.
  - `create_time` string, date-time: The date and time the resource was created.
  - `update_time` string, date-time: The date and time the resource was updated.

## Other responses

- `400`: An invalid request was received.
- `403`: Access denied: requesting user lacks a required permission.
- `404`: The requested resource does not exist.
- `409`: A conflicting resource already exists.
- `default`: An error has occurred.

---

[API](https://skmtc.dev/decodable/apis/decodable-control-plane.md) - [All operations](https://skmtc.dev/decodable/apis/decodable-control-plane/llms.txt) - [OpenAPI document](https://skmtc.dev/decodable/apis/decodable-control-plane/revisions/9718a3019da8?raw)
