Docs
Live demo

Grant access from an integration

Grant access in one API call and report only after apply succeeds.

Before you start: an API token with rule change/apply rights, a target and template.

  1. Call POST /grants with Idempotency-Key:
    bash
    curl -X POST https://principal.example.com/api/v2/grants \
      -H "Authorization: Bearer $PRINCIPAL_TOKEN" \
      -H "Content-Type: application/json" -H "Idempotency-Key: $REQUEST_ID" \
      -d '{"subject_id":"<id>","target_id":"<id>",
           "template_name":"warehouse-read-only","mode":"apply_async"}'
    Or pass connector_id, provider, external_id, subject_kind. Add ttl (PT1H) for expiry.
  2. Poll job_id: GET /admin/jobs/{id}.
  3. Notify requester on success or forward failure.

plan_only plans only. apply_sync (201) and apply_async (202) return before apply runs.

↑ ↓ to moveEnter to openEsc to close