useGrant
Tenant provider policies

Create policy

Create a new policy for a tenant provider.

POST
/v1/tenants/{tenantId}/providers/{providerId}/policies

Authorization

AuthorizationRequiredBearer <token>

In: header

Request Body

application/jsonRequired
nameRequiredstring

Name of the policy.

descriptionRequiredstring

Description of the policy.

audienceRequiredstring

Audience of the policy.

conditionsRequiredarray<object>

Conditions of the policy.

Path Parameters

tenantIdRequiredstring

Unique identifier for a tenant.

Format: "uuid"
tenantProviderIdRequiredstring

Unique identifier for a tenant provider.

Format: "uuid"
curl -X POST "https://sdk.usegrant.dev/v1/tenants/497f6eca-6276-4993-bfeb-53cbbbba6f08/providers/{providerId}/policies" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Policy Name",
    "description": "Policy Description",
    "audience": "sts.amazonaws.com",
    "conditions": [
      {
        "key": "sub",
        "operator": "stringEquals",
        "value": "repo:usegrant/usegrant-api/*"
      }
    ]
  }'

Policy created successfully.

{
  "id": "9b2e4d7a-8c3f-4b2a-9a1e-2d3c4e5f6a7b",
  "name": "Policy Name",
  "description": "Policy Description",
  "audience": "sts.amazonaws.com",
  "conditions": [
    {
      "key": "sub",
      "operator": "stringEquals",
      "value": "1234567890"
    }
  ]
}