Email domain policy admin

Package: agentrouter.billing.v1 Service: EmailDomainPolicyAdminService

Endpoints

List email domain policies

Changed in v0.9.0 (new features): Administrators can list, export, create, edit, deactivate and import email domain policies through the API. One import takes at most 100000 rows. The API answers only where bonus claims are on: ENABLE_BONUS_CLAIM is "true" on the management plane API and corporate login is off. Otherwise every call returns FAILED_PRECONDITION.

What it does: Returns one page of policies, the number of matches, and the counts of every policy.

Request fields:

FieldRequiredDescription
customer_idyesThe organization the caller reads as. Required. Every organization sees the same global list.
categorynoOnly policies of this category. UNSPECIFIED means every category.
is_activenoOnly active (true) or inactive (false) policies. Absent means both.
searchnoA case-insensitive substring of the domain, normalized domain or reason. At most 255 characters.
page_sizenoPage size, 1 to 100. 0 selects 10.
offsetnoNumber of matching policies to skip.

Response fields:

FieldRequiredDescription
policiesnoThe page, most recently changed first.
total_countnoNumber of policies that match the filters.
statsnoCounts of every policy, whatever the filters.
{"signatures":{"go":"c.EmailDomainPolicyAdmin().ListEmailDomainPolicies(ctx, \u0026billingv1.ListEmailDomainPoliciesRequest{...})","python":"client.emaildomainpolicyadmin.listemaildomainpolicies(...)","typescript":"client.emaildomainpolicyadmin.listemaildomainpolicies({...})","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/billing/email-domain-policies?customer_id=cust_01H...\" \\\n  -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"examples":{"go":"// No Go SDK wrapper for EmailDomainPolicyAdminService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for EmailDomainPolicyAdminService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for EmailDomainPolicyAdminService yet -- use the CLI or curl example below.","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/billing/email-domain-policies?customer_id=cust_01H...\" \\\n  -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"persona":"Admin","httpVerb":"GET","httpPath":"/v1/billing/email-domain-policies","slug":"list-email-domain-policies"}

Get an email domain policy

Changed in v0.9.0 (new features): Administrators can list, export, create, edit, deactivate and import email domain policies through the API. One import takes at most 100000 rows. The API answers only where bonus claims are on: ENABLE_BONUS_CLAIM is "true" on the management plane API and corporate login is off. Otherwise every call returns FAILED_PRECONDITION.

What it does: Returns one policy.

Request fields:

FieldRequiredDescription
customer_idyesThe organization the caller reads as. Required.
idyesUUID of the policy.

Response fields:

FieldRequiredDescription
policynoThe policy.
{"signatures":{"go":"c.EmailDomainPolicyAdmin().GetEmailDomainPolicy(ctx, \u0026billingv1.GetEmailDomainPolicyRequest{...})","python":"client.emaildomainpolicyadmin.getemaildomainpolicy(...)","typescript":"client.emaildomainpolicyadmin.getemaildomainpolicy({...})","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/billing/email-domain-policies/01H...?customer_id=cust_01H...\" \\\n  -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"examples":{"go":"// No Go SDK wrapper for EmailDomainPolicyAdminService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for EmailDomainPolicyAdminService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for EmailDomainPolicyAdminService yet -- use the CLI or curl example below.","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/billing/email-domain-policies/01H...?customer_id=cust_01H...\" \\\n  -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"persona":"Admin","httpVerb":"GET","httpPath":"/v1/billing/email-domain-policies/{id}","slug":"get-an-email-domain-policy"}

Export email domain policies

Changed in v0.9.0 (new features): Administrators can list, export, create, edit, deactivate and import email domain policies through the API. One import takes at most 100000 rows. The API answers only where bonus claims are on: ENABLE_BONUS_CLAIM is "true" on the management plane API and corporate login is off. Otherwise every call returns FAILED_PRECONDITION.

What it does: Returns every policy that matches the filters.

Request fields:

FieldRequiredDescription
customer_idyesThe organization the caller reads as. Required.
categorynoOnly policies of this category. UNSPECIFIED means every category.
is_activenoOnly active (true) or inactive (false) policies. Absent means both.
searchnoA case-insensitive substring of the domain, normalized domain or reason.

Response fields:

FieldRequiredDescription
policiesnoEvery matching policy, most recently changed first.
{"signatures":{"go":"c.EmailDomainPolicyAdmin().ExportEmailDomainPolicies(ctx, \u0026billingv1.ExportEmailDomainPoliciesRequest{...})","python":"client.emaildomainpolicyadmin.exportemaildomainpolicies(...)","typescript":"client.emaildomainpolicyadmin.exportemaildomainpolicies({...})","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/billing/email-domain-policies:export?customer_id=cust_01H...\" \\\n  -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"examples":{"go":"// No Go SDK wrapper for EmailDomainPolicyAdminService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for EmailDomainPolicyAdminService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for EmailDomainPolicyAdminService yet -- use the CLI or curl example below.","curl":"curl \"${AGENTROUTER_BASE_URL}/v1/billing/email-domain-policies:export?customer_id=cust_01H...\" \\\n  -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\""},"persona":"Admin","httpVerb":"GET","httpPath":"/v1/billing/email-domain-policies:export","slug":"export-email-domain-policies"}

Create an email domain policy

Changed in v0.9.0 (new features): Administrators can list, export, create, edit, deactivate and import email domain policies through the API. One import takes at most 100000 rows. The API answers only where bonus claims are on: ENABLE_BONUS_CLAIM is "true" on the management plane API and corporate login is off. Otherwise every call returns FAILED_PRECONDITION.

What it does: Adds a policy.

Request fields:

FieldRequiredDescription
customer_idyesMust be the deployment organization, unless the caller holds platform_bonus_claims_admin.
domainyesA host name, at most 255 characters. A domain that another policy holds, after normalization, returns ALREADY_EXISTS.
categoryyesHow bonus claims from this domain are treated.
reasonnoAt most 500 characters. Blank means no reason.
is_activenoAbsent means true.

Response fields:

FieldRequiredDescription
policynoThe new policy.
{"signatures":{"go":"c.EmailDomainPolicyAdmin().CreateEmailDomainPolicy(ctx, \u0026billingv1.CreateEmailDomainPolicyRequest{...})","python":"client.emaildomainpolicyadmin.createemaildomainpolicy(...)","typescript":"client.emaildomainpolicyadmin.createemaildomainpolicy({...})","curl":"curl -X POST \"${AGENTROUTER_BASE_URL}/v1/billing/email-domain-policies\" \\\n  -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"customer_id\": \"...\",\n    \"domain\": \"...\",\n    \"category\": \"...\",\n    \"reason\": \"...\",\n    \"is_active\": false\n  }'"},"examples":{"go":"// No Go SDK wrapper for EmailDomainPolicyAdminService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for EmailDomainPolicyAdminService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for EmailDomainPolicyAdminService yet -- use the CLI or curl example below.","curl":"curl -X POST \"${AGENTROUTER_BASE_URL}/v1/billing/email-domain-policies\" \\\n  -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"customer_id\": \"...\",\n    \"domain\": \"...\",\n    \"category\": \"...\",\n    \"reason\": \"...\",\n    \"is_active\": false\n  }'"},"persona":"Admin","httpVerb":"POST","httpPath":"/v1/billing/email-domain-policies","slug":"create-an-email-domain-policy"}

Update an email domain policy

Changed in v0.9.0 (new features): Administrators can list, export, create, edit, deactivate and import email domain policies through the API. One import takes at most 100000 rows. The API answers only where bonus claims are on: ENABLE_BONUS_CLAIM is "true" on the management plane API and corporate login is off. Otherwise every call returns FAILED_PRECONDITION.

What it does: Changes the fields the request sets.

Request fields:

FieldRequiredDescription
customer_idyesMust be the deployment organization, unless the caller holds platform_bonus_claims_admin.
idyesUUID of the policy.
domainnoEach field that is set is changed; at least one must be set. A change to domain, category, reason or is_active also sets last_reviewed_at to now, unless the request sets last_reviewed_at.
categorynoUNSPECIFIED leaves the category as it is.
reasonnoAn empty reason removes the reason.
is_activenoTurns the policy on or off.
last_reviewed_atnoWhen a person last reviewed the policy.

Response fields:

FieldRequiredDescription
policynoThe changed policy.
{"signatures":{"go":"c.EmailDomainPolicyAdmin().UpdateEmailDomainPolicy(ctx, \u0026billingv1.UpdateEmailDomainPolicyRequest{...})","python":"client.emaildomainpolicyadmin.updateemaildomainpolicy(...)","typescript":"client.emaildomainpolicyadmin.updateemaildomainpolicy({...})","curl":"curl -X PATCH \"${AGENTROUTER_BASE_URL}/v1/billing/email-domain-policies/01H...\" \\\n  -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"customer_id\": \"...\",\n    \"domain\": \"...\",\n    \"category\": \"...\",\n    \"reason\": \"...\",\n    \"is_active\": false,\n    \"last_reviewed_at\": {}\n  }'"},"examples":{"go":"// No Go SDK wrapper for EmailDomainPolicyAdminService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for EmailDomainPolicyAdminService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for EmailDomainPolicyAdminService yet -- use the CLI or curl example below.","curl":"curl -X PATCH \"${AGENTROUTER_BASE_URL}/v1/billing/email-domain-policies/01H...\" \\\n  -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"customer_id\": \"...\",\n    \"domain\": \"...\",\n    \"category\": \"...\",\n    \"reason\": \"...\",\n    \"is_active\": false,\n    \"last_reviewed_at\": {}\n  }'"},"persona":"Admin","httpVerb":"PATCH","httpPath":"/v1/billing/email-domain-policies/{id}","slug":"update-an-email-domain-policy"}

Deactivate an email domain policy

Changed in v0.9.0 (new features): Administrators can list, export, create, edit, deactivate and import email domain policies through the API. One import takes at most 100000 rows. The API answers only where bonus claims are on: ENABLE_BONUS_CLAIM is "true" on the management plane API and corporate login is off. Otherwise every call returns FAILED_PRECONDITION.

What it does: Stops a policy from applying. The policy is kept; UpdateEmailDomainPolicy with is_active=true turns it back on.

Request fields:

FieldRequiredDescription
customer_idyesMust be the deployment organization, unless the caller holds platform_bonus_claims_admin.
idyesUUID of the policy.

Response fields:

FieldRequiredDescription
policynoThe policy, now inactive.
{"signatures":{"go":"c.EmailDomainPolicyAdmin().DeactivateEmailDomainPolicy(ctx, \u0026billingv1.DeactivateEmailDomainPolicyRequest{...})","python":"client.emaildomainpolicyadmin.deactivateemaildomainpolicy(...)","typescript":"client.emaildomainpolicyadmin.deactivateemaildomainpolicy({...})","curl":"curl -X POST \"${AGENTROUTER_BASE_URL}/v1/billing/email-domain-policies/01H...:deactivate\" \\\n  -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"customer_id\": \"...\"\n  }'"},"examples":{"go":"// No Go SDK wrapper for EmailDomainPolicyAdminService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for EmailDomainPolicyAdminService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for EmailDomainPolicyAdminService yet -- use the CLI or curl example below.","curl":"curl -X POST \"${AGENTROUTER_BASE_URL}/v1/billing/email-domain-policies/01H...:deactivate\" \\\n  -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"customer_id\": \"...\"\n  }'"},"persona":"Admin","httpVerb":"POST","httpPath":"/v1/billing/email-domain-policies/{id}:deactivate","slug":"deactivate-an-email-domain-policy"}

Import email domain policies

Changed in v0.9.0 (new features): Administrators can list, export, create, edit, deactivate and import email domain policies through the API. One import takes at most 100000 rows. The API answers only where bonus claims are on: ENABLE_BONUS_CLAIM is "true" on the management plane API and corporate login is off. Otherwise every call returns FAILED_PRECONDITION.

What it does: Creates and updates policies from a file. Each valid row is written; each row that fails is reported, and the others still commit. validate_only previews the import and writes nothing. Requests up to 64 MiB are accepted.

Request fields:

FieldRequiredDescription
customer_idyesMust be the deployment organization, unless the caller holds platform_bonus_claims_admin.
rowsnoThe rows, at least one and at most 100000. A row whose domain a policy already holds updates that policy.
validate_onlynoWhen true, nothing is written and the response carries a preview.
preview_sample_limitnoThe number of sample rows of each kind in a preview. 0 selects 50; at most 1000.

Response fields:

FieldRequiredDescription
previewnoSet when validate_only was true.
resultnoSet when validate_only was false.
{"signatures":{"go":"c.EmailDomainPolicyAdmin().ImportEmailDomainPolicies(ctx, \u0026billingv1.ImportEmailDomainPoliciesRequest{...})","python":"client.emaildomainpolicyadmin.importemaildomainpolicies(...)","typescript":"client.emaildomainpolicyadmin.importemaildomainpolicies({...})","curl":"curl -X POST \"${AGENTROUTER_BASE_URL}/v1/billing/email-domain-policies:import\" \\\n  -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"customer_id\": \"...\",\n    \"rows\": [],\n    \"validate_only\": false,\n    \"preview_sample_limit\": 0\n  }'"},"examples":{"go":"// No Go SDK wrapper for EmailDomainPolicyAdminService yet -- use the CLI or curl example below.","python":"# No Python SDK wrapper for EmailDomainPolicyAdminService yet -- use the CLI or curl example below.","typescript":"// No TypeScript SDK wrapper for EmailDomainPolicyAdminService yet -- use the CLI or curl example below.","curl":"curl -X POST \"${AGENTROUTER_BASE_URL}/v1/billing/email-domain-policies:import\" \\\n  -H \"Authorization: Bearer ak-${AGENTROUTER_API_KEY}\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"customer_id\": \"...\",\n    \"rows\": [],\n    \"validate_only\": false,\n    \"preview_sample_limit\": 0\n  }'"},"persona":"Admin","httpVerb":"POST","httpPath":"/v1/billing/email-domain-policies:import","slug":"import-email-domain-policies"}