Create a Holder Policy
CURL
Endpoint:
/v1/{target}/policy-store-service-api/policies/add
| API Reference
Example Request
curl -X 'POST' \
'https://{orgID}.enterprise-sandbox.waltid.dev/v1/{target}/policy-store-service-api/policies/add' \
-H 'accept: */*' \
-H 'Authorization: Bearer {yourToken}' \
-H 'Content-Type: application/json' \
-d '{
"_id": "waltid.tenant1.policy-store1.policy1",
"policy": {
"priority": 1,
"description": "This policy checks for a name claim in the wallet and block the presentation if it exists.",
"direction": null,
"check": {
"type": "basic",
"claims_present": ["name"]
},
"action": "BLOCK"
}
}'
Path Parameters
orgID
: - When performing operations within an organization, it is essential to use the organization's Base URL or another valid host alias. For example, if your organization is namedtest
, your default Base URL will betest.enterprise-sandbox.walt.dev
when using the sandbox environment.target
: resourceIdentifier - The target indicates the organization + tenant + serviceId in which to create the new policy and the policy's ID ({organizationID}.{tenantID}.{PolicyStore}.[NewPolicyId]
), e.g.waltid.tenant1.policy-store1.policy1
- Body Parameters
_id
: policyId - The unique identifier for the policy, typically in the format{organizationID}.{tenantID}.{PolicyStore}.[NewPolicyId]
policy
: holderPolicy - The policy object containing:priority
: integer - The priority of the policy (lower numbers have higher priority).description
: string - A description of the policy.direction
: string - The direction of the policy, can benull
for no specific direction or "RECEIVE" | "PRESENT" for a specific direction.check
: holderPolicyCheck - The check to perform, which can be a basic check or a DCQL query.- For a basic check, use:
{ "type": "basic", "claims_present": ["claim1", "claim2"] }
- For a DCQL check, use:
{ "type": "dcql", "dcql_query": { "credentials": [ { "id": "example_jwt_vc", "format": "JWT_VC_JSON", "meta": { "type": "W3cCredentialMeta", "typeValues": [["OpenBadgeCredential", "VerifiableCredential"]] }, "claims": [ { "path": ["credentialSubject", "achievement"] } ] } ] } }
- For a basic check, use:
action
: string - The action to take if the check passes, eitherALLOW
orBLOCK
.
Response Codes
201
- Policy successfully created.
Last updated on July 21, 2025