PAT Provisioning

View as Markdown

Request Pat

POST/api/v1/auth/pat/request

Agent initiates a PAT request. Sends approval email to workspace owner. No authentication required — this is the entry point for unauthenticated CLI sessions.

Errors

CodeWhenWhat to do
422Validation Error—
Request
curl -X POST "https://app.opvs.ai/api/v1/auth/pat/request" \
  -H "Authorization: Bearer $OPVS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

Request Pat By Email

POST/api/v1/auth/pat/request-by-email

Simplified PAT request flow. Agent only provides admin email. Backend discovers ALL brands the admin manages, creates one request covering all of them. On approval, one token per brand is created.

Errors

CodeWhenWhat to do
422Validation Error—
Request
curl -X POST "https://app.opvs.ai/api/v1/auth/pat/request-by-email" \
  -H "Authorization: Bearer $OPVS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

Poll Request Status

GET/api/v1/auth/pat/request/{request_id}/status

CLI polls this endpoint every 3 seconds to check if the request was approved. Auth: Authorization header with poll_token (Bearer poll_xxx). Handles both single-brand (legacy) and multi-brand (email-only) requests.

Errors

CodeWhenWhat to do
422Validation Error—
Request
curl "https://app.opvs.ai/api/v1/auth/pat/request/{request_id}/status" \
  -H "Authorization: Bearer $OPVS_TOKEN"

Approve Request

GET/api/v1/auth/pat/request/{request_id}/approve

Human clicks the approve link in the email. Creates agent user + PAT. Returns an HTML confirmation page.

Errors

CodeWhenWhat to do
422Validation Error—
Request
curl "https://app.opvs.ai/api/v1/auth/pat/request/{request_id}/approve" \
  -H "Authorization: Bearer $OPVS_TOKEN"

Deny Request

GET/api/v1/auth/pat/request/{request_id}/deny

Human clicks the deny link in the email.

Errors

CodeWhenWhat to do
422Validation Error—
Request
curl "https://app.opvs.ai/api/v1/auth/pat/request/{request_id}/deny" \
  -H "Authorization: Bearer $OPVS_TOKEN"

List Agent Tokens

GET/api/v1/auth/pat/agents

List all PAT requests for this brand. Requires brand admin role.

Request
curl "https://app.opvs.ai/api/v1/auth/pat/agents" \
  -H "Authorization: Bearer $OPVS_TOKEN"

Request Brand Pair

POST/api/v1/auth/pat/brand-pair/request

Errors

CodeWhenWhat to do
422Validation Error—
Request
curl -X POST "https://app.opvs.ai/api/v1/auth/pat/brand-pair/request" \
  -H "Authorization: Bearer $OPVS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'

Approve Brand Pair

GET/api/v1/auth/pat/brand-pair/{pairing_id}/approve

Errors

CodeWhenWhat to do
422Validation Error—
Request
curl "https://app.opvs.ai/api/v1/auth/pat/brand-pair/{pairing_id}/approve" \
  -H "Authorization: Bearer $OPVS_TOKEN"

Deny Brand Pair

GET/api/v1/auth/pat/brand-pair/{pairing_id}/deny

Errors

CodeWhenWhat to do
422Validation Error—
Request
curl "https://app.opvs.ai/api/v1/auth/pat/brand-pair/{pairing_id}/deny" \
  -H "Authorization: Bearer $OPVS_TOKEN"

Poll Brand Pair Status

GET/api/v1/auth/pat/brand-pair/{pairing_id}/status

Errors

CodeWhenWhat to do
422Validation Error—
Request
curl "https://app.opvs.ai/api/v1/auth/pat/brand-pair/{pairing_id}/status" \
  -H "Authorization: Bearer $OPVS_TOKEN"

List Brand Pairs

GET/api/v1/auth/pat/brand-pair
Request
curl "https://app.opvs.ai/api/v1/auth/pat/brand-pair" \
  -H "Authorization: Bearer $OPVS_TOKEN"

Revoke Brand Pair

POST/api/v1/auth/pat/brand-pair/{pairing_id}/revoke

Errors

CodeWhenWhat to do
422Validation Error—
Request
curl -X POST "https://app.opvs.ai/api/v1/auth/pat/brand-pair/{pairing_id}/revoke" \
  -H "Authorization: Bearer $OPVS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'
Did this answer your question?