This article explains the steps to Approve/Revoke contracts applied to an API Instance using REST API.
Refer to the article "How To Retrieve Contract ID Applied To An API Instance" and follow the steps until Step 5 "Retrieve Contract ID"
Step 6:
a) Revoke Contract
Execute the below API call.
curl --location --request PATCH 'https://anypoint.mulesoft.com/apimanager/api/v1/organizations/{organizationId}/environments/{environmentId}/apis/{environmentApiId}/contracts/{contractId}' \
--header 'Authorization: Bearer AUTH_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"status": "REVOKED"
}'
Below is the output snippet from the above API call.
{"audit":{"created":{"date":"2022-01-07T13:34:33.588Z"},"updated":{"date":"2022-01-07T14:43:45.089Z"}},"masterOrganizationId":"{masterOrganizationId}}","organizationId":"{organizationId}}","id":2641059,"status":"REVOKED","approvedDate":"2022-01-07T14:43:20.181Z","rejectedDate":null,"revokedDate":"2022-01-07T14:43:45.089Z","applicationId":1188973,"application":{"audit":{"created":{"date":"2022-01-07T13:34:25.025Z"},"updated":{}},"masterOrganizationId":"{masterOrganizationId}}","id":1188973,"name":"Test_Contract","description":null,"clientProvider":{"providerId":null},"coreServicesId":"{coreServicesId}}","url":null,"grantTypes":[],"redirectUri":[],"clientId":"{clientId}}","clientSecret":"{clientSecret}}","owner":"{owner}}","email":"{email}}","owners":[{"id":"{id}}","createdAt":"2021-05-04T13:24:34.010Z","updatedAt":"2022-01-07T14:39:42.327Z","organizationId":"{organizationId}}","firstName":"{firstName}}","lastName":"{lastName}}","email":"{email}}","phoneNumber":"123456789","username":"{username}}","idprovider_id":"mulesoft","enabled":true,"deleted":false,"lastLogin":"2022-01-07T14:39:00.000Z","mfaVerificationExcluded":true,"mfaVerifiersConfigured":"false","isFederated":false,"roles":["{roles}}"],"type":"host"}]},"tierId":null,"tier":null,"requestedTierId":null,"requestedTier":null,"terms":null,"groupInstanceId":null,"groupInstance":null,"partyId":null,"partyName":null,"condition":"NOT_APPLIED","apiId":17010329,"api":{"audit":{"created":{},"updated":{}},"organizationId":"{organizationId}}","id":17010329}}
Note: Values in the above snippet output are masked. Use it as a reference only.
Contract status in API Manager :
b) Approve Contract
Execute the below API call.
curl --location --request PATCH 'https://anypoint.mulesoft.com/apimanager/api/v1/organizations/{organizationId}/environments/{environmentId}/apis/{environmentApiId}/contracts/{contractId}' \
--header 'Authorization: Bearer AUTH_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"status": "APPROVED", "condition": "ACTIVE"
}'
Below is the output snippet from the above API call.
{"audit":{"created":{"date":"2022-01-07T13:34:33.588Z"},"updated":{"date":"2022-01-07T14:57:15.409Z"}},"masterOrganizationId":"{masterOrganizationId}","organizationId":"{organizationId}","id":2641059,"status":"APPROVED","approvedDate":"2022-01-07T14:57:15.409Z","rejectedDate":null,"revokedDate":"2022-01-07T14:43:45.089Z","applicationId":1188973,"application":{"audit":{"created":{"date":"2022-01-07T13:34:25.025Z"},"updated":{}},"masterOrganizationId":"{masterOrganizationId}","id":1188973,"name":"Test_Contract","description":null,"clientProvider":{"providerId":null},"coreServicesId":"{coreServicesId}","url":null,"grantTypes":[],"redirectUri":[],"clientId":"{clientId}","clientSecret":"{clientSecret}","owner":"{owner}","email":"{email}","owners":[{"id":"{id}","createdAt":"2021-05-04T13:24:34.010Z","updatedAt":"2022-01-07T14:39:42.327Z","organizationId":"{organizationId}","firstName":"{firstName}","lastName":"{lastName}","email":"{email}","phoneNumber":"123456789","username":"{username}","idprovider_id":"mulesoft","enabled":true,"deleted":false,"lastLogin":"2022-01-07T14:39:00.000Z","mfaVerificationExcluded":true,"mfaVerifiersConfigured":"false","isFederated":false,"roles":["{roles}"],"type":"host"}]},"tierId":null,"tier":null,"requestedTierId":null,"requestedTier":null,"terms":null,"groupInstanceId":null,"groupInstance":null,"partyId":null,"partyName":null,"condition":"APPLIED","apiId":17010329,"api":{"audit":{"created":{},"updated":{}},"organizationId":"{organizationId}","id":17010329}}
Note: Values in the above snippet output are masked. Use it as a reference only.
001115212

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.