How to Create Authentication Policies via the API?

Hello,

I would like to use the API to create authentication policies, but I can’t find where this is mentioned in the API documentation.

I can do it via the web application at the following URL: https://xxx-xxxxx-admin.okta.com/admin/authn/authentication-policies.

Authentication Policies can be created via the Policies endpoint. When you create your policy, make sure you set its type to ACCESS_POLICY

Our Policy Postman collection contains a sample of this request, as does our API docs. For reference, here’s the curl for the sample request from our API docs to get your started

curl -i -X POST \
  https://subdomain.okta.com/api/v1/policies \
  -H 'Authorization: YOUR_API_KEY_HERE' \
  -H 'Content-Type: application/json' \
  -d '{
    "description": null,
    "name": "string",
    "priority": 1,
    "status": "ACTIVE",
    "system": false,
    "type": "ACCESS_POLICY",
    "conditions": null,
    "_embedded": {
      "resourceType": "string",
      "property1": {},
      "property2": {}
    }
  }'