canonical: https://jentic.com/apis/primitive.dev/primitive

# Primitive API

The Primitive API gives AI agents their own email: it receives mail at your verified domains, sends outbound messages and threaded replies, and pushes each inbound email to webhook endpoints or serverless functions. Inbound mail can be listed, searched with structured filters such as from, subject, has_attachment, and spam_score_lt, or ranked with keyword, semantic, or hybrid semantic search across received and sent mail. Around that core it manages domain claims and DNS verification, recipient routes, filter rules, wake schedules, scheduled and repeating sends, contacts and contact policy, agent connections and registries, and x402 payment challenges.

## For AI agents

Give your agent a working inbox: send mail, reply in-thread, wait for the reply to a sent message, and search received and sent mail by keyword or meaning. Inbound email can trigger webhooks or deployed functions.

## Scope

Does not run marketing campaigns, manage mailing list subscribers, or connect to existing Gmail or Outlook mailboxes. Use for sending, receiving, and searching email at your own Primitive domains only.

## Capabilities

- Send outbound email with from, to, subject, body_text or body_html, attachments, and an optional scheduled_at time
- Reply to an inbound email with threading headers and the Re: subject derived server-side
- Wait for the first threaded reply to a sent email instead of polling the inbox
- Search inbound mail by from, to, subject, body, has_attachment, and spam score, or run keyword, semantic, or hybrid search across received and sent mail
- Claim a domain, publish the returned dns_records, verify ownership, and run on-demand DNS health checks
- Deliver inbound email to webhook endpoints with signed Primitive-Signature headers, replay deliveries, or pull events without a public URL
- Deploy functions that run on inbound mail, bind them to recipient routes, and read their execution logs

## Use cases

### Agent with its own inbox

An AI agent that coordinates with people by email needs to send, wait, and read replies without a human mail client. Through Jentic the agent searches for 'send an email', calls sendEmail with from, to, and subject, then calls awaitReply on the sent email id to long-poll for the first threaded response, and reads it with getEmailReadable. The conversation stays threaded because Primitive derives In-Reply-To and References server-side when the agent replies.

Example prompt: POST /send-mail with from 'agent@example.dev', to 'jane@acme.com', and subject 'Invoice question', then GET `/sent-emails/{id}/reply` with wait true and summarise the reply

### Inbound email triggers

A support or operations workflow can react to every message that arrives at a domain. createEndpoint registers a webhook URL, optionally with rules, and each delivery is signed with a Primitive-Signature header carrying an HMAC-SHA256 of the timestamp and raw body. Failed deliveries show up in listDeliveries and can be replayed, and pullWebhookEvent lets a local process receive events with no public endpoint at all.

Example prompt: POST /endpoints with url 'https://example.dev/hooks/mail' and the target domain_id, then POST `/endpoints/{id}/test` to send a test webhook

### Searching mail history

An agent asked what a vendor said about a renewal can search instead of scanning every message. GET `/emails/search` filters inbound mail by from, subject, date_from, date_to, has_attachment, and spam_score_lt, while POST /semantic-search ranks both received and sent mail with keyword, semantic, or hybrid mode, so the agent finds the relevant thread even when the wording differs.

Example prompt: POST /semantic-search with query 'contract renewal terms' and mode 'hybrid', then GET `/threads/{id}` for the top result

### Custom domain setup

Before an agent can send and receive at a branded address, the domain has to be claimed and verified. addDomain returns the exact dns_records to publish, downloadDomainZoneFile produces an importable zone file, and verifyDomain plus checkDomainDns confirm the records are live, so setup can be scripted end to end.

Example prompt: POST /domains with domain 'mail.example.dev', publish the returned dns_records, then POST `/domains/{id}/verify` and POST `/domains/{id}/dns/check`

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | `/send-mail` | Send outbound email |
| POST | `/emails/{id}/reply` | Reply to an inbound email |
| GET | `/sent-emails/{id}/reply` | Get or wait for the reply to a sent email |
| GET | `/emails/search` | Search inbound emails |
| POST | `/semantic-search` | Semantic search across received and sent mail |
| POST | `/domains` | Claim a new domain |
| POST | `/endpoints` | Create a webhook endpoint |
| POST | `/functions` | Deploy a function |

## Key resources

- **Emails and sent emails** — Inbound mail at your domains and outbound sends, with replies, threads, attachments, and readable views
- **Domains** — Domain claims with dns_records, ownership verification, DNS health checks, and zone files
- **Endpoints and deliveries** — Webhook endpoints for inbound mail, signed deliveries, replay, and pull-based delivery
- **Functions** — Deployed code that runs on inbound mail, with routes, secrets, test runs, and logs
- **Agent connections and registries** — Address-bound agent keys, agent networks, contacts, contact policy, and published agent registries

## AI readiness

This API is usable in Jentic One now. Its AI-readiness score against Jentic's framework shows where it stands today and where improvements would make it even easier for agents to use.

- **Score:** 53 / 100
- **Maturity:** Foundational
- **Dimensions:**
  - Foundational Compliance: 73 / 100
  - Developer Experience & Jentic Compatibility: 65 / 100
  - AI-Readiness & Agent Experience: 52 / 100
  - Agent Usability: 43 / 100
  - Security: 38 / 100
  - AI Discoverability: 80 / 100
- **View full report:** https://jentic.com/apis/primitive.dev/primitive/scorecard
- **How the score is calculated:** https://docs.jentic.com/reference/api-readiness-framework/overview/
- **More about the dimensions:** https://docs.jentic.com/reference/api-readiness-framework/specification/#dimensional-model-overview

### Score it yourself

Every API in the directory is allowlisted, so you can re-score it with no key required.

- **Score your own API:** https://jentic.com/scorecard.md
- **Scoring CLI agent skill:** https://github.com/jentic/jentic-api-scorecard/blob/main/skills/jentic-api-scorecard/SKILL.md

```sh
npx @jentic/api-scorecard-cli score <openapi-url>
```

## Why Jentic

- **Setup:** Wiring Primitive by hand means handling three bearer token types, cursor pagination with a success, data, and meta envelope, Idempotency-Key headers on writes, and HMAC verification of signed webhook deliveries. Through Jentic you install once, import Primitive from the API Directory, store the token once, and your agent calls it.
- **Permission scoping:** Primitive puts resource ids in the URL path (`/domains/{id}`, `/emails/{id}`, `/functions/{id}`), so a rule can pin your agent to a specific domain or function for those operations. Outbound recipients travel in the /send-mail request body, so for sending, rules bound which operations your agent may call, not who it writes to. You choose the operations it may call, so destructive ones like deleteDomain or rotateWebhookSecret are not included unless you add them.
- **Credential handling:** Your Primitive token is stored once, encrypted, by your own Jentic One instance and injected into the Authorization header at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'send an email' or 'wait for a reply', and Jentic returns the matching Primitive operation with its input schema, so the agent finds sendEmail or awaitReply among the full surface without loading every operation up front.

## Related APIs

- **Resend** — Developer email sending API for transactional messages
- **Postmark Server API** — Transactional email delivery with inbound processing and bounce tracking
- **Nylas** — Connects to existing Gmail and Microsoft mailboxes, calendars, and contacts
- **MailSlurp** — Disposable test inboxes for checking email flows

## FAQ

### What authentication does the Primitive API use?

Per its OpenAPI spec, the Primitive API authenticates with a bearer token in the Authorization header: an organization API key (prim_), an OAuth access token (prim_oat_), or an address-bound agent connection key (pconn_). Raw email and attachment archive downloads also accept a signed token query parameter supplied in webhook payloads. Signup, CLI login, demo, discovery, templates, public notes, and health are public endpoints that need no credential. Through Jentic the token is held by your own instance and attached at call time.

### Can my agent wait for a reply to an email it sent with the Primitive API?

Yes. After POST /send-mail, call GET `/sent-emails/{id}/reply` with the sent email id. It returns the first threaded inbound reply, keyed by the inbound email's reply_to_sent_email_id, and with wait set it long-polls until a reply arrives or wait_timeout_ms passes, so the agent does not need its own search loop.

### What are the rate limits for the Primitive API?

The OpenAPI spec states that the v1 API allows 3000 requests per 60 seconds per Developer, Power, or Platinum organization, shared across API keys, OAuth tokens, and agent keys, and 120 requests per 60 seconds for Agent-tier organizations. A rejected request gets HTTP 429 with a Retry-After header, and outbound sends carry additional limits of their own.

### Is there a Primitive MCP server?

You don't need an MCP server to give your agent Primitive. Jentic connects it directly from the API Directory: import it, store your token once, and your agent discovers the send, reply, and search operations on demand instead of loading the full tool list into its context.

### How do I send an email through Jentic with the Primitive API?

Search Jentic for 'send an email', load the sendEmail operation, and execute it with from, to, and subject plus body_text or body_html. Set wait to true if the agent should see the first SMTP delivery outcome before continuing. To run it on your own infrastructure, install Jentic One from its GitHub repo.

### Can I limit what my agent is allowed to do with the Primitive API?

Yes. Write a rule that allows only searchEmails, getEmailReadable, and replyToEmail, so the agent can read and answer inbound mail but cannot send new messages to arbitrary recipients, rotate the webhook secret, or delete domains. Every call it makes is logged for review.

### How do I verify Primitive webhook signatures?

Each delivery carries a Primitive-Signature header of the form t=<unix-seconds>,v1=<hex>. Compute an HMAC-SHA256 over the timestamp, a period, and the raw request body using your account webhook secret, and compare it to the v1 value. GET `/account/webhook-secret` returns the secret and POST `/account/webhook-secret/rotate` replaces it.
