Agents

Mailrith supports OAuth directory connections for ChatGPT, Codex, and Claude, plus a compact discovery stack with llms files, API metadata, OpenAPI, authenticated capabilities, SDKs, and MCP entry points.

6 min read

Use a Deterministic Discovery Flow

Configure AI agents and automation runtimes to discover Mailrith's current public API instead of guessing the API shape from memory.

Start with unauthenticated discovery so the runtime can learn what Mailrith exposes without a secret. After OAuth or a workspace API key is available, call authenticated capability discovery so the agent knows exactly what the credential can do in that workspace right now.

Use this order: read llms.txt, inspect /.well-known/api-catalog, inspect GET /v1, load GET /v1/openapi.json, then call GET /v1/capabilities with the target workspace credential before choosing REST, an official SDK, or the MCP server.

Mailrith checks these entry points after deployments and every five minutes. Read /.well-known/agent-status.json for the current contract version, monitored services, and monitoring link.

  1. Read https://mailrith.com/llms.txt for the compact integration index.
  2. Read https://mailrith.com/llms-full.txt when the agent needs detailed workflow guidance.
  3. Read https://mailrith.com/.well-known/api-catalog when the runtime supports well-known API discovery.
  4. Read https://mailrith.com/.well-known/agent-status.json for the monitored API and MCP entry points.
  5. Call GET /v1 to confirm the API version metadata.
  6. Load GET /v1/openapi.json so the agent has exact request and response schemas.
  7. Complete OAuth or provide a workspace API key only after the agent knows what action it needs to perform.
  8. Call GET /v1/capabilities with that credential to confirm workspace-specific access.
  9. Choose REST, SDKs, or MCP Server based on the runtime and risk level.
  • Read /llms.txt for the compact agent-oriented index.
  • Read /llms-full.txt when the agent needs workflow guidance and current public API boundaries.
  • Use /.well-known/api-catalog, /.well-known/agent-status.json, /.well-known/oauth-authorization-server, /.well-known/oauth-protected-resource, and /.well-known/mcp/server-card.json when an agent platform discovers integrations from the marketing domain.
  • Call /v1/capabilities after authentication to confirm the resource operations currently available to the credential.
  • Prefer capability discovery over a hard-coded allowlist when you decide which tools the agent may call.

Machine-Readable Entry Points

Mailrith publishes human-readable and machine-readable entry points. Use the lighter files for orientation. Use the OpenAPI document when the integration needs exact request and response schemas.

/.well-known/api-catalog points agents from the marketing site to the API contract, docs, and monitored status. GET /v1 is a compact version metadata endpoint. GET /v1/openapi.json is the full schema contract. GET /v1/capabilities is authenticated and returns only operations currently available to the credential in its workspace.

Capability discovery accounts for the credential's Permissions, the current plan, workspace limits, email delivery readiness, and rollout state. When a workspace prerequisite blocks an otherwise authorized operation, limitations explains what is missing and can include a setup link.

Unauthenticated Discovery
curl https://mailrith.com/llms.txt
curl https://mailrith.com/llms-full.txt
curl https://mailrith.com/.well-known/api-catalog
curl https://mailrith.com/.well-known/agent-status.json
curl https://mailrith.com/.well-known/mcp/server-card.json
curl https://api.mailrith.com/v1
curl https://api.mailrith.com/v1/openapi.json
Authenticated Capability Discovery
curl https://api.mailrith.com/v1/capabilities \
  -H "Authorization: Bearer mrk_example_secret_key"

Current Agent-Safe Tasks

The current public /v1 API supports practical agent work, but you should limit each agent to the tools needed for its task. A Subscriber-reporting agent does not need the Broadcasts Work Profile or broadcasts:write.

Mailrith supports Subscriber sync, Form and Segment inspection, Broadcast, Sequence, and Automation management, secure Email Delivery Connection setup, webhook subscriptions, and async import or export orchestration through public operations.

Mailrith uses API key and OAuth resource permissions as the authorization boundary. A write permission covers every public write operation for that resource. Bulk Subscriber import and export remain separate permissions because they move large datasets.

  • Inspect the authenticated workspace, subscribers, tags, custom fields, segments, forms, and landing pages.
  • Search MCP operations with ordinary task language, then load the exact schema for the selected operation.
  • List canonical email, Form, and Landing Page starting-point metadata, load one full starting point on demand, and create the matching workspace object by ID.
  • Create and manage drafts or definitions for email templates, sequences, automations, magic links, broadcasts, and webhook subscriptions.
  • Start a short-lived Email Delivery Connection setup, let the signed-in user enter provider credentials in Mailrith, check pending, failed, completed, or expired status, and renew an incomplete link without rebuilding its non-secret context.
  • Queue subscriber import and export jobs, then react to job updates through signed developer webhooks or deliberate polling.
  • Grant only the resources a workflow needs, then confirm results from the changed resource or progress endpoint.
GET /v1/workspace

Get the current workspace

Returns the authenticated workspace profile and mailing context used by broadcasts, sequences, automations, forms, and magic links.

View Schema
GET /v1/subscribers

List subscribers

Returns subscribers in the authenticated workspace, sorted from newest to oldest.

View Schema
POST /v1/subscribers

Create or upsert a subscriber

Creates a new subscriber when the email does not exist in the workspace. If the email already exists, the API updates the existing subscriber unless create_only is true.

View Schema
GET /v1/subscribers/{subscriber_id}

Get a subscriber

Returns one Subscriber by its stable identifier from the authenticated workspace.

View Schema
PATCH /v1/subscribers/{subscriber_id}

Update a subscriber

Updates profile fields, status, custom fields, tags, or sequence assignments for one subscriber. Fields omitted from the request stay unchanged. Blank optional custom field values also leave saved values unchanged, and filled-in invalid values are rejected.

View Schema
DELETE /v1/subscribers/{subscriber_id}

Delete a subscriber

Permanently removes one Subscriber and their Mailrith activity history from the authenticated workspace.

View Schema
PUT /v1/subscribers/{subscriber_id}/sequences/{sequence_id}

Add a subscriber to a sequence

Adds the selected subscriber to the selected sequence. If the subscriber is already in the sequence, the API returns the subscriber unchanged.

View Schema
DELETE /v1/subscribers/{subscriber_id}/sequences/{sequence_id}

Remove a subscriber from a sequence

Removes the selected subscriber from the selected sequence. If the subscriber is not in the sequence, the API returns the subscriber unchanged.

View Schema
PUT /v1/subscribers/{subscriber_id}/status

Change Subscriber sending eligibility

Changes the delivery status for one Subscriber without changing profile, targeting, or Sequence enrollment fields. Making a Subscriber Active requires consent_evidence; its collected_at value must include the correct UTC offset and must not be later than Mailrith's server time.

View Schema
PUT /v1/subscribers/{subscriber_id}/tags/{tag_id}

Add a Tag to a Subscriber

Adds the selected Tag to a Subscriber. If the Subscriber already has the Tag, the API returns the Subscriber unchanged.

View Schema
DELETE /v1/subscribers/{subscriber_id}/tags/{tag_id}

Remove a tag from a subscriber

Removes the selected tag from a subscriber. If the subscriber does not have the tag, the API returns the subscriber unchanged.

View Schema
GET /v1/tags

List tags

Returns tags in the authenticated workspace.

View Schema
POST /v1/tags

Create a tag

Creates a new tag in the authenticated workspace. The GDPR consent tag names can be created and applied like other tags when you need to apply consent collected outside Mailrith. Tag-level double opt-in fields are no longer accepted; configure double opt-in on forms and landing pages instead.

View Schema
GET /v1/tags/{tag_id}

Get a tag

Returns one Tag from the authenticated workspace.

View Schema
PUT /v1/tags/{tag_id}

Update a tag

Changes the name and description of one Tag in the authenticated workspace.

View Schema
DELETE /v1/tags/{tag_id}

Delete a tag

Permanently removes one Tag when no saved Mailrith resource references it.

View Schema
GET /v1/custom-fields

List custom fields

Returns a bounded page of custom fields in the authenticated workspace, including each field's exact ready-to-use email personalization token.

View Schema
POST /v1/custom-fields

Create a custom field

Creates a workspace-scoped custom-field definition.

View Schema
GET /v1/custom-fields/{custom_field_id}

Get a custom field

Returns one custom field from the authenticated workspace, including its exact ready-to-use email personalization token.

View Schema
PUT /v1/custom-fields/{custom_field_id}

Update a custom field

Updates a custom-field definition for the authenticated workspace.

View Schema
DELETE /v1/custom-fields/{custom_field_id}

Delete a custom field

Deletes a custom-field definition from the authenticated workspace.

View Schema
GET /v1/email-templates

List email templates

Returns reusable email templates linked to the authenticated workspace.

View Schema
POST /v1/email-templates

Create an email template

Creates a reusable email template scoped to the authenticated workspace.

View Schema
GET /v1/email-templates/{template_id}

Get an email template

Returns a reusable email template linked to the authenticated workspace.

View Schema
PUT /v1/email-templates/{template_id}

Update an email template

Updates the content or enabled state of an existing email template.

View Schema
DELETE /v1/email-templates/{template_id}

Delete an email template

Deletes an existing email template linked to the authenticated workspace.

View Schema
POST /v1/email-templates/{template_id}/preview

Preview an email template for a Subscriber

Renders one template using a saved Subscriber's name, email, and custom fields without sending or saving anything.

View Schema
GET /v1/forms

List forms

Returns forms from the authenticated workspace.

View Schema
POST /v1/forms

Create a form

Creates a form in the authenticated workspace.

View Schema
GET /v1/forms/{form_id}

Get a form

Returns a form from the authenticated workspace.

View Schema
PUT /v1/forms/{form_id}

Update a form

Updates an existing form without creating a new form.

View Schema
DELETE /v1/forms/{form_id}

Delete a form

Deletes a form from the authenticated workspace.

View Schema
POST /v1/forms/{form_id}/double-opt-in-preview

Preview a form confirmation email for a Subscriber

Renders the configured double opt-in email for a saved Subscriber without sending or saving anything.

View Schema
GET /v1/forms/{form_id}/submissions

List form submissions

Returns a bounded cursor page of retained submissions for one Form, including the Subscriber who submitted it.

View Schema
GET /v1/forms/{form_id}/submissions/{submission_id}

Get a form submission

Returns one retained Form submission by stable identifier.

View Schema
GET /v1/sequences

List sequences

Returns sequences in the authenticated workspace.

View Schema
POST /v1/sequences

Create a sequence

Creates a sequence in the authenticated workspace.

View Schema
GET /v1/sequences/{sequence_id}

Get a sequence

Returns one sequence from the authenticated workspace.

View Schema
PUT /v1/sequences/{sequence_id}

Update a sequence

Updates an existing paused Sequence. Before changing a running Sequence, read it by ID, retain its status in the current task only, pause it, apply the update, and use bounded direct item reads until is_updating is false. Run preflight, return it to running only if it was running before and preflight passes, and verify the final status. If the update fails before changing the Sequence, restore its prior running status when preflight passes. If readiness or the prior status cannot be restored, leave it paused and immediately report the failure; never activate a Sequence that was not already running.

View Schema
DELETE /v1/sequences/{sequence_id}

Delete a sequence

Deletes an existing sequence from the authenticated workspace.

View Schema
GET /v1/sequences/{sequence_id}/journey-preview

Preview a sequence journey

Returns the bounded saved email timeline and shows which messages a selected Subscriber is eligible to receive, without enrolling the Subscriber or sending email.

View Schema
GET /v1/sequences/{sequence_id}/preflight

Check sequence readiness

Checks the saved Sequence, its published emails, and its email delivery connection without changing data or sending email.

View Schema
PUT /v1/sequences/{sequence_id}/status

Activate or pause a sequence

Starts or pauses one Sequence without changing its content or delivery settings.

View Schema
POST /v1/sequences/{sequence_id}/test

Send sequence test messages

Sends up to five selected saved Sequence emails to one explicit test address. This does not enroll a Subscriber, start the Sequence, or write delivery activity.

View Schema
GET /v1/automations

List automations

Returns automations in the authenticated workspace.

View Schema
POST /v1/automations

Create an automation

Creates an automation in the authenticated workspace.

View Schema
GET /v1/automations/{automation_id}

Get an automation

Returns one automation from the authenticated workspace.

View Schema
PUT /v1/automations/{automation_id}

Update an automation

Updates an existing draft or paused Automation. Before changing a running Automation, read it by ID, retain its status in the current task only, pause it, apply the update, and use bounded direct item reads until is_updating is false. Run preflight, return it to running only if it was running before and preflight passes, and verify the final status. If the update fails before changing the Automation, restore its prior running status when preflight passes. If readiness or the prior status cannot be restored, leave it paused and immediately report the failure; never activate an Automation that was not already running.

View Schema
DELETE /v1/automations/{automation_id}

Delete an automation

Deletes an automation from the authenticated workspace.

View Schema
GET /v1/automations/{automation_id}/journey-preview

Preview an automation journey

Shows the bounded path a selected Subscriber would take through the current saved conditions without running actions or writing history.

View Schema
GET /v1/automations/{automation_id}/preflight

Check automation readiness

Checks the saved Automation definition and email delivery prerequisite without running any action.

View Schema
PUT /v1/automations/{automation_id}/status

Change an automation status

Starts, pauses, or returns one Automation to draft without changing its definition.

View Schema
POST /v1/automations/{automation_id}/test

Send automation test messages

Sends up to five selected saved Automation email steps to one explicit test address. This does not start the Automation or run other actions.

View Schema
GET /v1/magic-links

List magic links

Returns magic links in the authenticated workspace.

View Schema
POST /v1/magic-links

Create a magic link

Creates a magic link in the authenticated workspace.

View Schema
GET /v1/magic-links/{magic_link_id}

Get a magic link

Returns one magic link from the authenticated workspace.

View Schema
PUT /v1/magic-links/{magic_link_id}

Update a magic link

Updates an existing magic link.

View Schema
DELETE /v1/magic-links/{magic_link_id}

Delete a magic link

Deletes a magic link from the authenticated workspace.

View Schema
GET /v1/broadcasts

List broadcasts

Returns broadcast drafts, scheduled sends, active sends, and completed sends.

View Schema
POST /v1/broadcasts

Create a broadcast

Creates a broadcast draft in the authenticated workspace.

View Schema
GET /v1/broadcasts/{broadcast_id}

Get a broadcast

Returns a broadcast draft, scheduled send, active send, or completed send.

View Schema
PUT /v1/broadcasts/{broadcast_id}

Update a broadcast

Updates an existing Broadcast draft. Scheduled, running, completed, and failed Broadcasts cannot be changed here. Before changing a scheduled Broadcast, read it by ID and retain its scheduled_at in the current task only. If the saved time is no longer safely in the future, ask the user for a new time before unscheduling. Otherwise unschedule it, apply the update, reschedule it for the same time, and verify both status and scheduled_at. If the update fails after unscheduling, restore the unchanged Broadcast to the same future time when possible. If the schedule cannot be restored, leave it as a Draft and immediately report that it will not send; never choose a replacement time without the user.

View Schema
DELETE /v1/broadcasts/{broadcast_id}

Delete a broadcast

Deletes a draft, scheduled, or failed broadcast from the authenticated workspace. Broadcasts cannot be deleted after they start sending.

View Schema
POST /v1/broadcasts/{broadcast_id}/cancel

Cancel a broadcast send

Requests cancellation for delivery work that has not reached the provider. Provider-accepted emails cannot be recalled. Repeat the same request with the same idempotency key when the response is lost.

View Schema
GET /v1/broadcasts/{broadcast_id}/delivery-errors

List broadcast delivery errors

Returns a cursor-paginated page of permanent failures and unknown delivery results.

View Schema
GET /v1/broadcasts/{broadcast_id}/preflight

Inspect broadcast readiness

Optionally checks the current Subscriber estimate, provider capacity, sender setup, event tracking, and blocking issues. This diagnostic is not required before starting a durable send.

View Schema
GET /v1/broadcasts/{broadcast_id}/progress

Get broadcast send progress

Returns bounded delivery progress, current rates, timing, outcome counts, and pause state. Poll until terminal is true; use 5 to 10 second intervals while progress changes and back off to 30 seconds when unchanged.

View Schema
PUT /v1/broadcasts/{broadcast_id}/schedule

Schedule or reschedule a broadcast

Schedules a draft for future delivery, or changes the delivery time of an existing scheduled Broadcast. This uses Mailrith's durable scheduled-send path and does not start delivery immediately.

View Schema
DELETE /v1/broadcasts/{broadcast_id}/schedule

Unschedule a broadcast

Returns a scheduled Broadcast to draft state before delivery starts.

View Schema
POST /v1/broadcasts/{broadcast_id}/send

Send a broadcast now

Immediately creates durable preparation for a broadcast draft or scheduled send. Mailrith calculates the exact Subscriber total and checks provider readiness in the background before delivery. A 202 response means the durable send was accepted, not that provider delivery is complete. Reuse the same idempotency key if the response is lost.

View Schema
POST /v1/broadcasts/{broadcast_id}/test

Send a broadcast test email

Sends a test message from an existing Broadcast that has an email delivery connection. Provide a saved Subscriber ID for personalization; use subscribers_list to find one when needed. The recipient may be any test inbox and does not have to match the saved Subscriber.

View Schema
GET /v1/segments

List segments

Returns saved segments from the authenticated workspace.

View Schema
POST /v1/segments

Create a segment

Creates a saved segment in the authenticated workspace.

View Schema
GET /v1/segments/{segment_id}

Get a segment

Returns one saved segment from the authenticated workspace.

View Schema
PUT /v1/segments/{segment_id}

Update a segment

Updates a saved segment in the authenticated workspace.

View Schema
DELETE /v1/segments/{segment_id}

Delete a segment

Deletes a saved segment from the authenticated workspace.

View Schema
POST /v1/segments/preview

Preview a segment definition

Returns subscriber counts for an unsaved segment definition. Include `current_segment_id` when previewing edits to an existing segment so circular segment references are rejected before saving.

View Schema
GET /v1/jobs/subscriber-exports

List subscriber export jobs

Returns a bounded cursor page of recent Subscriber export job summaries without loading selection payloads or generating download URLs.

View Schema
POST /v1/jobs/subscriber-exports

Create a subscriber export job

Queues an asynchronous Subscriber export for the authenticated workspace. Requires `subscribers:export` because the finished file contains bulk Subscriber data.

View Schema
GET /v1/jobs/subscriber-exports/{job_id}

Get a subscriber export job

Returns the current state of a previously created export job. Requires `subscribers:export` because completed jobs include a Subscriber CSV download URL.

View Schema
POST /v1/jobs/subscriber-import-uploads

Start a subscriber import upload

Creates a short-lived browser handoff where a signed-in user can choose a CSV file. Starting the handoff does not import Subscribers.

View Schema
GET /v1/jobs/subscriber-import-uploads/{upload_id}

Get a subscriber import upload

Returns upload readiness, bounded column metadata, and the row count without returning CSV contents.

View Schema
GET /v1/jobs/subscriber-imports

List subscriber import jobs

Returns a bounded cursor page of recent Subscriber import job summaries without loading stored CSV data or mapping payloads.

View Schema
POST /v1/jobs/subscriber-imports

Create a subscriber import job

Queues an asynchronous import job from a ready short-lived browser upload. CSV contents never pass through the agent request.

View Schema
GET /v1/jobs/subscriber-imports/{job_id}

Get a subscriber import job

Returns the current state of a previously created import job.

View Schema

For agent integrations, prefer the official TypeScript SDK, Python SDK, or Mailrith MCP server. The raw REST API remains available when you need lower-level control.

Use Starting Points And Secure Handoffs

Starting points let an agent begin with the same approved designs that people see in Mailrith. List starting points first because list responses contain only compact metadata. Load one item only after choosing it, then create the email template, Form, or Landing Page with starting_point_id.

Email delivery credentials remain human-entered. Start a setup session, open setup_url for the signed-in Mailrith user, and poll the session ID at a deliberate interval. After the link opens, Mailrith uses a browser-bound secure session so the user can reload or restart an expired page without sending provider credentials through the agent. A completed response includes the connection ID.

Setup status is kept for a bounded time in short-lived storage. Mailrith does not create a permanent handoff history or copy provider secrets into API responses.

  1. List metadata from the matching /v1/starting-points/... collection.
  2. Choose one starting point by its ID and load its item endpoint only when full content is needed.
  3. Create the workspace object with starting_point_id and its required name or slug.
  4. For email delivery, create a setup session and send setup_url to the signed-in user.
  5. Check the setup session at a bounded interval until it is completed, failed, or expires_at has passed. Do not poll continuously.
  6. If an incomplete session expires, call its renew operation to issue a fresh link with the same non-secret defaults.

Authorize And Execute Workspace Changes

A scoped API key or OAuth access token can call an operation directly when its Permissions include the operation's required scope. Mailrith does not add a separate per-action approval step.

Use a distinct credential for each workflow, grant only the required scopes, and revoke the credential when the workflow should no longer have access. Before a Broadcast send, use the preflight endpoint and resolve every blocking issue.

Supply an idempotency key for operations that support it. Reuse the same key only for the same logical request. Use the returned request ID, current resource, and progress endpoint when you need to confirm an uncertain result.

  1. Choose the narrow Work Profile or resource permission required by the workflow.
  2. Create a task-specific API key or complete OAuth with that Work Profile.
  3. Run capability discovery and confirm the operation is available.
  4. Run the documented preflight check when the operation provides one.
  5. Call the operation directly and include an idempotency key when supported.
  6. Use the request ID and current resource state to confirm the result before retrying an uncertain mutation.
Delete With A Scoped Credential
curl -X DELETE "https://api.mailrith.com/v1/custom-fields/cf_company" \
  -H "Authorization: Bearer $MAILRITH_API_KEY"
Preflight And Send A Broadcast
curl "https://api.mailrith.com/v1/broadcasts/broadcast_example/preflight" \
  -H "Authorization: Bearer $MAILRITH_API_KEY"

curl -X POST "https://api.mailrith.com/v1/broadcasts/broadcast_example/send" \
  -H "Authorization: Bearer $MAILRITH_API_KEY" \
  -H "Idempotency-Key: send-broadcast-example-1"

A granted scope authorizes the operation. Keep credential scope narrow instead of adding a second approval queue after authorization.

Need Help Shipping an Integration?

Reach the Mailrith team if you need help planning a sync, validating a webhook flow, or troubleshooting a request.

Contact Mailrith

On this page

Jump to the section you need.