Create Role

posthttps://app.fossa.com/api/roles

Create a new custom role

Request body (required) · application/json

scopeenumrequired

Scope of the role

organizationteam
namestringrequired

Name of the role

descriptionstringrequired

Description of the role

permissionsobject[]

List of permissions for this role. Each entry must be a permission that exists in the system (see `GET /api/roles/all-permissions`) and is valid for the role's `scope`; otherwise the request is rejected with a `400`.

resourceTypestringrequired

Resource type for the permission. Must be a valid `resourceType` returned by `GET /api/roles/all-permissions`, and the `resourceType`/`action` combination must be valid for the role's `scope`.

actionstringrequired

Action for the permission. Must be a valid `action` returned by `GET /api/roles/all-permissions`, and the `resourceType`/`action` combination must be valid for the role's `scope`.

Responses

200Role created successfully
idinteger

The role's unique identifier

organizationIdinteger

The organization's unique identifier

isCustomboolean

Whether the role is custom

scopeenum

The role's scope

organizationteam
namestring

The role's name

descriptionstring

The role's description

createdAtstring <date-time>

The role's creation date

updatedAtstring <date-time>

The role's last update date

permissionsobject[]
resourceTypestring

The resource type

actionstring

The action

400Bad Request
uuidstring

Unique identifier associated with the error

codeinteger

fossa specific error code

messagestring

message associated with this error

namestring

name of the error

httpStatusCodeinteger

http status code number

403Forbidden
uuidstring

Unique identifier associated with the error

codeinteger

fossa specific error code

messagestring

message associated with this error

namestring

name of the error

httpStatusCodeinteger

http status code number

409Conflict
uuidstring

Unique identifier associated with the error

codeinteger

fossa specific error code

messagestring

message associated with this error

namestring

name of the error

httpStatusCodeinteger

http status code number

500Server Error
uuidstring

Unique identifier associated with the error

codeinteger

fossa specific error code

messagestring

message associated with this error

namestring

name of the error

httpStatusCodeinteger

http status code number

Try this endpoint

Build a request and run it against app.fossa.com.

Bearer

Stored in this browser for 24 hours. Try It uses a docs proxy for CORS and does not store tokens server-side.

POST https://app.fossa.com/api/roles
curl --request POST \  --url 'https://app.fossa.com/api/roles' \  --header 'accept: application/json' \  --header 'authorization: Bearer YOUR_API_TOKEN' \  --header 'content-type: application/json' \  --data '{  "scope": "organization",  "name": "Custom Admin Role",  "description": "Custom admin role with specific permissions",  "permissions": [    {      "resourceType": "project_any",      "action": "view"    },    {      "resourceType": "project_any",      "action": "edit"    }  ]}'

Real request. Mutating methods can change data.

Click Try It to run a request and see the response here.
Enter a Bearer token before running this request.
application/json