Skip to main content
POST
/
v1
/
regions
/
global
/
iam
/
policies
Create policy binding
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    roleId: '<string>',
    principalType: 'user',
    principalId: '<string>',
    scope: {type: 'organization', id: '<string>'}
  })
};

fetch('https://api.example.com/v1/regions/global/iam/policies', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "success": true,
  "data": {
    "id": "<string>",
    "roleId": "<string>",
    "principalType": "user",
    "principalId": "<string>",
    "scope": {
      "type": "organization",
      "id": "<string>"
    },
    "createdAt": "2023-11-07T05:31:56Z"
  }
}

Body

application/json
roleId
string
required
principalType
enum<string>
required
Available options:
user,
group,
serviceAccount
principalId
string
required
scope
object
required

Response

201 - application/json

Policy binding created

success
enum<boolean>
Available options:
true
data
object

IAM policy binding (role to principal at scope)