Logo
Akamai APIs API Documentation

Create a policy

POST https://{{host}}/script-management/v1/properties/:propertyId/hostnames/:hostname/network/:network/policies

Creates a new policy for the specified propertyId, hostname, and network. The policy request needs to include the spofConfig object or scriptConfig array item, but it can contain both. Only one policy can exist per hostname. A change to the spofConfig or scriptConfig overwrites the existing policy. If a policy already exists with the same spofConfig and scriptConfig, the API responds with a 409 error and displays the existing policy.

 

Body PARAM

Key Datatype Required Description 
accountSwitchKey
string (Optional) For customers who manage more than one account, this [runs the operation from another account](https://techdocs.akamai.com/developer/docs/manage-many-accounts-with-one-api-client). The Identity and Access Management API provides a [list of available account switch keys](https://techdocs.akamai.com/iam-api/reference/get-client-account-switch-keys).



HEADERS

Key Datatype Required Description 
Content-Type
string
Accept
string




RESPONSES

status Created

{ "activationTime": "2022-02-19T09:45:00.000Z", "policyNote": "First version for testing", "scriptConfig": [ { "action": "BLOCK", "item": "https://www.example.com/main.min.js", "type": "URL" }, { "action": "DEFER", "item": "https://www.example.com/analytics.js", "type": "URL" } ], "spofConfig": { "advancedSettings": { "maxSpofTimeoutInSecs": 20, "minSpofTimeoutInSecs": 6 }, "spofEnabled": true }, "versionId": "1" }



Curl
curl -X POST 'https://undefined/script-management/v1/properties/:propertyId/hostnames/:hostname/network/:network/policies?accountSwitchKey=' -H 'Content-Type: application/json' -H 'Accept: application/json' -d '{"policyNote":"First version for testing","scriptConfig":[{"action":"BLOCK","item":"https://www.example.com/main.min.js","type":"URL"},{"action":"DEFER","item":"https://www.example.com/analytics.js","type":"URL"}],"spofConfig":{"advancedSettings":{"maxSpofTimeoutInSecs":20,"minSpofTimeoutInSecs":6},"spofEnabled":true}}'

ENDPOINTS