curl --request GET \
--url https://api.anchorage-staging.com/v4/policies \
--header 'Api-Access-Key: <api-key>'import requests
url = "https://api.anchorage-staging.com/v4/policies"
headers = {"Api-Access-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'Api-Access-Key': '<api-key>'}};
fetch('https://api.anchorage-staging.com/v4/policies', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": [
{
"name": "<string>",
"target": {
"resourceType": "ACCOUNT",
"resourceIds": [
"3486b413-93d3-4447-afce-2b9c9dc34a32"
],
"actionTypes": [
"WITHDRAWAL"
]
},
"requiredActions": {
"description": "<string>",
"allOf": "<array>",
"anyOf": "<array>",
"approvals": {
"description": "<string>",
"approvalGroupId": "3486b413-93d3-4447-afce-2b9c9dc34a32",
"count": 2,
"allOf": "<array>",
"anyOf": "<array>"
},
"deny": true,
"allow": true,
"settings": {
"expiresIn": "P14D"
}
},
"description": "<string>",
"conditions": {
"description": "<string>",
"allOf": "<array>",
"anyOf": "<array>",
"not": "<unknown>",
"assetType": "BTC",
"amount": {
"minInclusive": "<string>"
},
"cumulativeAmount": {
"value": "<string>",
"period": "<string>"
}
},
"id": "3486b413-93d3-4447-afce-2b9c9dc34a32",
"status": "PENDING_APPROVAL",
"createdAt": "2019-01-02T12:34:56.000Z",
"archivedAt": "2019-01-02T12:34:56.000Z"
}
],
"page": {
"endCursor": "<string>"
},
"chain": [
"3486b413-93d3-4447-afce-2b9c9dc34a32"
]
}{
"message": "Missing required field 'amount'."
}{
"message": "Missing required field 'amount'."
}{
"message": "Missing required field 'amount'."
}{
"message": "Missing required field 'amount'."
}{
"message": "Missing required field 'amount'."
}Resolve applicable policies
Resolves the policies that apply to one resource: every policy whose target names resourceId,
plus — when resourceType is ACCOUNT — every policy naming one of its parent accounts up to the
root, since a root-level policy governs each account beneath it. The chain in the response lists
exactly the account ids that were matched, nearest first.
Both resourceType and resourceId are required. resourceType selects the family of policies
(the resourceType they were created with) and resourceId is matched against their resourceIds.
For every family other than ACCOUNT the id is the resource’s own id, except for policies governing
a creation action type (POLICY_CREATE, KEY_REGISTER, KEY_GROUP_CREATE): those are created with
the root account ids they govern as resourceIds, so they are resolved by passing their family as
resourceType (POLICY, KEY, or APPROVAL_GROUP) and a root account id as resourceId. The
account chain is expanded only for resourceType=ACCOUNT.
Only ACTIVE policies are returned unless status says otherwise. Results are ordered newest
first by createdAt, then by id, so a page walk with after is deterministic.
curl --request GET \
--url https://api.anchorage-staging.com/v4/policies \
--header 'Api-Access-Key: <api-key>'import requests
url = "https://api.anchorage-staging.com/v4/policies"
headers = {"Api-Access-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'Api-Access-Key': '<api-key>'}};
fetch('https://api.anchorage-staging.com/v4/policies', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": [
{
"name": "<string>",
"target": {
"resourceType": "ACCOUNT",
"resourceIds": [
"3486b413-93d3-4447-afce-2b9c9dc34a32"
],
"actionTypes": [
"WITHDRAWAL"
]
},
"requiredActions": {
"description": "<string>",
"allOf": "<array>",
"anyOf": "<array>",
"approvals": {
"description": "<string>",
"approvalGroupId": "3486b413-93d3-4447-afce-2b9c9dc34a32",
"count": 2,
"allOf": "<array>",
"anyOf": "<array>"
},
"deny": true,
"allow": true,
"settings": {
"expiresIn": "P14D"
}
},
"description": "<string>",
"conditions": {
"description": "<string>",
"allOf": "<array>",
"anyOf": "<array>",
"not": "<unknown>",
"assetType": "BTC",
"amount": {
"minInclusive": "<string>"
},
"cumulativeAmount": {
"value": "<string>",
"period": "<string>"
}
},
"id": "3486b413-93d3-4447-afce-2b9c9dc34a32",
"status": "PENDING_APPROVAL",
"createdAt": "2019-01-02T12:34:56.000Z",
"archivedAt": "2019-01-02T12:34:56.000Z"
}
],
"page": {
"endCursor": "<string>"
},
"chain": [
"3486b413-93d3-4447-afce-2b9c9dc34a32"
]
}{
"message": "Missing required field 'amount'."
}{
"message": "Missing required field 'amount'."
}{
"message": "Missing required field 'amount'."
}{
"message": "Missing required field 'amount'."
}{
"message": "Missing required field 'amount'."
}Query Parameters
Which namespace resourceId belongs to, and which family of policies to return.
Which namespace a resource id belongs to, and which family of action types that resource
participates in:
ACCOUNT— transaction action types (WITHDRAWAL,DEPOSIT) and trusted-destination action types (TRUSTED_DESTINATION_ADD,TRUSTED_DESTINATION_REMOVE). A trusted destination is added to or removed from an account, so such a policy scopes to an account, to any account above it, or to the organization — never to an individual destination.POLICY— policy-governance action types (POLICY_CREATE,POLICY_ARCHIVE).KEY— approval-key-governance action types (KEY_REGISTER,KEY_ARCHIVE).APPROVAL_GROUP— approval-group-governance action types (KEY_GROUP_CREATE,KEY_GROUP_ARCHIVE).
For the creation action types (POLICY_CREATE, KEY_REGISTER, KEY_GROUP_CREATE) there is no
resource yet, so a policy's resourceIds are the root account ids it governs even though its
resourceType names the family being created.
ACCOUNT, POLICY, KEY, APPROVAL_GROUP The resource of resourceType to resolve policies for, in canonical lowercase hyphenated UUID form (any other spelling is rejected with 400). For ACCOUNT, its parent chain is matched as well; for a creation action type's family, the root account id.
A UUID in canonical lowercase hyphenated form.
^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"3486b413-93d3-4447-afce-2b9c9dc34a32"
Response
Success
The resource followed by each of its parent accounts, nearest first. Present only when the query supplied a resourceId, and only for resourceType ACCOUNT — the other resource types have no parent chain. Describes the query rather than the page, so it repeats identically on every page.
Was this page helpful?