Skip to Content
P4A Documentation
APIs

REST API reference

The non-admin P4A REST API surface — endpoints, scopes, request and response shapes, reachable with a personal access token.

Overview

This is the interactive reference for the P4A REST API — every endpoint an external client or script can call with a personal access token. Each operation below lists its method, path, required scope, request body, and response shape, with an interactive playground for trying calls.

The same endpoints power the dashboard and the hosted MCP server, so the MCP catalog tools are thin wrappers over the policy endpoints documented here.

Policy Ideas are not part of the token-scoped REST surface — read and act on them through the MCP idea tools (list_ideas, get_idea, submit_idea, vote_idea) instead. Idea delivery still shows up here from the policy side: GET /api/policies/{id} returns delivers_ideas (the ideas a policy delivers, with coverage), and POST /api/submissions accepts deliversIdeaIds to declare delivery when submitting.

Authentication

Send your token as a Bearer credential on every request:

curl https://www.p4a.dev/api/policies \
  -H "Authorization: Bearer p4a_xxxxxxxxxxxxxxxxxxxxxxxx"

A token acts as you: requests are attributed to your account and scoped to what you can already access. See Personal access tokens to create and manage tokens.

Scopes

Each endpoint requires one scope, chosen by HTTP method:

  • api:read — GET requests.
  • api:write — POST, PATCH, PUT, DELETE requests.

A request whose token lacks the required scope is rejected with 403; a missing, invalid, expired, or revoked token is rejected with 401.

Download the spec

The full OpenAPI 3.1 spec is available for import into Postman, Insomnia, or a code generator:

Policies

GET/api/policies

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Query Parameters

category?string

Filter by policy category.

q?string

Free-text search over name and description (name and summary for source=mulesoft).

source?string

Which catalog to list. community (default) = user-submitted P4A policies. mulesoft = MuleSoft out-of-the-box Omni/Flex Gateway policies (read-only, MuleSoftPolicySummary items).

Default"community"
Value in"community""mulesoft"
direction?string

Filter by enforcement leg — inbound (incoming request, most policies) or outbound (upstream/response leg). Applies to both community and mulesoft sources.

Value in"inbound""outbound"
assetKind?string

source=community only. Filter by asset type — policies that target the specified kind (agent, api, llm, or mcp). Ignored for the MuleSoft catalog.

Value in"agent""api""llm""mcp"
sort?string

Sort key. alpha (default) orders by policy name; submitted orders by date: the submission date for community policies, and for source=mulesoft the effective publish date (published_at: the first Exchange publish, else the first sync). Unrecognized values fall back to alpha.

Default"alpha"
Value in"alpha""submitted"
order?string

Sort direction. Defaults to asc for sort=alpha and desc for sort=submitted. Unrecognized values fall back to the per-key default.

Value in"asc""desc"

Response Body

The matching policies.

application/json
  1. response
policies?array<|>

Policy items for the community catalog; MuleSoftPolicySummary items when source=mulesoft.

Example Request
curl -X GET 'https://www.p4a.ai/api/policies'
Example Response200
{  "policies": [    {      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "slug": "string",      "name": "string",      "description": "string",      "category": "string",      "status": "string",      "liked": true,      "github_has_issues": true,      "delivers_ideas": [        {          "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",          "title": "string",          "phase": "declared",          "coverage": "full",          "scope_note": "string",          "completes_idea": true        }      ],      "contributors": [        {          "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",          "username": "string",          "name": "string"        }      ],      "owner_avatar_url": "string",      "owner_avatar_email_hash": "string",      "docs_summary": {        "tabCount": 0,        "completeness": {          "filled": 0,          "total": 0,          "ratio": 0        }      },      "asset_kinds": [        "agent"      ],      "a2a_protocol_versions": [        "v0.3.0"      ],      "direction": "inbound",      "source_ref": "string",      "implementation_source_ref": "string",      "approved_commit_sha": "string",      "approved_implementation_commit_sha": "string",      "approved_commit_at": "2019-08-24T14:15:22Z"    }  ]}
GET/api/policies/{id}

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

The policy.

application/json
  1. response
policy?
Example Request
curl -X GET 'https://www.p4a.ai/api/policies/497f6eca-6276-4993-bfeb-53cbbbba6f08'
Example Response
{  "policy": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "slug": "string",    "name": "string",    "description": "string",    "category": "string",    "status": "string",    "liked": true,    "github_has_issues": true,    "delivers_ideas": [      {        "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",        "title": "string",        "phase": "declared",        "coverage": "full",        "scope_note": "string",        "completes_idea": true      }    ],    "contributors": [      {        "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",        "username": "string",        "name": "string"      }    ],    "owner_avatar_url": "string",    "owner_avatar_email_hash": "string",    "docs_summary": {      "tabCount": 0,      "completeness": {        "filled": 0,        "total": 0,        "ratio": 0      }    },    "asset_kinds": [      "agent"    ],    "a2a_protocol_versions": [      "v0.3.0"    ],    "direction": "inbound",    "source_ref": "string",    "implementation_source_ref": "string",    "approved_commit_sha": "string",    "approved_implementation_commit_sha": "string",    "approved_commit_at": "2019-08-24T14:15:22Z"  }}
PATCH/api/policies/{id}

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Request Body

application/json
  1. body
name?string
description?string
category?string
videoTutorialUrl?string
examplesUrl?string
githubUrl?string

GitHub, GitLab, or Bitbucket repo URL of the policy definition.

Formaturi
implementationGithubUrl?string

Split-model only: GitHub, GitLab, or Bitbucket repo URL of the implementation root.

sourceRef?string

Default git branch/tag/commit used when this policy is deployed (#1033). Send an empty string to clear it back to the repository's default branch. Admin-only.

implementationSourceRef?string

Split-model only: default git ref for the implementation root (#1033). Empty string clears it. Admin-only.

iconUrl?string
iconDisabled?boolean

Response Body

The updated policy.

application/json
  1. response
policy?
Example Request
curl -X PATCH 'https://www.p4a.ai/api/policies/497f6eca-6276-4993-bfeb-53cbbbba6f08' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "policy": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "slug": "string",    "name": "string",    "description": "string",    "category": "string",    "status": "string",    "liked": true,    "github_has_issues": true,    "delivers_ideas": [      {        "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",        "title": "string",        "phase": "declared",        "coverage": "full",        "scope_note": "string",        "completes_idea": true      }    ],    "contributors": [      {        "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",        "username": "string",        "name": "string"      }    ],    "owner_avatar_url": "string",    "owner_avatar_email_hash": "string",    "docs_summary": {      "tabCount": 0,      "completeness": {        "filled": 0,        "total": 0,        "ratio": 0      }    },    "asset_kinds": [      "agent"    ],    "a2a_protocol_versions": [      "v0.3.0"    ],    "direction": "inbound",    "source_ref": "string",    "implementation_source_ref": "string",    "approved_commit_sha": "string",    "approved_implementation_commit_sha": "string",    "approved_commit_at": "2019-08-24T14:15:22Z"  }}
GET/api/policies/{id}/branches

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

Branches and tags of the policy's source repository. A unified policy returns one RepoRefs object; a split policy returns { projectType: 'split', definition: RepoRefs, implementation: RepoRefs }.

application/json
  1. response

Branches and tags of one repository root. A provider failure returns empty lists with error set rather than failing the request.

defaultBranch?string
urlRef?string

The ref named in the repository URL, if any.

preferredRef?string

The policy's stored default ref, when there is one.

branches?array<>
truncated?boolean

True when only the first page of branches was returned.

tags?array<>
tagsTruncated?boolean

True when only the first 100 tags were returned.

error?"rate_limited"
Value in"rate_limited"
Example Request
curl -X GET 'https://www.p4a.ai/api/policies/497f6eca-6276-4993-bfeb-53cbbbba6f08/branches'
Example Response200
{  "defaultBranch": "string",  "urlRef": "string",  "preferredRef": "string",  "branches": [    {      "name": "string"    }  ],  "truncated": true,  "tags": [    {      "name": "string",      "sha": "string"    }  ],  "tagsTruncated": true,  "error": "rate_limited"}
POST/api/policies/{id}/download

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

Success.

application/json
  1. response
ok?boolean
Example Request
curl -X POST 'https://www.p4a.ai/api/policies/497f6eca-6276-4993-bfeb-53cbbbba6f08/download'
Example Response200
{  "ok": true}
GET/api/policies/{id}/history

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Query Parameters

limit?integer
before?string

Response Body

History entries, newest first.

application/json
  1. response
entries?array<>
nextCursor?string|null
Example Request
curl -X GET 'https://www.p4a.ai/api/policies/497f6eca-6276-4993-bfeb-53cbbbba6f08/history'
Example Response200
{  "entries": [    {}  ],  "nextCursor": "string"}
GET/api/policies/{id}/issues-enabled

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

The live issue-tracker state. enabled is null when the provider couldn't be read (private/gone repo, rate limit, network) — the caller should keep trusting the persisted github_has_issues.

application/json
  1. response
enabled?boolean
Example Request
curl -X GET 'https://www.p4a.ai/api/policies/497f6eca-6276-4993-bfeb-53cbbbba6f08/issues-enabled'
Example Response
{  "enabled": true}
GET/api/policies/{id}/like

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

Your like state.

application/json
  1. response
liked?boolean
Example Request
curl -X GET 'https://www.p4a.ai/api/policies/497f6eca-6276-4993-bfeb-53cbbbba6f08/like'
Example Response200
{  "liked": true}
POST/api/policies/{id}/like

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

Your like state after toggling.

application/json
  1. response
liked?boolean
Example Request
curl -X POST 'https://www.p4a.ai/api/policies/497f6eca-6276-4993-bfeb-53cbbbba6f08/like'
Example Response200
{  "liked": true}
GET/api/policies/{id}/orgs

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Query Parameters

connectionId*string
Formatuuid

Response Body

The eligible organizations for the given connection.

application/json
  1. response
orgs?array<>
Example Request
curl -X GET 'https://www.p4a.ai/api/policies/497f6eca-6276-4993-bfeb-53cbbbba6f08/orgs?connectionId=497f6eca-6276-4993-bfeb-53cbbbba6f08'
Example Response200
{  "orgs": [    {      "id": "string",      "name": "string",      "isPrimary": true,      "fullPath": "string"    }  ]}
GET/api/policies/{id}/reviewers/me

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

Your reviewer state.

application/json
  1. response
isReviewer?boolean
Example Request
curl -X GET 'https://www.p4a.ai/api/policies/497f6eca-6276-4993-bfeb-53cbbbba6f08/reviewers/me'
Example Response200
{  "isReviewer": true}
GET/api/policies/{id}/revisions

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

Your revisions for this policy, newest first.

application/json
  1. response
revisions?array<>
Example Request
curl -X GET 'https://www.p4a.ai/api/policies/497f6eca-6276-4993-bfeb-53cbbbba6f08/revisions'
Example Response200
{  "revisions": [    {      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "policy_id": "ee9b03e0-6495-427a-85a5-34444d24ae04",      "field": "description",      "proposed_value": "string",      "previous_value": "string",      "status": "pending",      "feedback": "string",      "submitted_at": "2019-08-24T14:15:22Z",      "reviewed_at": "2019-08-24T14:15:22Z"    }  ]}
POST/api/policies/{id}/revisions

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Request Body

application/json
  1. body
field*"description"
Value in"description"
value*string

New Markdown About text.

Length10 <= length <= 20000

Response Body

The created pending revision.

application/json
  1. response
revision?

An owner-proposed edit to a single published-policy field, pending an administrator's re-review before it goes live.

policy_name?string
Example Request
curl -X POST 'https://www.p4a.ai/api/policies/497f6eca-6276-4993-bfeb-53cbbbba6f08/revisions' \  -H 'Content-Type: application/json' \  -d '{  "field": "description",  "value": "stringstri"}'
Example Response
{  "revision": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "policy_id": "ee9b03e0-6495-427a-85a5-34444d24ae04",    "field": "description",    "proposed_value": "string",    "previous_value": "string",    "status": "pending",    "feedback": "string",    "submitted_at": "2019-08-24T14:15:22Z",    "reviewed_at": "2019-08-24T14:15:22Z"  },  "policy_name": "string"}

Submissions

GET/api/submissions

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Response Body

Your submissions.

application/json
  1. response
submissions?array<>
Example Request
curl -X GET 'https://www.p4a.ai/api/submissions'
Example Response200
{  "submissions": [    {      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "name": "string",      "description": "string",      "status": "string",      "githubUrl": "http://example.com",      "feedback": "string"    }  ]}
POST/api/submissions

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Request Body

application/json
  1. body
projectType?string
Value in"unified""split"
name*string
Length2 <= length <= 120
description*string
Length10 <= length <= 20000
githubUrl*string

GitHub, GitLab, or Bitbucket repo URL, e.g. https://github.com/owner/repo, https://gitlab.com/owner/repo, or https://bitbucket.org/workspace/repo.

Formaturi
implementationGithubUrl?string

Required when projectType is split. Same GitHub/GitLab/Bitbucket URL shapes.

Formaturi
sourceRef?string

Optional default git branch, tag, or commit (#1033), used as the default source ref when this policy is deployed. Omit to use the repository's default branch. Deployers can still choose another ref.

Length1 <= length <= 255
implementationSourceRef?string

Split-model only: optional default git ref for the implementation root (#1033). Omit to use the repository's default branch.

Length1 <= length <= 255
branch?SourceBranch

Branch mode: build this branch. With commitSha, that commit must be the branch head or one of its ancestors (else 422 "not on branch"); without it, the branch head. Cannot be combined with tag or with the legacy free-text ref field of the same request.

Length1 <= length <= 255
tag?SourceTag

Tag mode: build the commit the tag points at. With commitSha, the commit must match the tag (else 422). Cannot be combined with branch.

Length1 <= length <= 255
commitSha?SourceCommitSha

A commit SHA (7–64 hex characters). Alone, commit mode (detached). With branch, a commit on that branch. With tag, it must match the tag.

Match^[0-9a-fA-F]{7,64}$
implementationBranch?ImplementationSourceBranch

Split policies only: the implementation root's branch. Defaults to branch. Both roots must use the same mode.

Length1 <= length <= 255
implementationTag?ImplementationSourceTag

Split policies only: the implementation root's tag. Defaults to tag. Both roots must use the same mode.

Length1 <= length <= 255
implementationCommitSha?ImplementationSourceCommitSha

Split policies only: the implementation root's commit. Required in commit mode; optional in branch mode.

Match^[0-9a-fA-F]{7,64}$
category?string
videoTutorialUrl?string
examplesUrl?string
iconUrl?string
iconDisabled?boolean
deliversIdeaId?string

Legacy single-idea form (still accepted). Prefer deliversIdeaIds. The id of an approved Policy Idea this submission delivers.

Formatuuid
deliversIdeaIds?array<>

Optional. Approved Policy Ideas this submission declares it delivers, each with a coverage. Every referenced idea must be approved and visible to you, or the request is rejected (422). This records the declared intent while the policy is under review; each idea flips to delivered (and its submitter is notified) only once a policy that fully delivers it — or that an admin marks as completing it — is approved and published. An idea may be delivered by more than one policy, and a policy may deliver more than one idea.

Itemsitems <= 50
assetKinds?array<>

Optional. Asset types this policy targets. Defaults to values inferred from the repository's gcl.yaml metadata or name/description keywords.

a2aProtocolVersions?array<>

Optional. A2A protocol versions this policy supports, only meaningful when 'agent' is present in assetKinds.

docTabs?array<>

Optional. Rich, tabbed documentation staged with the submission and shown on the published policy page. Tabs with the reserved keys overview, configuration, examples, and faq are treated as predefined; any other key is a custom tab. Do not send an overview tab — the overview is seeded from description on review, and an empty overview here would clobber it. Tabs with an empty body are ignored.

Itemsitems <= 50

Response Body

The created submission and repository validation result.

application/json
  1. response
submission?
validation?
Example Request
curl -X POST 'https://www.p4a.ai/api/submissions' \  -H 'Content-Type: application/json' \  -d '{  "name": "string",  "description": "stringstri",  "githubUrl": "http://example.com"}'
Example Response
{  "submission": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "name": "string",    "description": "string",    "status": "string",    "githubUrl": "http://example.com",    "feedback": "string"  },  "validation": {}}
GET/api/submissions/{id}

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

The submission and its staged documentation tabs.

application/json
  1. response
submission?
docTabs?array<>
Example Request
curl -X GET 'https://www.p4a.ai/api/submissions/497f6eca-6276-4993-bfeb-53cbbbba6f08'
Example Response
{  "submission": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "name": "string",    "description": "string",    "status": "string",    "githubUrl": "http://example.com",    "feedback": "string"  },  "docTabs": [    {      "key": "string",      "title": "string",      "kind": "predefined",      "bodyMd": "string",      "sortOrder": 0    }  ]}
PATCH/api/submissions/{id}

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Request Body

application/json
  1. body

Response Body

The updated submission.

application/json
  1. response
submission?
Example Request
curl -X PATCH 'https://www.p4a.ai/api/submissions/497f6eca-6276-4993-bfeb-53cbbbba6f08' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "submission": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "name": "string",    "description": "string",    "status": "string",    "githubUrl": "http://example.com",    "feedback": "string"  }}
GET/api/submissions/{id}/history

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

Review history entries.

application/json
  1. response
entries?array<>
Example Request
curl -X GET 'https://www.p4a.ai/api/submissions/497f6eca-6276-4993-bfeb-53cbbbba6f08/history'
Example Response200
{  "entries": [    {}  ]}
POST/api/submissions/validate

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Request Body

application/json
  1. body
projectType?string
Value in"unified""split"
githubUrl?string

GitHub, GitLab, or Bitbucket repo URL, e.g. https://github.com/owner/repo, https://gitlab.com/owner/repo, or https://bitbucket.org/workspace/repo.

Formaturi
implementationGithubUrl?string

Required when projectType is split. Same GitHub/GitLab/Bitbucket URL shapes.

Formaturi
sourceRef?string

Default branch, tag, or commit to inspect (the definition root's for split). Defaults to the URL ref, then the repository's default branch. An unknown ref fails validation.

implementationSourceRef?string

Same as sourceRef, for the implementation root. split only.

includeBranches?boolean

Also return the repository's branches and tags for a picker.

branch?SourceBranch

Branch mode: build this branch. With commitSha, that commit must be the branch head or one of its ancestors (else 422 "not on branch"); without it, the branch head. Cannot be combined with tag or with the legacy free-text ref field of the same request.

Length1 <= length <= 255
tag?SourceTag

Tag mode: build the commit the tag points at. With commitSha, the commit must match the tag (else 422). Cannot be combined with branch.

Length1 <= length <= 255
commitSha?SourceCommitSha

A commit SHA (7–64 hex characters). Alone, commit mode (detached). With branch, a commit on that branch. With tag, it must match the tag.

Match^[0-9a-fA-F]{7,64}$
implementationBranch?ImplementationSourceBranch

Split policies only: the implementation root's branch. Defaults to branch. Both roots must use the same mode.

Length1 <= length <= 255
implementationTag?ImplementationSourceTag

Split policies only: the implementation root's tag. Defaults to tag. Both roots must use the same mode.

Length1 <= length <= 255
implementationCommitSha?ImplementationSourceCommitSha

Split policies only: the implementation root's commit. Required in commit mode; optional in branch mode.

Match^[0-9a-fA-F]{7,64}$

Response Body

The validation result. When Branch / Tag / Commit fields were sent, the repository was validated at the resolved commit; an invalid combination returns 422, and an unreachable git provider 502.

application/json
  1. response
validation?
branchInfo?|

Present when includeBranches was true.

resolvedSource?
Example Request
curl -X POST 'https://www.p4a.ai/api/submissions/validate' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response200
{  "validation": {},  "branchInfo": {    "defaultBranch": "string",    "urlRef": "string",    "preferredRef": "string",    "branches": [      {        "name": "string"      }    ],    "truncated": true,    "tags": [      {        "name": "string",        "sha": "string"      }    ],    "tagsTruncated": true,    "error": "rate_limited"  },  "resolvedSource": {    "definition": {      "ref": "string",      "commitSha": "string"    },    "implementation": {      "ref": "string",      "commitSha": "string"    }  }}

Rulesets

Community governance rulesets: browse the catalog, submit a ruleset repository for review, and track your submissions.

GET/api/rulesets

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Query Parameters

source?string

Which catalog to list. community (default) = user-submitted rulesets (RulesetSummary items). mulesoft = MuleSoft out-of-the-box rulesets (read-only, MulesoftRulesetSummary items).

Default"community"
Value in"community""mulesoft"
q?string

Free-text search over name and description (also for source=mulesoft).

Lengthlength <= 200
category?string

Filter by category: one of the RulesetCategory values, or All Categories for no filter. For source=mulesoft it matches one of the ruleset's Exchange categories exactly (most MuleSoft rulesets have none).

Lengthlength <= 120
scope?string

Only rulesets that target this API type. agent-network is a deprecated alias for agent.

Value in"rest-api""async-api""http-api""grpc-api""agent""mcp""agent-network"
sort?string

Sort key. alpha sorts by name; submitted by submission time; likes and views by engagement. Unrecognized values fall back to alpha. For source=mulesoft submitted orders by the effective publish date (published_at); the catalog has no engagement counters, so likes and views fall back to alpha.

Default"alpha"
Value in"alpha""submitted""likes""views"
order?string

Sort direction. Defaults to asc for alpha and desc for the others.

Value in"asc""desc"
limit?integer
Range1 <= value <= 200
Default100
offset?integer
Range0 <= value
Default0

Response Body

One page of rulesets.

application/json
  1. response
rulesets?array<|>

RulesetSummary items for the community catalog; MulesoftRulesetSummary items when source=mulesoft. Tell them apart by source.

hasMore?boolean
Example Request
curl -X GET 'https://www.p4a.ai/api/rulesets'
Example Response
{  "rulesets": [    {      "source": "community",      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "name": "string",      "description": "string",      "category": "Security",      "profile_name": "string",      "rule_counts": {        "violation": 0,        "warning": 0,        "info": 0      },      "target_scopes": [        "rest-api"      ],      "tags": [        "string"      ],      "icon_url": "http://example.com",      "exchange_asset_id": "string",      "lifecycle_status": "under_review",      "published_at": "2019-08-24T14:15:22Z",      "likes": 0,      "views": 0,      "deploys": 0,      "comment_count": 0,      "submitted_by": "6703ac2f-9eb5-40e9-9fde-511b2dbf4be5",      "owner_name": "string",      "owner_username": "string",      "created_at": "2019-08-24T14:15:22Z",      "updated_at": "2019-08-24T14:15:22Z"    }  ],  "hasMore": true}
GET/api/rulesets/{id}

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

The ruleset.

application/json
  1. response
ruleset?
Example Request
curl -X GET 'https://www.p4a.ai/api/rulesets/497f6eca-6276-4993-bfeb-53cbbbba6f08'
Example Response
{  "ruleset": {    "source": "community",    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "name": "string",    "description": "string",    "category": "Security",    "profile_name": "string",    "rule_counts": {      "violation": 0,      "warning": 0,      "info": 0    },    "target_scopes": [      "rest-api"    ],    "tags": [      "string"    ],    "icon_url": "http://example.com",    "exchange_asset_id": "string",    "lifecycle_status": "under_review",    "published_at": "2019-08-24T14:15:22Z",    "likes": 0,    "views": 0,    "deploys": 0,    "comment_count": 0,    "submitted_by": "6703ac2f-9eb5-40e9-9fde-511b2dbf4be5",    "owner_name": "string",    "owner_username": "string",    "created_at": "2019-08-24T14:15:22Z",    "updated_at": "2019-08-24T14:15:22Z",    "submission_id": "945dfedc-ad7f-4af7-b20c-06082ffa3cb3",    "source_url": "http://example.com",    "source_ref": "string",    "approved_commit_sha": "string",    "approved_commit_at": "2019-08-24T14:15:22Z",    "ruleset_path": "string",    "rule_names": [      "string"    ],    "video_tutorial_url": "http://example.com",    "examples_url": "http://example.com",    "review_feedback": "string",    "reviewed_at": "2019-08-24T14:15:22Z",    "contributors": [      {        "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",        "username": "string",        "name": "string"      }    ],    "delivers_ideas": [      {        "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",        "slug": "string",        "title": "string",        "phase": "declared",        "coverage": "full",        "scope_note": "string",        "completes_idea": true      }    ]  }}
PATCH/api/rulesets/{id}

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Request Body

application/json
  1. body

As the owner you can set these two links. Send an empty string to clear one.

Properties1 <= properties
videoTutorialUrl?string
examplesUrl?string

Response Body

The updated ruleset.

application/json
  1. response
ruleset?
Example Request
curl -X PATCH 'https://www.p4a.ai/api/rulesets/497f6eca-6276-4993-bfeb-53cbbbba6f08' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "ruleset": {    "source": "community",    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "name": "string",    "description": "string",    "category": "Security",    "profile_name": "string",    "rule_counts": {      "violation": 0,      "warning": 0,      "info": 0    },    "target_scopes": [      "rest-api"    ],    "tags": [      "string"    ],    "icon_url": "http://example.com",    "exchange_asset_id": "string",    "lifecycle_status": "under_review",    "published_at": "2019-08-24T14:15:22Z",    "likes": 0,    "views": 0,    "deploys": 0,    "comment_count": 0,    "submitted_by": "6703ac2f-9eb5-40e9-9fde-511b2dbf4be5",    "owner_name": "string",    "owner_username": "string",    "created_at": "2019-08-24T14:15:22Z",    "updated_at": "2019-08-24T14:15:22Z",    "submission_id": "945dfedc-ad7f-4af7-b20c-06082ffa3cb3",    "source_url": "http://example.com",    "source_ref": "string",    "approved_commit_sha": "string",    "approved_commit_at": "2019-08-24T14:15:22Z",    "ruleset_path": "string",    "rule_names": [      "string"    ],    "video_tutorial_url": "http://example.com",    "examples_url": "http://example.com",    "review_feedback": "string",    "reviewed_at": "2019-08-24T14:15:22Z",    "contributors": [      {        "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",        "username": "string",        "name": "string"      }    ],    "delivers_ideas": [      {        "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",        "slug": "string",        "title": "string",        "phase": "declared",        "coverage": "full",        "scope_note": "string",        "completes_idea": true      }    ]  }}
GET/api/rulesets/{id}/reviewers/me

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

Your reviewer state.

application/json
  1. response
isReviewer*boolean
role*|
Value in"viewer""commenter""editor"null
Example Request
curl -X GET 'https://www.p4a.ai/api/rulesets/497f6eca-6276-4993-bfeb-53cbbbba6f08/reviewers/me'
Example Response200
{  "isReviewer": true,  "role": "viewer"}
GET/api/rulesets/{id}/docs

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

The documentation tabs and completeness.

application/json
  1. response

A ruleset's documentation tabs as the caller sees them (#1163).

tabs?array<>

Tabs ordered by sortOrder. Callers who can't edit get only the overview and the tabs with content.

completeness?

How many of the predefined documentation tabs carry non-empty content. A soft signal for badges / progress UI, not a gate. Only the four predefined tabs (overview/configuration/examples/faq) count.

canEdit?boolean

Whether the caller may edit these tabs.

Example Request
curl -X GET 'https://www.p4a.ai/api/rulesets/497f6eca-6276-4993-bfeb-53cbbbba6f08/docs'
Example Response
{  "tabs": [    {      "key": "string",      "title": "string",      "kind": "predefined",      "bodyMd": "string",      "sortOrder": 0    }  ],  "completeness": {    "filled": 0,    "total": 0,    "ratio": 0  },  "canEdit": true}
POST/api/rulesets/{id}/docs

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Request Body

application/json
  1. body

The complete new tab set for a ruleset. Must include an overview tab (the one mandatory tab). Keys overview/rules/examples/faq become predefined tabs; others (including configuration) are custom.

tabs*array<>
Items1 <= items <= 50

Response Body

The new documentation tab set and completeness.

application/json
  1. response

A ruleset's documentation tabs as the caller sees them (#1163).

tabs?array<>

Tabs ordered by sortOrder. Callers who can't edit get only the overview and the tabs with content.

completeness?

How many of the predefined documentation tabs carry non-empty content. A soft signal for badges / progress UI, not a gate. Only the four predefined tabs (overview/configuration/examples/faq) count.

canEdit?boolean

Whether the caller may edit these tabs.

Example Request
curl -X POST 'https://www.p4a.ai/api/rulesets/497f6eca-6276-4993-bfeb-53cbbbba6f08/docs' \  -H 'Content-Type: application/json' \  -d '{  "tabs": [    {      "key": "string",      "title": "string"    }  ]}'
Example Response
{  "tabs": [    {      "key": "string",      "title": "string",      "kind": "predefined",      "bodyMd": "string",      "sortOrder": 0    }  ],  "completeness": {    "filled": 0,    "total": 0,    "ratio": 0  },  "canEdit": true}
PUT/api/rulesets/{id}/docs/{key}

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid
key*string

Tab key. overview/rules/examples/faq are predefined tabs; any other key (including configuration) is a custom tab.

Match^[a-z0-9][a-z0-9_-]{0,63}$

Request Body

application/json
  1. body
title*string
bodyMd?string
sortOrder?integer

Response Body

The tab as stored.

application/json
  1. response
tab?

One per-policy documentation tab (#817).

Example Request
curl -X PUT 'https://www.p4a.ai/api/rulesets/497f6eca-6276-4993-bfeb-53cbbbba6f08/docs/string' \  -H 'Content-Type: application/json' \  -d '{  "title": "string"}'
Example Response
{  "tab": {    "key": "string",    "title": "string",    "kind": "predefined",    "bodyMd": "string",    "sortOrder": 0  }}
DELETE/api/rulesets/{id}/docs/{key}

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid
key*string

Tab key. overview/rules/examples/faq are predefined tabs; any other key (including configuration) is a custom tab.

Match^[a-z0-9][a-z0-9_-]{0,63}$

Response Body

Success.

application/json
  1. response
ok?boolean
Example Request
curl -X DELETE 'https://www.p4a.ai/api/rulesets/497f6eca-6276-4993-bfeb-53cbbbba6f08/docs/string'
Example Response
{  "ok": true}
GET/api/ruleset-submissions

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Response Body

Your ruleset submissions.

application/json
  1. response
submissions?array<>
Example Request
curl -X GET 'https://www.p4a.ai/api/ruleset-submissions'
Example Response200
{  "submissions": [    {      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "status": "submitted",      "submitted_by": "6703ac2f-9eb5-40e9-9fde-511b2dbf4be5",      "name": "string",      "description": "string",      "category": "Security",      "source_url": "http://example.com",      "source_ref": "string",      "source_commit_sha": "string",      "ruleset_path": "string",      "profile_name": "string",      "rule_counts": {        "violation": 0,        "warning": 0,        "info": 0      },      "rule_names": [        "string"      ],      "target_scopes": [        "rest-api"      ],      "exchange_asset_id": "string",      "icon_url": "http://example.com",      "tags": [        "string"      ],      "video_tutorial_url": "http://example.com",      "examples_url": "http://example.com",      "review_feedback": "string",      "reviewed_by": "92ab4dbc-1b27-40ce-b24b-7dde8f4709be",      "reviewed_at": "2019-08-24T14:15:22Z",      "ruleset_id": "ca688a19-2766-4b2c-aefa-28d16a464773",      "previous_snapshot": {        "name": "string",        "description": "string",        "category": "Security",        "source_url": "http://example.com",        "source_ref": "string",        "ruleset_path": "string",        "profile_name": "string",        "rule_names": [          "string"        ],        "target_scopes": [          "rest-api"        ],        "exchange_asset_id": "string",        "tags": [          "string"        ],        "video_tutorial_url": "http://example.com",        "examples_url": "http://example.com",        "snapshotted_at": "2019-08-24T14:15:22Z"      },      "revision_count": 0,      "created_at": "2019-08-24T14:15:22Z",      "updated_at": "2019-08-24T14:15:22Z"    }  ]}
POST/api/ruleset-submissions

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Request Body

application/json
  1. body
name*string
Length2 <= length <= 120
description*string
Length10 <= length <= 20000
repoUrl*string

Public GitHub, GitLab, or Bitbucket repo URL. A /tree/<ref>/<path> URL scopes the ruleset root to that folder.

Formaturi
category?RulesetCategory

Catalog category of a community ruleset. Defaults to Other.

Value in"Security""API Design""Documentation""Compliance""MCP""A2A""LLM""Operations""Other"
sourceRef?string

Default branch, tag, or commit. Omit (or send an empty string) for the default branch.

Lengthlength <= 255
branch?SourceBranch

Branch mode: build this branch. With commitSha, that commit must be the branch head or one of its ancestors (else 422 "not on branch"); without it, the branch head. Cannot be combined with tag or with the legacy free-text ref field of the same request.

Length1 <= length <= 255
tag?SourceTag

Tag mode: build the commit the tag points at. With commitSha, the commit must match the tag (else 422). Cannot be combined with branch.

Length1 <= length <= 255
commitSha?SourceCommitSha

A commit SHA (7–64 hex characters). Alone, commit mode (detached). With branch, a commit on that branch. With tag, it must match the tag.

Match^[0-9a-fA-F]{7,64}$
rulesetPath?string

Profile file path relative to the ruleset root. Omit to auto-discover it.

Lengthlength <= 1024
targetScopes?array<>

Asset kinds the ruleset applies to. Defaults to what the profile targets.

exchangeAssetId?string
Match^[A-Za-z0-9][A-Za-z0-9._-]*$
Lengthlength <= 255
iconUrl?string

Catalog icon. Omit to use icon.png or icon.svg from the ruleset root, if present.

Formaturi
iconDisabled?boolean

Show the default icon, ignoring iconUrl and any icon in the repository.

tags?array<>
Itemsitems <= 20
videoTutorialUrl?string
Formaturi
examplesUrl?string
Formaturi
docTabs?array<>

Optional documentation tabs (#1163), staged with the submission and copied to the ruleset when it moves to review. Keys must be unique. The reserved keys overview, rules, examples and faq are predefined tabs; any other key is a custom tab. Missing predefined tabs are added empty, and a blank overview keeps the description as the overview.

Itemsitems <= 50
deliversIdeaIds?array<>

Optional. Approved ideas this submission declares it delivers, each with a coverage. Every idea must be approved and visible to you, and may appear once, or the request is rejected (422). This is declared intent: an idea flips to delivered (and its submitter is notified) only once a ruleset that fully delivers it, or that an admin marks as completing it, is approved.

Itemsitems <= 50

Response Body

The created submission and any validation warnings.

application/json
  1. response
submission?
warnings?array<string>
Example Request
curl -X POST 'https://www.p4a.ai/api/ruleset-submissions' \  -H 'Content-Type: application/json' \  -d '{  "name": "string",  "description": "stringstri",  "repoUrl": "http://example.com"}'
Example Response
{  "submission": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "status": "submitted",    "submitted_by": "6703ac2f-9eb5-40e9-9fde-511b2dbf4be5",    "name": "string",    "description": "string",    "category": "Security",    "source_url": "http://example.com",    "source_ref": "string",    "source_commit_sha": "string",    "ruleset_path": "string",    "profile_name": "string",    "rule_counts": {      "violation": 0,      "warning": 0,      "info": 0    },    "rule_names": [      "string"    ],    "target_scopes": [      "rest-api"    ],    "exchange_asset_id": "string",    "icon_url": "http://example.com",    "tags": [      "string"    ],    "video_tutorial_url": "http://example.com",    "examples_url": "http://example.com",    "review_feedback": "string",    "reviewed_by": "92ab4dbc-1b27-40ce-b24b-7dde8f4709be",    "reviewed_at": "2019-08-24T14:15:22Z",    "ruleset_id": "ca688a19-2766-4b2c-aefa-28d16a464773",    "previous_snapshot": {      "name": "string",      "description": "string",      "category": "Security",      "source_url": "http://example.com",      "source_ref": "string",      "ruleset_path": "string",      "profile_name": "string",      "rule_names": [        "string"      ],      "target_scopes": [        "rest-api"      ],      "exchange_asset_id": "string",      "tags": [        "string"      ],      "video_tutorial_url": "http://example.com",      "examples_url": "http://example.com",      "snapshotted_at": "2019-08-24T14:15:22Z"    },    "revision_count": 0,    "created_at": "2019-08-24T14:15:22Z",    "updated_at": "2019-08-24T14:15:22Z"  },  "warnings": [    "string"  ]}
GET/api/ruleset-submissions/{id}

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

The submission.

application/json
  1. response
submission?
docTabs?array<>

The documentation tabs staged on the submission (#1163), copied to the ruleset when it moves to review.

Example Request
curl -X GET 'https://www.p4a.ai/api/ruleset-submissions/497f6eca-6276-4993-bfeb-53cbbbba6f08'
Example Response
{  "submission": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "status": "submitted",    "submitted_by": "6703ac2f-9eb5-40e9-9fde-511b2dbf4be5",    "name": "string",    "description": "string",    "category": "Security",    "source_url": "http://example.com",    "source_ref": "string",    "source_commit_sha": "string",    "ruleset_path": "string",    "profile_name": "string",    "rule_counts": {      "violation": 0,      "warning": 0,      "info": 0    },    "rule_names": [      "string"    ],    "target_scopes": [      "rest-api"    ],    "exchange_asset_id": "string",    "icon_url": "http://example.com",    "tags": [      "string"    ],    "video_tutorial_url": "http://example.com",    "examples_url": "http://example.com",    "review_feedback": "string",    "reviewed_by": "92ab4dbc-1b27-40ce-b24b-7dde8f4709be",    "reviewed_at": "2019-08-24T14:15:22Z",    "ruleset_id": "ca688a19-2766-4b2c-aefa-28d16a464773",    "previous_snapshot": {      "name": "string",      "description": "string",      "category": "Security",      "source_url": "http://example.com",      "source_ref": "string",      "ruleset_path": "string",      "profile_name": "string",      "rule_names": [        "string"      ],      "target_scopes": [        "rest-api"      ],      "exchange_asset_id": "string",      "tags": [        "string"      ],      "video_tutorial_url": "http://example.com",      "examples_url": "http://example.com",      "snapshotted_at": "2019-08-24T14:15:22Z"    },    "revision_count": 0,    "created_at": "2019-08-24T14:15:22Z",    "updated_at": "2019-08-24T14:15:22Z"  },  "docTabs": [    {      "key": "string",      "title": "string",      "kind": "predefined",      "bodyMd": "string",      "sortOrder": 0    }  ]}
PATCH/api/ruleset-submissions/{id}

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Request Body

application/json
  1. body

Any subset of the RulesetSubmissionInput fields. An empty string clears an optional field.

Properties1 <= properties
name?string
Length2 <= length <= 120
description?string
Length10 <= length <= 20000
repoUrl?string
Formaturi
category?RulesetCategory

Catalog category of a community ruleset. Defaults to Other.

Value in"Security""API Design""Documentation""Compliance""MCP""A2A""LLM""Operations""Other"
sourceRef?string
Lengthlength <= 255
branch?SourceBranch

Branch mode: build this branch. With commitSha, that commit must be the branch head or one of its ancestors (else 422 "not on branch"); without it, the branch head. Cannot be combined with tag or with the legacy free-text ref field of the same request.

Length1 <= length <= 255
tag?SourceTag

Tag mode: build the commit the tag points at. With commitSha, the commit must match the tag (else 422). Cannot be combined with branch.

Length1 <= length <= 255
commitSha?SourceCommitSha

A commit SHA (7–64 hex characters). Alone, commit mode (detached). With branch, a commit on that branch. With tag, it must match the tag.

Match^[0-9a-fA-F]{7,64}$
rulesetPath?string
Lengthlength <= 1024
targetScopes?array<>
exchangeAssetId?string
Lengthlength <= 255
iconUrl?string
iconDisabled?boolean

Clear the icon and show the default. Wins over iconUrl.

tags?array<string>
videoTutorialUrl?string
examplesUrl?string
resubmit?boolean

Send a needs_improvement submission back for review.

docTabs?array<>

Optional documentation tabs (#1163), staged with the submission and copied to the ruleset when it moves to review. Keys must be unique. The reserved keys overview, rules, examples and faq are predefined tabs; any other key is a custom tab. Missing predefined tabs are added empty, and a blank overview keeps the description as the overview. On a patch the array replaces the staged set; omit it to keep the staged tabs.

Itemsitems <= 50
deliversIdeaIds?array<>

Replaces the ideas this submission declares it delivers. Omit it to keep them; send [] to clear them. Every idea you add must be approved and visible to you (422); ideas already declared stay valid even if they have since been delivered. You can change them while the submission is submitted or needs_improvement; sending only this field does not resubmit. Once the ruleset is under review only an admin can change them (403). When the same request also edits fields or resubmits, the edit is applied first, and if it is rejected (409/403) the declared ideas are left unchanged.

Itemsitems <= 50

Response Body

The updated submission.

application/json
  1. response
submission?
Example Request
curl -X PATCH 'https://www.p4a.ai/api/ruleset-submissions/497f6eca-6276-4993-bfeb-53cbbbba6f08' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "submission": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "status": "submitted",    "submitted_by": "6703ac2f-9eb5-40e9-9fde-511b2dbf4be5",    "name": "string",    "description": "string",    "category": "Security",    "source_url": "http://example.com",    "source_ref": "string",    "source_commit_sha": "string",    "ruleset_path": "string",    "profile_name": "string",    "rule_counts": {      "violation": 0,      "warning": 0,      "info": 0    },    "rule_names": [      "string"    ],    "target_scopes": [      "rest-api"    ],    "exchange_asset_id": "string",    "icon_url": "http://example.com",    "tags": [      "string"    ],    "video_tutorial_url": "http://example.com",    "examples_url": "http://example.com",    "review_feedback": "string",    "reviewed_by": "92ab4dbc-1b27-40ce-b24b-7dde8f4709be",    "reviewed_at": "2019-08-24T14:15:22Z",    "ruleset_id": "ca688a19-2766-4b2c-aefa-28d16a464773",    "previous_snapshot": {      "name": "string",      "description": "string",      "category": "Security",      "source_url": "http://example.com",      "source_ref": "string",      "ruleset_path": "string",      "profile_name": "string",      "rule_names": [        "string"      ],      "target_scopes": [        "rest-api"      ],      "exchange_asset_id": "string",      "tags": [        "string"      ],      "video_tutorial_url": "http://example.com",      "examples_url": "http://example.com",      "snapshotted_at": "2019-08-24T14:15:22Z"    },    "revision_count": 0,    "created_at": "2019-08-24T14:15:22Z",    "updated_at": "2019-08-24T14:15:22Z"  }}
DELETE/api/ruleset-submissions/{id}

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

Success.

application/json
  1. response
ok?boolean
Example Request
curl -X DELETE 'https://www.p4a.ai/api/ruleset-submissions/497f6eca-6276-4993-bfeb-53cbbbba6f08'
Example Response
{  "ok": true}
GET/api/ruleset-submissions/{id}/history

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

Review history entries.

application/json
  1. response
entries?array<>
Example Request
curl -X GET 'https://www.p4a.ai/api/ruleset-submissions/497f6eca-6276-4993-bfeb-53cbbbba6f08/history'
Example Response
{  "entries": [    {}  ]}
POST/api/ruleset-submissions/validate

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Request Body

application/json
  1. body
repoUrl*string

GitHub, GitLab, or Bitbucket repo URL. A /tree/<ref>/<path> URL scopes the ruleset root to that folder.

Formaturi
ref?string

Branch, tag, or commit to inspect. Defaults to the URL ref, then the default branch.

rulesetPath?string

Profile file path relative to the ruleset root; skips auto-discovery.

includeBranches?boolean

Also return the repository's branch list for a ref picker.

branch?SourceBranch

Branch mode: build this branch. With commitSha, that commit must be the branch head or one of its ancestors (else 422 "not on branch"); without it, the branch head. Cannot be combined with tag or with the legacy free-text ref field of the same request.

Length1 <= length <= 255
tag?SourceTag

Tag mode: build the commit the tag points at. With commitSha, the commit must match the tag (else 422). Cannot be combined with branch.

Length1 <= length <= 255
commitSha?SourceCommitSha

A commit SHA (7–64 hex characters). Alone, commit mode (detached). With branch, a commit on that branch. With tag, it must match the tag.

Match^[0-9a-fA-F]{7,64}$

Response Body

The validation result. validation.ok is false (with errors) when the repository or profile is not acceptable.

application/json
  1. response
validation?
branchInfo?

Present when includeBranches is true and validation passed.

resolvedSource?

One root after the Branch / Tag / Commit fields were resolved. ref is what gets stored as the source ref (the legacy ref, the branch or tag name, the commit, or null for the default branch); commitSha is the verified commit the repository was validated at, or null when the legacy ref path let the validator resolve it.

Example Request
curl -X POST 'https://www.p4a.ai/api/ruleset-submissions/validate' \  -H 'Content-Type: application/json' \  -d '{  "repoUrl": "http://example.com"}'
Example Response
{  "validation": {    "ok": true,    "errors": [      "string"    ],    "warnings": [      "string"    ],    "ref": "string",    "subPath": "string",    "rulesetPath": "string",    "rulesetPathSource": "explicit",    "profile": {      "profileName": "string",      "description": "string",      "ruleNames": [        "string"      ],      "ruleCounts": {        "violation": 0,        "warning": 0,        "info": 0      },      "targetClasses": [        "string"      ],      "dialectVersion": "1.0"    },    "exchange": {      "assetId": "string",      "name": "string",      "description": "string",      "main": "string"    },    "targetScopes": [      "rest-api"    ],    "iconUrl": "http://example.com"  },  "branchInfo": {    "defaultBranch": "string",    "urlRef": "string",    "preferredRef": "string",    "branches": [      {        "name": "string"      }    ],    "truncated": true,    "tags": [      {        "name": "string",        "sha": "string"      }    ],    "tagsTruncated": true,    "error": "rate_limited"  },  "resolvedSource": {    "ref": "string",    "commitSha": "string"  }}

Ruleset drafts

Workspace rulesets, called drafts in the API, are private rulesets built in the guided editor. Every active member of the workspace can read, edit and snapshot one; only its creator or a workspace owner or admin can delete it or move it to another workspace they belong to. They never appear in the public catalog. Saves send the revision they loaded and get 409 with the current revision if someone else saved first.

GET/api/ruleset-drafts

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Query Parameters

workspaceId?string

Only return drafts in this workspace.

Formatuuid

Response Body

Draft summaries.

application/json
  1. response
drafts?array<>
Example Request
curl -X GET 'https://www.p4a.ai/api/ruleset-drafts'
Example Response
{  "drafts": [    {      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9",      "name": "string",      "description": "string",      "asset_id": "string",      "default_version": "string",      "revision": 0,      "created_by": "ee824cad-d7a6-4f48-87dc-e8461a9201c4",      "updated_by": "deea00dc-b6b6-4412-a483-26ac61e1f6fe",      "created_at": "2019-08-24T14:15:22Z",      "updated_at": "2019-08-24T14:15:22Z"    }  ]}
POST/api/ruleset-drafts

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Request Body

application/json
  1. body
workspaceId*string
Formatuuid
name*string
Length1 <= length <= 200
description?string
Lengthlength <= 5000
yaml*string

May be empty. At most 200,000 bytes (UTF-8).

assetId?|

Lowercase letters, digits and hyphens. Unique within the workspace.

Match^[a-z0-9]([a-z0-9-]{0,198}[a-z0-9])?$
defaultVersion?|
Match^\d+\.\d+\.\d+$

Response Body

The new draft.

application/json
  1. response
draft?

A workspace ruleset draft with its YAML.

Example Request
curl -X POST 'https://www.p4a.ai/api/ruleset-drafts' \  -H 'Content-Type: application/json' \  -d '{  "workspaceId": "ef0efa32-d1c1-43d4-a5e2-fe7b4f00403c",  "name": "string",  "yaml": "string"}'
Example Response
{  "draft": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9",    "name": "string",    "description": "string",    "asset_id": "string",    "default_version": "string",    "revision": 0,    "created_by": "ee824cad-d7a6-4f48-87dc-e8461a9201c4",    "updated_by": "deea00dc-b6b6-4412-a483-26ac61e1f6fe",    "created_at": "2019-08-24T14:15:22Z",    "updated_at": "2019-08-24T14:15:22Z",    "yaml": "string"  }}
GET/api/ruleset-drafts/{id}

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

The draft.

application/json
  1. response
draft?

A workspace ruleset draft with its YAML.

Example Request
curl -X GET 'https://www.p4a.ai/api/ruleset-drafts/497f6eca-6276-4993-bfeb-53cbbbba6f08'
Example Response
{  "draft": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9",    "name": "string",    "description": "string",    "asset_id": "string",    "default_version": "string",    "revision": 0,    "created_by": "ee824cad-d7a6-4f48-87dc-e8461a9201c4",    "updated_by": "deea00dc-b6b6-4412-a483-26ac61e1f6fe",    "created_at": "2019-08-24T14:15:22Z",    "updated_at": "2019-08-24T14:15:22Z",    "yaml": "string"  }}
PATCH/api/ruleset-drafts/{id}

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Request Body

application/json
  1. body

expectedRevision plus at least one other field. Omitted fields are left unchanged.

expectedRevision*integer

The revision you loaded.

Range1 <= value
name?string
Length1 <= length <= 200
description?string
Lengthlength <= 5000
yaml?string

At most 200,000 bytes (UTF-8).

assetId?|

null or an empty string clears it.

defaultVersion?|

null or an empty string clears it.

Response Body

The saved draft.

application/json
  1. response
draft?

A workspace ruleset draft with its YAML.

Example Request
curl -X PATCH 'https://www.p4a.ai/api/ruleset-drafts/497f6eca-6276-4993-bfeb-53cbbbba6f08' \  -H 'Content-Type: application/json' \  -d '{  "expectedRevision": 1}'
Example Response
{  "draft": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9",    "name": "string",    "description": "string",    "asset_id": "string",    "default_version": "string",    "revision": 0,    "created_by": "ee824cad-d7a6-4f48-87dc-e8461a9201c4",    "updated_by": "deea00dc-b6b6-4412-a483-26ac61e1f6fe",    "created_at": "2019-08-24T14:15:22Z",    "updated_at": "2019-08-24T14:15:22Z",    "yaml": "string"  }}
DELETE/api/ruleset-drafts/{id}

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Query Parameters

acknowledgeLive?boolean

Set to true to delete a draft that has live deployments.

Defaultfalse

Response Body

The draft was deleted.

application/json
  1. response
ok*true
Value intrue
deletedDeployments*integer

Deployment records removed with the draft.

liveDeployments*integer

How many of those were live. Their assets stay in Exchange.

Example Request
curl -X DELETE 'https://www.p4a.ai/api/ruleset-drafts/497f6eca-6276-4993-bfeb-53cbbbba6f08'
Example Response
{  "ok": true,  "deletedDeployments": 0,  "liveDeployments": 0}
POST/api/ruleset-drafts/{id}/move

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Request Body

application/json
  1. body
workspaceId*string

The workspace to move the draft to.

Formatuuid
expectedRevision*integer

The draft revision you loaded.

Range1 <= value
acknowledgeLive?boolean

Set to true to move a draft that has live deployments.

Defaultfalse

Response Body

The moved draft.

application/json
  1. response
draft?

A workspace ruleset draft with its YAML.

Example Request
curl -X POST 'https://www.p4a.ai/api/ruleset-drafts/497f6eca-6276-4993-bfeb-53cbbbba6f08/move' \  -H 'Content-Type: application/json' \  -d '{  "workspaceId": "ef0efa32-d1c1-43d4-a5e2-fe7b4f00403c",  "expectedRevision": 1}'
Example Response
{  "draft": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9",    "name": "string",    "description": "string",    "asset_id": "string",    "default_version": "string",    "revision": 0,    "created_by": "ee824cad-d7a6-4f48-87dc-e8461a9201c4",    "updated_by": "deea00dc-b6b6-4412-a483-26ac61e1f6fe",    "created_at": "2019-08-24T14:15:22Z",    "updated_at": "2019-08-24T14:15:22Z",    "yaml": "string"  }}
GET/api/ruleset-drafts/{id}/snapshots

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

Snapshot summaries.

application/json
  1. response
snapshots?array<>
Example Request
curl -X GET 'https://www.p4a.ai/api/ruleset-drafts/497f6eca-6276-4993-bfeb-53cbbbba6f08/snapshots'
Example Response
{  "snapshots": [    {      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "draft_id": "d998e5e8-954a-4a68-bb9e-7305e87278c0",      "sha256": "string",      "byte_size": 0,      "label": "string",      "reason": "manual",      "created_by": "ee824cad-d7a6-4f48-87dc-e8461a9201c4",      "created_at": "2019-08-24T14:15:22Z"    }  ]}
POST/api/ruleset-drafts/{id}/snapshots

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Request Body

application/json
  1. body
label?|

An optional label, such as "before severity changes".

Lengthlength <= 120

Response Body

A snapshot of this content already existed.

application/json
  1. response
snapshot?

An immutable snapshot of a draft's YAML, without the YAML.

deduped?boolean

true when a snapshot of the same YAML already existed.

pruned_snapshot_ids?array<>

Manual snapshots deleted to stay under the per-draft cap.

Example Request
curl -X POST 'https://www.p4a.ai/api/ruleset-drafts/497f6eca-6276-4993-bfeb-53cbbbba6f08/snapshots' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "snapshot": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "draft_id": "d998e5e8-954a-4a68-bb9e-7305e87278c0",    "sha256": "string",    "byte_size": 0,    "label": "string",    "reason": "manual",    "created_by": "ee824cad-d7a6-4f48-87dc-e8461a9201c4",    "created_at": "2019-08-24T14:15:22Z"  },  "deduped": true,  "pruned_snapshot_ids": [    "d91cc35a-e633-40a0-b706-ec4ec740ac75"  ]}
GET/api/ruleset-drafts/{id}/snapshots/{snapshotId}

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid
snapshotId*string

The snapshot's UUID.

Formatuuid

Response Body

The snapshot.

application/json
  1. response
snapshot?

A draft snapshot with its YAML.

Example Request
curl -X GET 'https://www.p4a.ai/api/ruleset-drafts/497f6eca-6276-4993-bfeb-53cbbbba6f08/snapshots/497f6eca-6276-4993-bfeb-53cbbbba6f08'
Example Response
{  "snapshot": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "draft_id": "d998e5e8-954a-4a68-bb9e-7305e87278c0",    "sha256": "string",    "byte_size": 0,    "label": "string",    "reason": "manual",    "created_by": "ee824cad-d7a6-4f48-87dc-e8461a9201c4",    "created_at": "2019-08-24T14:15:22Z",    "yaml": "string"  }}

Deployments

GET/api/deployments

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Query Parameters

rulesetId?string

Only ruleset deployments for this ruleset.

Formatuuid
rulesetDraftId?string

Only deployments of this workspace ruleset draft.

Formatuuid
assetType?string

Filter by deployed asset type. Omit to return both.

Value in"policy""ruleset"

Response Body

Your deployments, paginated.

application/json
  1. response
deployments?array<>
pagination?
Example Request
curl -X GET 'https://www.p4a.ai/api/deployments'
Example Response200
{  "deployments": [    {      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "asset_type": "policy",      "policy_id": "ee9b03e0-6495-427a-85a5-34444d24ae04",      "ruleset_id": "ca688a19-2766-4b2c-aefa-28d16a464773",      "ruleset_draft_id": "1934ace7-33fb-40a7-820f-3dcb76f9d460",      "ruleset_draft_accessible": true,      "ruleset_snapshot_id": "84f19c36-5049-4161-bdb3-b1120d6ddc65",      "content_sha256": "string",      "governance_profile": {},      "governance_profile_result": {},      "connection_id": "d3547de1-d1f2-4344-b4c2-17169b7526f9",      "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9",      "status": "string",      "anypoint_org_id": "string",      "requested_ref": "string",      "approved_source": true,      "definition_asset_version": "string",      "implementation_asset_version": "string",      "home_doc_status": "published"    }  ],  "pagination": {}}
POST/api/deployments

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Request Body

application/json
  1. body
policyId*string
Formatuuid
connectionId*string
Formatuuid
workspaceId*string
Formatuuid
targetOrganizationIds*array<string>
Items1 <= items <= 50
doPublish?boolean
doRelease?boolean
cleanupDev?boolean
ref?string

Branch, tag or commit to build. Omit to build the approved commit (or, for a policy with none recorded, its source_ref or the repository default branch). A ref other than the approved commit deploys but is flagged as an unapproved source.

implementationRef?string

Split policies only; same rules as ref for the implementation root.

branch?SourceBranch

Branch mode: build this branch. With commitSha, that commit must be the branch head or one of its ancestors (else 422 "not on branch"); without it, the branch head. Cannot be combined with tag or with the legacy free-text ref field of the same request.

Length1 <= length <= 255
tag?SourceTag

Tag mode: build the commit the tag points at. With commitSha, the commit must match the tag (else 422). Cannot be combined with branch.

Length1 <= length <= 255
commitSha?SourceCommitSha

A commit SHA (7–64 hex characters). Alone, commit mode (detached). With branch, a commit on that branch. With tag, it must match the tag.

Match^[0-9a-fA-F]{7,64}$
implementationBranch?ImplementationSourceBranch

Split policies only: the implementation root's branch. Defaults to branch. Both roots must use the same mode.

Length1 <= length <= 255
implementationTag?ImplementationSourceTag

Split policies only: the implementation root's tag. Defaults to tag. Both roots must use the same mode.

Length1 <= length <= 255
implementationCommitSha?ImplementationSourceCommitSha

Split policies only: the implementation root's commit. Required in commit mode; optional in branch mode.

Match^[0-9a-fA-F]{7,64}$
version?string

Optional override for the published Exchange asset version. Semver core only (MAJOR.MINOR.PATCH, e.g. 1.2.3 — no v prefix, no pre-release/build suffix). Omit to derive the version from the policy repo. A Publish still appends a -dev.<timestamp> suffix.

Match^\d+\.\d+\.\d+$

Response Body

All target organizations were enqueued successfully.

application/json
  1. response

Per-target results plus the DeploySourceSummary fields at the top level.

results?array<>
resolvedCommitSha?|

The commit that will be built, when known at enqueue time.

resolvedImplementationCommitSha?|

Split policies only; the implementation commit.

requestedRef?|

The ref passed in, or null when left blank.

approvedCommitSha?|

The approved commit, or null when none is recorded.

approvedSource?|

true the approved commit, false an unapproved ref, null no approved commit recorded.

warnings?array<string>

Human-readable warnings, e.g. newer unapproved commits on the branch, or that the ref is an unapproved source.

Example Request
curl -X POST 'https://www.p4a.ai/api/deployments' \  -H 'Content-Type: application/json' \  -d '{  "policyId": "2f5573e6-5ba4-48f2-a75d-df99c936463b",  "connectionId": "84b500d7-71c8-4b1f-adf4-f1eb0000973d",  "workspaceId": "ef0efa32-d1c1-43d4-a5e2-fe7b4f00403c",  "targetOrganizationIds": [    "string"  ]}'
Example Response
{  "results": [    {      "ok": true,      "organizationId": "string",      "organizationName": "string",      "error": "string",      "deployment": {        "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",        "status": "string",        "deduped": true      }    }  ],  "resolvedCommitSha": "string",  "resolvedImplementationCommitSha": "string",  "requestedRef": "string",  "approvedCommitSha": "string",  "approvedSource": true,  "warnings": [    "string"  ]}
POST/api/deployments/delete-failed

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Request Body

application/json
  1. body
policyId?string

Only delete failed deployments of this policy. Omit to clear all of yours.

Formatuuid

Response Body

How many failed deployments were deleted.

application/json
  1. response
deletedCount?integer
deletedDeploymentIds?array<string>
Example Request
curl -X POST 'https://www.p4a.ai/api/deployments/delete-failed' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "deletedCount": 0,  "deletedDeploymentIds": [    "string"  ]}
DELETE/api/deployments/{id}

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

The deleted deployment id.

application/json
  1. response
deletedDeploymentId?string
Example Request
curl -X DELETE 'https://www.p4a.ai/api/deployments/497f6eca-6276-4993-bfeb-53cbbbba6f08'
Example Response
{  "deletedDeploymentId": "string"}
POST/api/deployments/{id}/cancel

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

Success.

application/json
  1. response
ok?boolean
Example Request
curl -X POST 'https://www.p4a.ai/api/deployments/497f6eca-6276-4993-bfeb-53cbbbba6f08/cancel'
Example Response200
{  "ok": true}
POST/api/deployments/{id}/delete-release

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

The enqueued cleanup job, if one was created.

application/json
  1. response
job?|null
Example Request
curl -X POST 'https://www.p4a.ai/api/deployments/497f6eca-6276-4993-bfeb-53cbbbba6f08/delete-release'
Example Response201
{  "job": {}}
GET/api/deployments/{id}/dev-version

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

The DEV-version probe result.

application/json
  1. response
dev_version_exists?boolean|null
Example Request
curl -X GET 'https://www.p4a.ai/api/deployments/497f6eca-6276-4993-bfeb-53cbbbba6f08/dev-version'
Example Response
{  "dev_version_exists": true}
GET/api/deployments/{id}/history

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

The deployment's jobs and most-recent logs.

application/json
  1. response
jobs?array<>
job?|null
logs?array<>
Example Request
curl -X GET 'https://www.p4a.ai/api/deployments/497f6eca-6276-4993-bfeb-53cbbbba6f08/history'
Example Response200
{  "jobs": [    {}  ],  "job": {},  "logs": [    {}  ]}
GET/api/deployments/{id}/logs

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

A text/event-stream of log chunks.

response?stringtext/event-stream
Example Request
curl -X GET 'https://www.p4a.ai/api/deployments/497f6eca-6276-4993-bfeb-53cbbbba6f08/logs'
Example Response200
"string"
POST/api/deployments/{id}/sync

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

The reconciliation result.

application/json
  1. response
ok?boolean
result?string
Value in"in_sync""deleted""unknown"
status?string
Example Request
curl -X POST 'https://www.p4a.ai/api/deployments/497f6eca-6276-4993-bfeb-53cbbbba6f08/sync'
Example Response200
{  "ok": true,  "result": "in_sync",  "status": "string"}
POST/api/deployments/{id}/unpublish

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

The enqueued unpublish job, if one was created.

application/json
  1. response
job?|null
Example Request
curl -X POST 'https://www.p4a.ai/api/deployments/497f6eca-6276-4993-bfeb-53cbbbba6f08/unpublish'
Example Response201
{  "job": {}}

Connections

GET/api/connections

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Response Body

Your connections.

application/json
  1. response
connections?array<>
Example Request
curl -X GET 'https://www.p4a.ai/api/connections'
Example Response200
{  "connections": [    {      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "name": "string",      "host": "us",      "client_id": "string",      "organization_id": "string",      "disabled_at": "2019-08-24T14:15:22Z"    }  ]}
POST/api/connections

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Request Body

application/json
  1. body
host*string
Value in"us""eu""custom"
customDomain?|
Formaturi
clientId*string
Length4 <= length
clientSecret*string
Length4 <= length
organizationId*string
Length4 <= length
name*string
Length2 <= length <= 80

Response Body

The created connection and credential validation result.

application/json
  1. response
connection?
validation?
Example Request
curl -X POST 'https://www.p4a.ai/api/connections' \  -H 'Content-Type: application/json' \  -d '{  "host": "us",  "clientId": "string",  "clientSecret": "string",  "organizationId": "string",  "name": "string"}'
Example Response
{  "connection": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "name": "string",    "host": "us",    "client_id": "string",    "organization_id": "string",    "disabled_at": "2019-08-24T14:15:22Z"  },  "validation": {}}
GET/api/connections/{id}

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

The connection.

application/json
  1. response
connection?
is_owner?boolean
Example Request
curl -X GET 'https://www.p4a.ai/api/connections/497f6eca-6276-4993-bfeb-53cbbbba6f08'
Example Response
{  "connection": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "name": "string",    "host": "us",    "client_id": "string",    "organization_id": "string",    "disabled_at": "2019-08-24T14:15:22Z"  },  "is_owner": true}
PATCH/api/connections/{id}

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Request Body

application/json
  1. body

Credential fields (clientId, clientSecret, organizationId) are all-or-none.

name?string
host?string
Value in"us""eu""custom"
customDomain?|
Formaturi
clientId?string
Length4 <= length
clientSecret?string
Length4 <= length
organizationId?string
Length4 <= length

Response Body

The updated connection.

application/json
  1. response
connection?
Example Request
curl -X PATCH 'https://www.p4a.ai/api/connections/497f6eca-6276-4993-bfeb-53cbbbba6f08' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "connection": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "name": "string",    "host": "us",    "client_id": "string",    "organization_id": "string",    "disabled_at": "2019-08-24T14:15:22Z"  }}
DELETE/api/connections/{id}

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

Success.

application/json
  1. response
ok?boolean
Example Request
curl -X DELETE 'https://www.p4a.ai/api/connections/497f6eca-6276-4993-bfeb-53cbbbba6f08'
Example Response200
{  "ok": true}
POST/api/connections/{id}/sync

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

The connection, validation result, and deployment reconciliation summary.

application/json
  1. response
connection?
validation?
reconciliation?

Deployment reconciliation summary. null when credentials failed to validate or the probe sweep could not complete.

Example Request
curl -X POST 'https://www.p4a.ai/api/connections/497f6eca-6276-4993-bfeb-53cbbbba6f08/sync'
Example Response200
{  "connection": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "name": "string",    "host": "us",    "client_id": "string",    "organization_id": "string",    "disabled_at": "2019-08-24T14:15:22Z"  },  "validation": {},  "reconciliation": {    "in_sync": 0,    "unknown": 0,    "gone": [      {        "deployment_id": "6ef0ac85-9892-4664-a2a5-58bf2af5a8a6",        "policy_name": "string",        "version": "string",        "status": "published",        "mode": "publish"      }    ]  }}
GET/api/connections/{id}/orgs

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

The organizations visible through the connection.

application/json
  1. response
orgs?array<>
Example Request
curl -X GET 'https://www.p4a.ai/api/connections/497f6eca-6276-4993-bfeb-53cbbbba6f08/orgs'
Example Response200
{  "orgs": [    {      "id": "string",      "name": "string",      "isPrimary": true,      "fullPath": "string"    }  ]}
GET/api/connections/{id}/workspaces

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

The workspace shares for this connection.

application/json
  1. response
shared?array<>
Example Request
curl -X GET 'https://www.p4a.ai/api/connections/497f6eca-6276-4993-bfeb-53cbbbba6f08/workspaces'
Example Response200
{  "shared": [    {}  ]}
GET/api/connections/{id}/impact

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

Counts of dependents, for confirmation before deletion.

application/json
  1. response
active_deployments?integer
historical_deployments?integer
workspace_links?integer
has_credential?boolean
Example Request
curl -X GET 'https://www.p4a.ai/api/connections/497f6eca-6276-4993-bfeb-53cbbbba6f08/impact'
Example Response200
{  "active_deployments": 0,  "historical_deployments": 0,  "workspace_links": 0,  "has_credential": true}
POST/api/connections/validate

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Request Body

application/json
  1. body
host*string
Value in"us""eu""custom"
customDomain?|
Formaturi
clientId*string
Length4 <= length
clientSecret*string
Length4 <= length
organizationId*string
Length4 <= length

Response Body

Whether the credentials authenticate.

application/json
  1. response
ok?boolean
error?string
Example Request
curl -X POST 'https://www.p4a.ai/api/connections/validate' \  -H 'Content-Type: application/json' \  -d '{  "host": "us",  "clientId": "string",  "clientSecret": "string",  "organizationId": "string"}'
Example Response200
{  "ok": true,  "error": "string"}

Workspaces

GET/api/workspaces

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Response Body

The workspaces you belong to.

application/json
  1. response
memberships?array<>
Example Request
curl -X GET 'https://www.p4a.ai/api/workspaces'
Example Response200
{  "memberships": [    {}  ]}
POST/api/workspaces

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Request Body

application/json
  1. body
name*string
Length2 <= length <= 80
slug?string
Length2 <= length <= 48

Response Body

The created workspace.

application/json
  1. response
workspace?
Example Request
curl -X POST 'https://www.p4a.ai/api/workspaces' \  -H 'Content-Type: application/json' \  -d '{  "name": "string"}'
Example Response
{  "workspace": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "name": "string",    "slug": "string"  }}
GET/api/workspaces/{id}

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

The workspace and its related data.

application/json
  1. response
workspace?
role?string

The caller's role. Null for a platform admin who is not a member.

Value in"owner""admin""member"
is_admin?boolean
caller_id?string
Formatuuid
connections?array<>
connectionStats?

Live counters keyed by connection id.

installedPolicies?array<>

Unique policies live through the workspace's connections, newest deployment first.

installedRulesets?array<>

Unique rulesets live through the workspace's connections, newest deployment first.

members?array<>

Empty for a personal workspace.

Example Request
curl -X GET 'https://www.p4a.ai/api/workspaces/497f6eca-6276-4993-bfeb-53cbbbba6f08'
Example Response
{  "workspace": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "name": "string",    "slug": "string"  },  "role": "owner",  "is_admin": true,  "caller_id": "bc12a995-fda4-4e32-ba32-5851a0f06a0a",  "connections": [    {}  ],  "connectionStats": {    "property1": {      "deployments": 0,      "target_orgs": 0,      "live_policies": 0,      "ruleset_deployments": 0,      "ruleset_target_orgs": 0,      "live_rulesets": 0    },    "property2": {      "deployments": 0,      "target_orgs": 0,      "live_policies": 0,      "ruleset_deployments": 0,      "ruleset_target_orgs": 0,      "live_rulesets": 0    }  },  "installedPolicies": [    {      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "name": "string",      "category": "string",      "description": "string",      "pdk_version": "string",      "owner_name": "string",      "company": "string",      "submitted_by": "6703ac2f-9eb5-40e9-9fde-511b2dbf4be5",      "icon_url": "string",      "deploys_in_workspace": 0,      "latest_deployment_at": "2019-08-24T14:15:22Z"    }  ],  "installedRulesets": [    {      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "name": "string",      "category": "string",      "description": "string",      "target_scopes": [        "string"      ],      "owner_name": "string",      "company": "string",      "submitted_by": "6703ac2f-9eb5-40e9-9fde-511b2dbf4be5",      "icon_url": "string",      "deploys_in_workspace": 0,      "latest_deployment_at": "2019-08-24T14:15:22Z"    }  ],  "members": [    {}  ]}
PATCH/api/workspaces/{id}

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Request Body

application/json
  1. body
name*string
Length2 <= length <= 80

Response Body

The updated workspace.

application/json
  1. response
workspace?
Example Request
curl -X PATCH 'https://www.p4a.ai/api/workspaces/497f6eca-6276-4993-bfeb-53cbbbba6f08' \  -H 'Content-Type: application/json' \  -d '{  "name": "string"}'
Example Response
{  "workspace": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "name": "string",    "slug": "string"  }}
POST/api/workspaces/{id}/archive

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

The new archive timestamp.

application/json
  1. response
archived_at?string|null
Example Request
curl -X POST 'https://www.p4a.ai/api/workspaces/497f6eca-6276-4993-bfeb-53cbbbba6f08/archive'
Example Response200
{  "archived_at": "string"}
DELETE/api/workspaces/{id}/archive

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

The cleared archive timestamp.

application/json
  1. response
archived_at?string|null
Example Request
curl -X DELETE 'https://www.p4a.ai/api/workspaces/497f6eca-6276-4993-bfeb-53cbbbba6f08/archive'
Example Response200
{  "archived_at": "string"}
GET/api/workspaces/{id}/members

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

The members of the workspace.

application/json
  1. response
members?array<>
Example Request
curl -X GET 'https://www.p4a.ai/api/workspaces/497f6eca-6276-4993-bfeb-53cbbbba6f08/members'
Example Response200
{  "members": [    {}  ]}
POST/api/workspaces/{id}/members

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Request Body

application/json
  1. body
Properties2 <= properties
username?string

The invitee's @username (with or without a leading @).

email?string
Formatemail
role*string
Value in"admin""member"

Response Body

Success.

application/json
  1. response
ok?boolean
Example Request
curl -X POST 'https://www.p4a.ai/api/workspaces/497f6eca-6276-4993-bfeb-53cbbbba6f08/members' \  -H 'Content-Type: application/json' \  -d '{  "role": "admin"}'
Example Response201
{  "ok": true}
PATCH/api/workspaces/{id}/members/{userId}

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid
userId*string
Formatuuid

Request Body

application/json
  1. body
role?string
Value in"admin""member"
disabled?false
Value infalse

Response Body

Success.

application/json
  1. response
ok?boolean
Example Request
curl -X PATCH 'https://www.p4a.ai/api/workspaces/497f6eca-6276-4993-bfeb-53cbbbba6f08/members/497f6eca-6276-4993-bfeb-53cbbbba6f08' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response200
{  "ok": true}
DELETE/api/workspaces/{id}/members/{userId}

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid
userId*string
Formatuuid

Response Body

Success.

application/json
  1. response
ok?boolean
Example Request
curl -X DELETE 'https://www.p4a.ai/api/workspaces/497f6eca-6276-4993-bfeb-53cbbbba6f08/members/497f6eca-6276-4993-bfeb-53cbbbba6f08'
Example Response200
{  "ok": true}
GET/api/workspaces/{id}/members/{userId}/impact

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid
userId*string
Formatuuid

Response Body

Counts of resources owned or authored by the member.

application/json
  1. response
role?string
Value in"owner""admin""member"
disabled_at?string|null
owned_shared_connections?integer
deployments_authored?integer
Example Request
curl -X GET 'https://www.p4a.ai/api/workspaces/497f6eca-6276-4993-bfeb-53cbbbba6f08/members/497f6eca-6276-4993-bfeb-53cbbbba6f08/impact'
Example Response200
{  "role": "owner",  "disabled_at": "string",  "owned_shared_connections": 0,  "deployments_authored": 0}
POST/api/workspaces/{id}/connections

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Request Body

application/json
  1. body
connection_id*string
Formatuuid

Response Body

Success.

application/json
  1. response
ok?boolean
Example Request
curl -X POST 'https://www.p4a.ai/api/workspaces/497f6eca-6276-4993-bfeb-53cbbbba6f08/connections' \  -H 'Content-Type: application/json' \  -d '{  "connection_id": "d3547de1-d1f2-4344-b4c2-17169b7526f9"}'
Example Response201
{  "ok": true}
PATCH/api/workspaces/{id}/connections

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Request Body

application/json
  1. body
connection_id*string
Formatuuid
disabled?false
Value infalse

Response Body

Success.

application/json
  1. response
ok?boolean
Example Request
curl -X PATCH 'https://www.p4a.ai/api/workspaces/497f6eca-6276-4993-bfeb-53cbbbba6f08/connections' \  -H 'Content-Type: application/json' \  -d '{  "connection_id": "d3547de1-d1f2-4344-b4c2-17169b7526f9"}'
Example Response200
{  "ok": true}
DELETE/api/workspaces/{id}/connections

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Query Parameters

connection_id*string
Formatuuid

Response Body

Success.

application/json
  1. response
ok?boolean
Example Request
curl -X DELETE 'https://www.p4a.ai/api/workspaces/497f6eca-6276-4993-bfeb-53cbbbba6f08/connections?connection_id=497f6eca-6276-4993-bfeb-53cbbbba6f08'
Example Response200
{  "ok": true}
GET/api/workspaces/{id}/connections/{connectionId}/impact

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid
connectionId*string
Formatuuid

Response Body

Counts describing the shared connection's visibility and use.

application/json
  1. response
is_disabled?boolean
disabled_reason?string|null
members_visible?integer
deployments_authored?integer
Example Request
curl -X GET 'https://www.p4a.ai/api/workspaces/497f6eca-6276-4993-bfeb-53cbbbba6f08/connections/497f6eca-6276-4993-bfeb-53cbbbba6f08/impact'
Example Response200
{  "is_disabled": true,  "disabled_reason": "string",  "members_visible": 0,  "deployments_authored": 0}

Transfers

POST/api/policies/{id}/transfers

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Request Body

application/json
  1. body
Properties1 <= properties
recipientUsername?string

The recipient's @username (with or without a leading @).

recipientEmail?string
Formatemail

Response Body

The created transfer.

application/json
  1. response
transfer?
Example Request
curl -X POST 'https://www.p4a.ai/api/policies/497f6eca-6276-4993-bfeb-53cbbbba6f08/transfers' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response201
{  "transfer": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "to_user_id": "bdcaa974-8e23-4fc9-823d-e060850bbef1"  }}
POST/api/transfers/{id}/accept

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

The accepted transfer and the resource now owned.

application/json
  1. response
transfer?
resourceType?string
Value in"policy""idea""ruleset"
resourceId?string
Formatuuid
Example Request
curl -X POST 'https://www.p4a.ai/api/transfers/497f6eca-6276-4993-bfeb-53cbbbba6f08/accept'
Example Response200
{  "transfer": {},  "resourceType": "policy",  "resourceId": "026d60bb-63a8-407e-bf67-01dcfc6022e6"}
POST/api/transfers/{id}/cancel

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

The cancelled transfer.

application/json
  1. response
transfer?
Example Request
curl -X POST 'https://www.p4a.ai/api/transfers/497f6eca-6276-4993-bfeb-53cbbbba6f08/cancel'
Example Response200
{  "transfer": {}}
POST/api/transfers/{id}/reject

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Request Body

application/json
  1. body
feedback?string
Lengthlength <= 4000

Response Body

The rejected transfer.

application/json
  1. response
transfer?
Example Request
curl -X POST 'https://www.p4a.ai/api/transfers/497f6eca-6276-4993-bfeb-53cbbbba6f08/reject' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response200
{  "transfer": {}}

Tokens

GET/api/tokens

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Response Body

Your tokens (secrets are never returned).

application/json
  1. response
tokens?array<>
Example Request
curl -X GET 'https://www.p4a.ai/api/tokens'
Example Response200
{  "tokens": [    {      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "name": "string",      "token_prefix": "string",      "scopes": [        "api:read"      ],      "expires_at": "2019-08-24T14:15:22Z",      "last_used_at": "2019-08-24T14:15:22Z",      "revoked_at": "2019-08-24T14:15:22Z",      "created_at": "2019-08-24T14:15:22Z"    }  ]}
POST
/api/tokens

Authorization

cookieAuth
cookiesb-access-token<token>

A signed-in browser session cookie. Used only by POST /api/tokens, which mints new tokens and therefore rejects personal access tokens — a token cannot mint another token. This operation cannot be exercised from the interactive playground; create tokens from the dashboard Settings page.

Request Body

application/json
  1. body
name*string
Length1 <= length <= 100
scopes*array<>
Items1 <= items
expiresInDays?|
Value in3090365null

Response Body

The new token's secret (shown once) and its record.

application/json
  1. response
token?string
record?
Example Request
curl -X POST 'https://www.p4a.ai/api/tokens' \  -H 'Content-Type: application/json' \  -d '{  "name": "string",  "scopes": [    "api:read"  ]}'
Example Response
{  "token": "string",  "record": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "name": "string",    "token_prefix": "string",    "scopes": [      "api:read"    ],    "expires_at": "2019-08-24T14:15:22Z",    "last_used_at": "2019-08-24T14:15:22Z",    "revoked_at": "2019-08-24T14:15:22Z",    "created_at": "2019-08-24T14:15:22Z"  }}
DELETE/api/tokens/{id}

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Path Parameters

id*string

The resource's UUID.

Formatuuid

Response Body

The revoked token's record.

application/json
  1. response
ok?boolean
record?
Example Request
curl -X DELETE 'https://www.p4a.ai/api/tokens/497f6eca-6276-4993-bfeb-53cbbbba6f08'
Example Response200
{  "ok": true,  "record": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "name": "string",    "token_prefix": "string",    "scopes": [      "api:read"    ],    "expires_at": "2019-08-24T14:15:22Z",    "last_used_at": "2019-08-24T14:15:22Z",    "revoked_at": "2019-08-24T14:15:22Z",    "created_at": "2019-08-24T14:15:22Z"  }}

Account

GET/api/me

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Response Body

Your profile.

application/json
  1. response
user?
Example Request
curl -X GET 'https://www.p4a.ai/api/me'
Example Response200
{  "user": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "email": "user@example.com",    "company": "string",    "username": "string",    "bio": "string",    "linkedinUrl": "string",    "xUrl": "string",    "profileIsPublic": true,    "is_admin": true  }}
PATCH/api/me

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Request Body

application/json
  1. body
company?string
Length1 <= length <= 120
username?string

Your unique @-mention handle: 3–30 chars, lowercased, [a-z0-9] with internal _/- (no leading/trailing separator). Must be unique across all users.

Match^[a-z0-9][a-z0-9_-]{1,28}[a-z0-9]$
Length3 <= length <= 30
bio?|

Optional short public bio (1–1000 chars). Send null (or an empty string) to clear it. Only visible to others when profileIsPublic is true.

Lengthlength <= 1000
linkedinUrl?|

Optional LinkedIn profile URL. Must be an https:// link to linkedin.com (any country subdomain). Send null to clear. Only visible to others when profileIsPublic is true.

xUrl?|

Optional X / Twitter profile URL. Must be an https:// link to x.com or twitter.com. Send null to clear. Only visible to others when profileIsPublic is true.

profileIsPublic?boolean

Opt-in gate: when true, your bio and social links are exposed on your public profile (GET /api/users/{username}). Default false (private). Your name, company, and username are always public regardless.

Response Body

Your updated profile.

application/json
  1. response
user?
Example Request
curl -X PATCH 'https://www.p4a.ai/api/me' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "user": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "email": "user@example.com",    "company": "string",    "username": "string",    "bio": "string",    "linkedinUrl": "string",    "xUrl": "string",    "profileIsPublic": true,    "is_admin": true  }}
GET/api/me/transfers

Authorization

bearerAuth
headerAuthorizationBearer <p4a_<token>>

A personal access token, sent as Authorization: Bearer p4a_….

Query Parameters

role?string
Value in"recipient""initiator"

Response Body

Transfers where you are the recipient or initiator.

application/json
  1. response
transfers?array<>
Example Request
curl -X GET 'https://www.p4a.ai/api/me/transfers'
Example Response200
{  "transfers": [    {      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",      "resource_type": "policy",      "resource_id": "4d5215ed-38bb-48ed-879a-fdb9ca58522f",      "resource_name": "string",      "policy_id": "ee9b03e0-6495-427a-85a5-34444d24ae04",      "policy_name": "string",      "status": "string",      "feedback": "string",      "created_at": "2019-08-24T14:15:22Z",      "decided_at": "2019-08-24T14:15:22Z",      "expires_at": "2019-08-24T14:15:22Z",      "counterparty_name": "string",      "counterparty_email": "string",      "role": "recipient"    }  ]}

References

On this page