Skip to content

Apply policy to a project

POST
/api/v1/projects/{projectId}/policies/{policyId}
curl --request POST \
--url https://localhost:10001/api/v1/projects/example/policies/example \
--header 'Authorization: <Authorization>' \
--header 'Content-Type: application/json' \
--data '{ "name": "example" }'

Link a policy to a specific project instance and return the created applied policy

projectId
required
string

Project ID, UUID (urn:uuid optional), or slug:my-project

policyId
required
string

Policy ID, slug:my-policy@1.2.0, or urn:cid:bafy…

Request body with policy name

Media type application/json
object
name
required
string
Example generated
{
"name": "example"
}

Created applied policy

Media type application/json

A policy applied to a project, tracked independently of the library template it came from

object
appliedAt
string format: date-time
appliedBy
string
appliedByDid

Verifiable actor; appliedBy is the label

string
archivedAt

Set via the archive endpoint

string format: date-time
archivedBy

Set via the archive endpoint

string
archivedByDid

Verifiable actor; archivedBy is the label

string
cid

Assigned by the integrity service

string
createdAt
string format: date-time
id
integer
isArchived

Set via the archive endpoint

boolean
isReapplied
boolean
name
string
policyId

Taken from the path on create

integer
projectId

Taken from the path on create

integer
slug

Derived from name

string
status
string
subjectCid

Assigned by the integrity service

string
updatedAt
string format: date-time
Example generated
{
"name": "example"
}

Bad request - Invalid project ID, policy ID, or request body

Media type application/json

Error body returned by the governance endpoints; the message is human-readable and not a stable identifier

object
error
string
Example
{
"error": "Invalid request body"
}

Unauthorized - Authentication required

Media type application/json

Error body returned by the governance endpoints; the message is human-readable and not a stable identifier

object
error
string
Example
{
"error": "Invalid request body"
}

Forbidden - No project access or insufficient permissions

Media type application/json

Error body returned by the governance endpoints; the message is human-readable and not a stable identifier

object
error
string
Example
{
"error": "Invalid request body"
}

Project or policy not found

Media type application/json

Error body returned by the governance endpoints; the message is human-readable and not a stable identifier

object
error
string
Example
{
"error": "Invalid request body"
}

Policy already applied to project

Media type application/json

Error body returned by the governance endpoints; the message is human-readable and not a stable identifier

object
error
string
Example
{
"error": "Invalid request body"
}

Internal server error

Media type application/json

Error body returned by the governance endpoints; the message is human-readable and not a stable identifier

object
error
string
Example
{
"error": "Invalid request body"
}