Deactivate Policy Rules
Deactivate existing unlocked policy rules for your enterprise. See the Guide.
-
To deactivate a policy rule, you first need to obtain the policy rule ID. You return all the policy rules for your enterprise. Identify the policy rule you want to deactivate and make note of the policy rule ID (the
idfield).Prerequisites:
-
Use the policy rule ID you obtained in the prior step to deactivate the policy rule. The deactivated policy enters a
PENDING_APPROVALstate for a brief period before becomingINACTIVE. -
If you configure an approval requirement for policy rules, you can't approve your own policy-rule changes -- another admin must approve them.
First, get the pending-approval ID by listing pending approvals (step 3.1). Then, use the pending-approval ID to approve the pending approval (step 3.2).
-
Check the status of the policy deactivation to confirm the policy is in the
INACTIVEstate.
// 1. Get Touchpoint and Policy Rule
export ENTERPRISE_ID="<YOUR_ENTERPRISE_ID>"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
curl -X GET \
"https://app.bitgo-test.com/api/policy/v1/enterprises/$ENTERPRISE_ID/rules" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN"
// 2. Deactivate Policy Rule
export ENTERPRISE_ID="<YOUR_ENTERPRISE_ID>"
export ID="<POLICY_RULE_ID>"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
curl -X DELETE \
"https://app.bitgo-test.com/api/policy/v1/enterprises/$ENTERPRISE_ID/rules/$ID" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN"
// 3.1 Get Pending-Approval ID
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
curl -X GET \
https://app.bitgo-test.com/api/v2/pendingApprovals \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ACCESS_TOKEN"
// 3.2 Approve Pending Approval
export APPROVAL_ID="<APPROVAL_ID>"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
export OTP="<YOUR_OTP>"
curl -X PUT \
https://app.bitgo-test.com/api/v2/pendingApprovals/$APPROVAL_ID \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d '{
"state": "approved",
"otp": "'"$OTP"'"
}'
// 4. View the Deactivated Policy (Optional)
export ENTERPRISE_ID="<YOUR_ENTERPRISE_ID>"
export ID="<POLICY_RULE_ID>"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
curl -X GET \
"https://app.bitgo-test.com/api/policy/v1/enterprises/$ENTERPRISE_ID/rules/$ID" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN"
// 1. Get Touchpoint and Policy Rule
// Use the REST API for this step (see cURL tab)
// 2. Deactivate Policy Rule
// Use the REST API for this step (see cURL tab)
// 3.1 Get Pending-Approval ID
// Use the REST API for this step (see cURL tab)
// 3.2 Approve Pending Approval
const baseCoin = this.bitgoSDK.coin(initialPendingApproval.coin);
const pendingApproval = await baseCoin.pendingApprovals().get({ id: initialPendingApproval.id });
const result = await pendingApproval.approve(params);
// 4. View the Deactivated Policy (Optional)
// Use the REST API for this step (see cURL tab)
// 1. Get Touchpoint and Policy Rule Response
{
"rules": [
{
"uniqueId": "a7add416-03ac-49d1-91b1-e4a6923f2713",
"id": "5e43e1b6-665d-4406-b59a-b9e1d2e9dfad",
"name": "Spending limit - require approval on withdrawals of more than 3 TBTC4",
"status": "ACTIVE",
"version": 2,
"adminOnly": false,
"touchpointId": "166082ab-9268-4369-996a-b4ac63f6f634",
"scopeId": "c8234a0f-7722-44d7-bedc-bfded7bd24a7",
"touchpointLabel": "Withdrawal",
"scopeLabel": "Wallet",
"clauses": [
{
"actions": [
{
"name": "approvals.customer.enterpriseUser",
"parameters": {
"userIds": ["62ab90e06dfda30007974f0a52a12995"],
"minRequired": "1",
"initiatorIsAllowedToApprove": false
}
}
],
"conditions": [
{
"name": "transfer.amount",
"parameters": {
"coin": "tbtc4",
"amount": "300000000",
"operator": ">"
}
}
]
}
],
"filteringConditions": [
{
"name": "wallet.ids",
"parameters": { "walletId": ["654ec786c07fe8dc0dcfe03916ec5bb0"] }
}
],
"locked": false,
"lockType": "LOCK_AFTER_DATE",
"lockDate": "2024-04-14T18:52:07.955224Z",
"createdDate": "2024-04-12T19:06:41.185719Z",
"modifiedDate": "2024-04-12T19:09:15.694581Z",
"enterpriseId": "62c5ae8174ac860007aff138a2d74df7",
"createdBy": "62ab90e06dfda30007974f0a52a12995",
"modifiedBy": "627ff9325a5c1b0007c05a40d15e1522",
"evaluationId": "75ba4f44-6560-46c5-9e3f-fc44ae7b8064"
}
],
"nextBatchPrevId": "2"
}
// 2. Deactivate Policy Rule Response
{
"uniqueId": "f889bb93-14fd-4629-b2d5-8cca07abbe74",
"id": "5e43e1b6-665d-4406-b59a-b9e1d2e9dfad",
"name": "Spending limit - require approval on withdrawals of more than 3 TBTC4",
"status": "PENDING_APPROVAL",
"adminOnly": false,
"touchpointId": "166082ab-9268-4369-996a-b4ac63f6f634",
"scopeId": "c8234a0f-7722-44d7-bedc-bfded7bd24a7",
"touchpointLabel": "Withdrawal",
"scopeLabel": "Wallet",
"clauses": [
{
"actions": [
{
"name": "approvals.customer.enterpriseUser",
"parameters": {
"userIds": ["62ab90e06dfda30007974f0a52a12995"],
"minRequired": "1",
"initiatorIsAllowedToApprove": false
}
}
],
"conditions": [
{
"name": "transfer.amount",
"parameters": {
"coin": "tbtc4",
"amount": "300000000",
"operator": ">"
}
}
]
}
],
"filteringConditions": [
{
"name": "wallet.ids",
"parameters": { "walletId": ["654ec786c07fe8dc0dcfe03916ec5bb0"] }
}
],
"locked": false,
"lockType": "LOCK_AFTER_DATE",
"lockDate": "2024-04-14T18:52:07.955224Z",
"createdDate": "2024-04-12T19:11:32.54600328Z",
"modifiedDate": "2024-04-12T19:11:32.655073Z",
"enterpriseId": "62c5ae8174ac860007aff138a2d74df7",
"createdBy": "62ab90e06dfda30007974f0a52a12995",
"modifiedBy": "62ab90e06dfda30007974f0a52a12995",
"evaluationId": "68c2b880-1415-49de-bf94-4494e638620b"
}
// 3.1 Get Pending-Approval ID Response
{
"pendingApprovals": [
{
"id": "66198764cade63a5c722ab96ec3b9814",
"wallet": "654ec786c07fe8dc0dcfe03916ec5bb0",
"enterprise": "62c5ae8174ac860007aff138a2d74df7",
"bitgoOrg": "BitGo Trust",
"creator": "62ab90e06dfda30007974f0a52a12995",
"createDate": "2024-04-12T19:11:32.833Z",
"info": {
"type": "genericRequest",
"genericRequest": {
"description": "Request to delete policy rule {policyRuleId}",
"anchors": [
{
"key": "policyRuleId",
"value": "a7add416-03ac-49d1-91b1-e4a6923f2713",
"anchorType": "policyRuleId"
}
],
"currentId": "a7add416-03ac-49d1-91b1-e4a6923f2713",
"proposedId": "f889bb93-14fd-4629-b2d5-8cca07abbe74",
"resourceType": "policyRule",
"changeType": "delete",
"metadata": {
"sharedId": "5e43e1b6-665d-4406-b59a-b9e1d2e9dfad",
"policyRuleName": "Spending limit - require approval on withdrawals of more than 3 TBTC4"
}
}
},
"approvers": [
"621d08a634ad8a0007fcddffd7c429cc",
"627ff9325a5c1b0007c05a40d15e1522"
],
"state": "pending",
"scope": "wallet",
"userIds": [
"62ab90e06dfda30007974f0a52a12995",
"621d08a634ad8a0007fcddffd7c429cc",
"627ff9325a5c1b0007c05a40d15e1522"
],
"approvalsRequired": 1,
"singleRunResults": [],
"resolvers": [],
"policyEvaluationId": "68c2b880-1415-49de-bf94-4494e638620b",
"actions": [
{
"id": "83ba3f95-a52a-4a52-9058-9b9f2b9914e5",
"status": "PENDING",
"name": "approvals.customer.walletAdmin",
"parameters": { "userIds": [] },
"resolvers": [],
"approvers": [
"621d08a634ad8a0007fcddffd7c429cc",
"627ff9325a5c1b0007c05a40d15e1522"
]
}
],
"resolutionOrder": [
{ "actions": ["83ba3f95-a52a-4a52-9058-9b9f2b9914e5"] }
]
}
]
}
// 3.2 Approve Pending Approval Response
{
"id": "66198764cade63a5c722ab96ec3b9814",
"wallet": "654ec786c07fe8dc0dcfe03916ec5bb0",
"enterprise": "62c5ae8174ac860007aff138a2d74df7",
"bitgoOrg": "BitGo Trust",
"creator": "62ab90e06dfda30007974f0a52a12995",
"createDate": "2024-04-12T19:11:32.833Z",
"approvedDate": "2024-04-12T19:13:34.045Z",
"info": {
"type": "genericRequest",
"genericRequest": {
"description": "Request to delete policy rule {policyRuleId}",
"anchors": [
{
"key": "policyRuleId",
"value": "a7add416-03ac-49d1-91b1-e4a6923f2713",
"anchorType": "policyRuleId"
}
],
"currentId": "a7add416-03ac-49d1-91b1-e4a6923f2713",
"proposedId": "f889bb93-14fd-4629-b2d5-8cca07abbe74",
"resourceType": "policyRule",
"changeType": "delete",
"metadata": {
"sharedId": "5e43e1b6-665d-4406-b59a-b9e1d2e9dfad",
"policyRuleName": "Spending limit - require approval on withdrawals of more than 3 TBTC4"
}
}
},
"approvers": [],
"state": "approved",
"scope": "wallet",
"userIds": [
"62ab90e06dfda30007974f0a52a12995",
"621d08a634ad8a0007fcddffd7c429cc",
"627ff9325a5c1b0007c05a40d15e1522"
],
"approvalsRequired": 1,
"singleRunResults": [],
"resolvers": [
{
"user": "627ff9325a5c1b0007c05a40d15e1522",
"date": "2024-04-12T19:13:33.878Z",
"resolutionType": "pending",
"resolutionAction": "approve"
}
],
"policyEvaluationId": "68c2b880-1415-49de-bf94-4494e638620b",
"actions": [
{
"id": "83ba3f95-a52a-4a52-9058-9b9f2b9914e5",
"status": "COMPLETE",
"name": "approvals.customer.walletAdmin",
"parameters": { "userIds": [] },
"resolvers": [
{
"user": "627ff9325a5c1b0007c05a40d15e1522",
"date": "2024-04-12T19:13:33.878Z",
"resolutionType": "pending",
"resolutionAction": "approve"
}
],
"approvers": ["621d08a634ad8a0007fcddffd7c429cc"]
}
],
"resolutionOrder": [{ "actions": ["83ba3f95-a52a-4a52-9058-9b9f2b9914e5"] }]
}
// 4. View the Deactivated Policy (Optional) Response
{
"uniqueId": "f889bb93-14fd-4629-b2d5-8cca07abbe74",
"id": "5e43e1b6-665d-4406-b59a-b9e1d2e9dfad",
"name": "Spending limit - require approval on withdrawals of more than 3 TBTC4",
"status": "INACTIVE",
"version": 3,
"adminOnly": false,
"touchpointId": "166082ab-9268-4369-996a-b4ac63f6f634",
"scopeId": "c8234a0f-7722-44d7-bedc-bfded7bd24a7",
"touchpointLabel": "Withdrawal",
"scopeLabel": "Wallet",
"clauses": [
{
"actions": [
{
"name": "approvals.customer.enterpriseUser",
"parameters": {
"userIds": ["62ab90e06dfda30007974f0a52a12995"],
"minRequired": "1",
"initiatorIsAllowedToApprove": false
}
}
],
"conditions": [
{
"name": "transfer.amount",
"parameters": {
"coin": "tbtc4",
"amount": "300000000",
"operator": ">"
}
}
]
}
],
"filteringConditions": [
{
"name": "wallet.ids",
"parameters": { "walletId": ["654ec786c07fe8dc0dcfe03916ec5bb0"] }
}
],
"locked": false,
"lockType": "LOCK_AFTER_DATE",
"lockDate": "2024-04-14T18:52:07.955224Z",
"createdDate": "2024-04-12T19:11:32.546003Z",
"modifiedDate": "2024-04-12T19:13:34.360531Z",
"enterpriseId": "62c5ae8174ac860007aff138a2d74df7",
"createdBy": "62ab90e06dfda30007974f0a52a12995",
"modifiedBy": "62ab90e06dfda30007974f0a52a12995",
"evaluationId": "68c2b880-1415-49de-bf94-4494e638620b"
}