---
title: "Create new role for this data source"
method: POST
path: "/sources/{id}/roles"
tags: ["sources", "users", "roles"]
---

# Create new role for this data source

`POST /sources/{id}/roles`

## Path parameters

- `id` string, required

## Request body

- InfluxDBRole
  - `name` string, required — Unique name of the role
  - `users` InfluxDBUsers
    - `users` InfluxDBUser[]
      - `name` string — Unique name of the user
      - `password` string
      - `permissions` InfluxDBPermission[] — Permissions represent the entire set of permissions a InfluxDB User or InfluxDB Role may have
        - `scope` 'all' | 'database', required — Describes if the permission is for all databases or restricted to one database
        - `name` string — If the scope is database this identifies the name of the database
        - `allowed` string[], required — Allowances defines what actions a user can have on a scoped permission
      - `roles` InfluxDBRole[]
      - `links` object — URL relations of this user
        - `self` string, url — URI of resource.
  - `permissions` InfluxDBPermission[] — Permissions represent the entire set of permissions a InfluxDB User or InfluxDB Role may have
    - `scope` 'all' | 'database', required — Describes if the permission is for all databases or restricted to one database
    - `name` string — If the scope is database this identifies the name of the database
    - `allowed` string[], required — Allowances defines what actions a user can have on a scoped permission
  - `links` object — URL relations of this role
    - `self` string, url — URI of resource.

## Response `201`

Role successfully created

- InfluxDBRole
  - `name` string, required — Unique name of the role
  - `users` InfluxDBUsers
    - `users` InfluxDBUser[]
      - `name` string — Unique name of the user
      - `password` string
      - `permissions` InfluxDBPermission[] — Permissions represent the entire set of permissions a InfluxDB User or InfluxDB Role may have
        - `scope` 'all' | 'database', required — Describes if the permission is for all databases or restricted to one database
        - `name` string — If the scope is database this identifies the name of the database
        - `allowed` string[], required — Allowances defines what actions a user can have on a scoped permission
      - `roles` InfluxDBRole[]
      - `links` object — URL relations of this user
        - `self` string, url — URI of resource.
  - `permissions` InfluxDBPermission[] — Permissions represent the entire set of permissions a InfluxDB User or InfluxDB Role may have
    - `scope` 'all' | 'database', required — Describes if the permission is for all databases or restricted to one database
    - `name` string — If the scope is database this identifies the name of the database
    - `allowed` string[], required — Allowances defines what actions a user can have on a scoped permission
  - `links` object — URL relations of this role
    - `self` string, url — URI of resource.

## Other responses

- `404` — Data source id does not exist.
- `default` — A processing or an unexpected error.

---

[API](https://skmtc.net/influxdata/apis/chronograf.md) · [All operations](https://skmtc.net/influxdata/apis/chronograf/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/influxdata/chronograf/versions/ce55d963b4ac/schema)
