Launch Week 02 wrapped — explore all five launches

Create Policy

POSThttps://api.confident-ai.com/v2/organization/policies

Creates a custom organization policy from a set of permissions and returns it. A policy on its own grants nobody anything: it takes effect only once it is attached to an organization role, and then applies to every member holding that role. Send the permission ids from GET /v2/organization/permissions, whose names are resource:action pairs such as billing:read.

POST/v2/organization/policies
curl -X POST "https://api.confident-ai.com/v2/organization/policies" \
  -H "CONFIDENT_API_KEY: <ORGANIZATION-API-KEY>" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Billing read-only",
  "description": "Lets a role read invoices and model costs, but change neither.",
  "permissionIds": [
    "<PERMISSION-ID>"
  ]
}'
200
{
  "success": true,
  "data": {
    "id": "<POLICY-ID>",
    "name": "Billing read-only",
    "description": "Lets a role read invoices and model costs, but change neither.",
    "permissions": [
      {
        "id": "<PERMISSION-ID>",
        "name": "billing:read"
      }
    ]
  },
  "deprecated": false
}

Headers

  • CONFIDENT_API_KEYstringRequired

    The organization API key for your Confident AI organization.

Request body

  • namestringRequired

    The name of the policy, unique within the organization or project that owns it. It is what identifies the policy when attaching it to a role.

  • descriptionstring | null

    What the policy is for. On an update, omit it to leave the stored description unchanged, or send null to clear it.

  • permissionIdslist of stringsRequired

    The ids of the permissions this policy grants. This is the policy's complete permission set: on an update the list replaces what is stored rather than adding to it, and an empty array leaves the policy granting nothing. Discover assignable ids with the permissions endpoint of the same scope; an id from the other scope's catalog is stored but never matches a permission check here.

Response

Create Policy succeeded.

  • successboolean

    Indicates if the request was successful.

  • dataobject

    A named set of permissions owned by an organization or by a project. A policy is attached to roles of the same scope, never to a member directly, so it only grants anything once a role that holds it is assigned to someone.

    Show 4 propertiesHide 4 properties
    • idstring

      The id of the policy, generated by Confident AI.

    • namestring

      The name of the policy.

    • descriptionstring | null

      What the policy is for, or null when it has no description.

    • permissionslist of objects

      The permissions this policy grants.

      Show 2 propertiesHide 2 properties
      • idstring

        The id of the permission, generated by Confident AI.

      • namestring

        The permission, written as resource:action — the resource it applies to, then what it allows on it.

  • deprecatedboolean

    Indicates if this endpoint is deprecated.

Built byConfident AI