Authorizations
Most Braintrust endpoints are authenticated by providing your API key as a header Authorization: Bearer [api_key] to your HTTP request. You can create an API key in the Braintrust organization settings page.
curl --request POST \
  --url https://api.braintrust.dev/v1/acl/batch_update \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "add_acls": [
    {
      "object_type": "organization",
      "object_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "group_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "permission": "create",
      "restrict_object_type": "organization",
      "role_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
    }
  ],
  "remove_acls": [
    {
      "object_type": "organization",
      "object_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "group_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "permission": "create",
      "restrict_object_type": "organization",
      "role_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
    }
  ]
}'{
  "added_acls": [
    {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "object_type": "organization",
      "object_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "group_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "permission": "create",
      "restrict_object_type": "organization",
      "role_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "_object_org_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "created": "2023-11-07T05:31:56Z"
    }
  ],
  "removed_acls": [
    {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "object_type": "organization",
      "object_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "group_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "permission": "create",
      "restrict_object_type": "organization",
      "role_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "_object_org_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "created": "2023-11-07T05:31:56Z"
    }
  ]
}Batch update acls. This operation is idempotent, so adding acls which already exist will have no effect, and removing acls which do not exist will have no effect.
curl --request POST \
  --url https://api.braintrust.dev/v1/acl/batch_update \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "add_acls": [
    {
      "object_type": "organization",
      "object_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "group_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "permission": "create",
      "restrict_object_type": "organization",
      "role_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
    }
  ],
  "remove_acls": [
    {
      "object_type": "organization",
      "object_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "group_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "permission": "create",
      "restrict_object_type": "organization",
      "role_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
    }
  ]
}'{
  "added_acls": [
    {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "object_type": "organization",
      "object_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "group_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "permission": "create",
      "restrict_object_type": "organization",
      "role_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "_object_org_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "created": "2023-11-07T05:31:56Z"
    }
  ],
  "removed_acls": [
    {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "object_type": "organization",
      "object_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "group_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "permission": "create",
      "restrict_object_type": "organization",
      "role_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "_object_org_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "created": "2023-11-07T05:31:56Z"
    }
  ]
}Most Braintrust endpoints are authenticated by providing your API key as a header Authorization: Bearer [api_key] to your HTTP request. You can create an API key in the Braintrust organization settings page.
Acls to add/remove.
Was this page helpful?