API access

The UglyDMARC public API lets you manage domains, pull DMARC report data, and administer users and keys programmatically — authenticated with a scoped Bearer API key.

Requirements

API access is included on plans that list it (see Pricing). You create and manage keys from the app under Settings → API keys, or via the /v1/api-keys endpoints below using a key that holds the api-keys:write scope.

Base URL & versioning

All endpoints are served under a single version prefix:

https://api.uglydmarc.com/v1

A public health check is available at /health (no authentication).

Authentication

Every request (except /health) must send your API key as a Bearer token:

# keys look like: spf_live_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Authorization: Bearer spf_live_8f3a...d21c

Each key belongs to a single account and carries a fixed set of scopes (below). A missing or invalid/expired key returns 401; a valid key lacking the required scope returns 403.

Store keys securely

The full key value is shown once, at creation. Keep it in a secret manager — never commit it to source control or ship it in client-side code. If a key leaks, revoke it (DELETE /v1/api-keys/{id}) and issue a new one.

Scopes

Grant a key only the scopes it needs.

ScopeGrants
domains:readList and read domains, their config, and DAG status
domains:writeCreate, update, and delete domains
domains:dagTrigger a DAG (SPF flattening) rebuild for a domain
reports:readRead DMARC report data for a domain
users:readList and read users
users:writeInvite users, change roles, remove users
api-keys:readList API keys
api-keys:writeCreate and revoke API keys

Endpoints

All paths are relative to https://api.uglydmarc.com/v1.

Method & pathScopeDescription
GET /accountThe account this key belongs to
GET /domainsdomains:readList your domains
POST /domainsdomains:writeAdd a domain
GET /domains/{id}domains:readGet a domain
PUT /domains/{id}domains:writeUpdate a domain
DELETE /domains/{id}domains:writeRemove a domain
GET /domains/{id}/dagdomains:readGet the flattened SPF DAG / status for a domain
POST /domains/{id}/dag/rebuilddomains:dagTrigger a DAG rebuild (re-flatten the sender tree)
GET /domains/{id}/reportsreports:readDMARC report data for a domain
GET /usersusers:readList users
POST /users/inviteusers:writeInvite a user
GET /users/{id}users:readGet a user
PUT /users/{id}/rolesusers:writeReplace a user's roles
DELETE /users/{id}users:writeRemove a user
GET /api-keysapi-keys:readList API keys
POST /api-keysapi-keys:writeCreate an API key
DELETE /api-keys/{id}api-keys:writeRevoke an API key

Examples

List the domains on your account:

curl https://api.uglydmarc.com/v1/domains \
  -H "Authorization: Bearer spf_live_8f3a...d21c"

Pull DMARC report data for a domain:

curl https://api.uglydmarc.com/v1/domains/{id}/reports \
  -H "Authorization: Bearer spf_live_8f3a...d21c"

Add a domain:

curl -X POST https://api.uglydmarc.com/v1/domains \
  -H "Authorization: Bearer spf_live_8f3a...d21c" \
  -H "Content-Type: application/json" \
  -d '{"fqdn": "acme.com"}'

Force a re-flatten of a domain's SPF tree (e.g. after adding a vendor):

curl -X POST https://api.uglydmarc.com/v1/domains/{id}/dag/rebuild \
  -H "Authorization: Bearer spf_live_8f3a...d21c"

Errors

Errors return JSON with an error message and the appropriate status:

StatusMeaning
401 UnauthorizedMissing/malformed Authorization header, or invalid/expired key
403 ForbiddenThe key is valid but lacks the required scope
404 Not FoundThe resource doesn't exist or isn't on your account
400 Bad RequestMalformed request body or parameters

Tip

Scope keys narrowly — e.g. a reporting integration only needs domains:read + reports:read. Rotate keys periodically and revoke any you're not actively using.