Create a role assignment

POST /Organizations/{OrganizationSid}/RoleAssignments

Create a role assignment for the given organization

Path parameters

  • OrganizationSid string(OrganizationSid) Required

    Format should match the following pattern: OR[0-9a-f]{32}.

application/json

Body Required

  • role_sid string(IamRoleSid) Required

    Twilio Role Sid representing assigned role

    Format should match the following pattern: IX[0-9a-f]{32}.

  • scope string(Sid) Required

    Twilio Sid representing scope of this assignment

    Format should match the following pattern: ^[A-Z]{2}[0-9a-fA-F]{32}$.

  • identity string(Sid) Required

    Twilio Sid representing identity of this assignment

    Format should match the following pattern: ^[A-Z]{2}[0-9a-fA-F]{32}$.

Responses

  • 201 application/json

    Created

    Hide headers attributes Show headers attributes
    • Access-Control-Allow-Origin string

      Specify the origin(s) allowed to access the resource

    • Access-Control-Allow-Methods string

      Specify the HTTP methods allowed when accessing the resource

    • Access-Control-Allow-Headers string

      Specify the headers allowed when accessing the resource

    • Access-Control-Allow-Credentials boolean

      Indicates whether the browser should include credentials

    • Access-Control-Expose-Headers string

      Headers exposed to the client

    Hide response attributes Show response attributes object
    • sid string(IamRoleAssignmentSid)

      Twilio Role Assignment Sid representing this role assignment

      Format should match the following pattern: IY[0-9a-f]{32}.

    • role_sid string(IamRoleSid)

      Twilio Role Sid representing assigned role

      Format should match the following pattern: IX[0-9a-f]{32}.

    • scope string(Sid)

      Twilio Sid representing identity of this assignment

      Format should match the following pattern: ^[A-Z]{2}[0-9a-fA-F]{32}$.

    • identity string(Sid)

      Twilio Sid representing scope of this assignment

      Format should match the following pattern: ^[A-Z]{2}[0-9a-fA-F]{32}$.

  • 400 application/scim+json

    Bad request or business rules violation

    Hide headers attributes Show headers attributes
    • Access-Control-Allow-Origin string

      Specify the origin(s) allowed to access the resource

    • Access-Control-Allow-Methods string

      Specify the HTTP methods allowed when accessing the resource

    • Access-Control-Allow-Headers string

      Specify the headers allowed when accessing the resource

    • Access-Control-Allow-Credentials boolean

      Indicates whether the browser should include credentials

    • Access-Control-Expose-Headers string

      Headers exposed to the client

    Hide response attributes Show response attributes object
    • code integer(int32)

      Twilio-specific error code

    • message string

      Error message

    • moreInfo string

      Link to Error Code References

    • status integer(int32)

      HTTP response status code

  • 403 application/scim+json

    Unauthorized

    Hide headers attributes Show headers attributes
    • Access-Control-Allow-Origin string

      Specify the origin(s) allowed to access the resource

    • Access-Control-Allow-Methods string

      Specify the HTTP methods allowed when accessing the resource

    • Access-Control-Allow-Headers string

      Specify the headers allowed when accessing the resource

    • Access-Control-Allow-Credentials boolean

      Indicates whether the browser should include credentials

    • Access-Control-Expose-Headers string

      Headers exposed to the client

    Hide response attributes Show response attributes object
    • code integer(int32)

      Twilio-specific error code

    • message string

      Error message

    • moreInfo string

      Link to Error Code References

    • status integer(int32)

      HTTP response status code

POST /Organizations/{OrganizationSid}/RoleAssignments
curl \
 --request POST 'https://preview-iam.twilio.com/Organizations/ORa36de9717566c7eb6363671f54b87ba9/RoleAssignments' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{"role_sid":"IXc4ddb9d0befdb122b0eff334e3084544","scope":"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","identity":"USc4ddb9d0befdb122b0eff334e3084544"}'
Request examples
{
  "role_sid": "IXc4ddb9d0befdb122b0eff334e3084544",
  "scope": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "identity": "USc4ddb9d0befdb122b0eff334e3084544"
}
Response examples (201)
# Headers
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, OPTIONS
Access-Control-Allow-Headers: Content-Type, Authorization
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: X-Custom-Header1, X-Custom-Header2

# Payload
{
  "sid": "IYc4ddb9d0befdb122b0eff334e3084544",
  "role_sid": "IXc4ddb9d0befdb122b0eff334e3084544",
  "scope": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "identity": "USc4ddb9d0befdb122b0eff334e3084544"
}
Response examples (400)
# Headers
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, OPTIONS
Access-Control-Allow-Headers: Content-Type, Authorization
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: X-Custom-Header1, X-Custom-Header2

# Payload
{
  "code": 42,
  "message": "string",
  "moreInfo": "string",
  "status": 42
}
Response examples (403)
# Headers
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, OPTIONS
Access-Control-Allow-Headers: Content-Type, Authorization
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: X-Custom-Header1, X-Custom-Header2

# Payload
{
  "code": 42,
  "message": "string",
  "moreInfo": "string",
  "status": 42
}