Skip to content
Access Policy

Add emails to access policy

Add email addresses or patterns to a Sign-In access policy.

POST /v1/org/{organizationId}/contexts/sign-in/{contextId}/policies/{accessPolicyId}/emails

Adds one or more email addresses or pattern rules (e.g. *@acme.com) to an access policy.

See Access Policy for the accepted email patterns and the family-wide error body.

ParameterInTypeRequiredDescription
organizationIdPathstringYesOrganization ID.
contextIdPathstringYesSign-In Context ID.
accessPolicyIdPathstringYesAccess policy UUID. Find it in the Context under Configuration → Access Policies.
x-auth-tokenHeaderstringYesContext API key.
emailsBodystring[]YesList of email addresses or patterns to add. Duplicates in the request or already in the policy are silently ignored; duplicates that match another rule produce a warnings entry in the response.

Request example

cURL
curl -X POST "$API_BASE_URL/v1/org/$ORG_ID/contexts/sign-in/$CTX_ID/policies/$POLICY_ID/emails" \
-H "x-auth-token: $NETGRAPH_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"emails": ["alice@acme.com", "*@external.example.com"]
}'
FieldTypeDescription
policyEmailsstring[]Complete list of emails now in the policy after the add.
warningsobject[]One entry per input email that was not added. Empty when all inputs were accepted.
warnings[].emailstringThe input email that triggered the warning.
warnings[].reasonstringWhy it was skipped. For a duplicate pattern this is "Pattern already exist in policy: <policy name>".

Response example

200
{
"policyEmails": [
"alice@acme.com",
"*@external.example.com",
"bob@acme.com"
],
"warnings": [
{ "email": "alice@acme.com", "reason": "Pattern already exist in policy: Staff" }
]
}

Next