Table of contents
Scale outreach on trusted shared infrastructure
Set up domains, mailboxes, and DNS faster.
Start with

Mailforge API: How to Connect Mailforge With Your GTM Stack

The Mailforge API lets you automate the cold email infrastructure work that usually slows GTM teams down: workspace setup, domain checks, domain purchases, mailbox creation, DNS updates, forwarding, domain masking, transfers and renewal controls.

The important boundary is this: Mailforge manages infrastructure. It does not run your outbound sequences. Once domains and mailboxes are active, you connect them to Salesforge for sending, reply management and multichannel sequencing, then keep warmup running through Warmforge before live volume starts.

If you only take one thing from this guide, take this:

Searches and status checks can be automated freely. Purchases, DNS replacement, renewal changes, domain masking and deletion need approval gates until your workflow has been tested.

TL;DR: What the Mailforge API does

  • Base URL: https://api.mailforge.ai/public
  • Authentication for public resource endpoints: send your Mailforge API key in the Authorization header.
  • Best first test: GET /workspaces
  • Most useful GTM endpoints: /workspaces, /check-domain-availability-bulk, /domains, /domains/{domainID}/dns, /mailboxes, /mailboxes/bulk-forward and /domains/forwards.
  • What it does not do: it does not create Salesforge sequences, send campaigns, score replies or manage LinkedIn steps.
  • Best operating model: provision infrastructure with Mailforge, connect mailboxes into Salesforge, start Warmforge warmup, then assign mailboxes to campaigns only after the infrastructure is active and warmed.
Mailforge API Swagger reference
This image shows the Mailforge API Swagger reference

When should you use the Mailforge API?

Use the Mailforge API when infrastructure setup has become a repeatable GTM operation, not a one-off admin task.

That usually means one of four situations:

  • An agency creates workspaces, domains and mailboxes for every new client.
  • A RevOps team provisions mailboxes when a new outbound pod launches.
  • A founder wants domain availability, pricing and mailbox creation inside an internal tool.
  • A technical GTM team wants AI agents or scripts to inspect infrastructure without clicking through dashboards.

Do not use the API just because it exists.

If your team buys two domains per quarter, the dashboard is fine. The API starts to matter when the handoff itself becomes a bottleneck: CRM says the client is ready, ops copies data into Mailforge, someone waits for DNS, someone exports mailboxes, someone starts warmup, and someone forgets to stop a sequence from sending too early.

That is the workflow worth automating.

How I evaluated this guide

I treated the Mailforge API as an operations system, not a feature list. The useful guide is the one that helps a GTM operator wire infrastructure into the next step without buying domains twice, breaking DNS or launching from cold inboxes.

  • Does the endpoint create, mutate or delete a revenue-critical asset?
  • Does the response return the ID needed by the next step?
  • Is the operation synchronous, or should the workflow verify status before moving on?
  • What should stay human-approved until the workflow is trusted?
  • Where does Mailforge stop and Salesforge, Warmforge or another sending platform start?

How to create a Mailforge API key

Generate the key inside your Mailforge account from Settings > API.

Each Forge product uses its own key. A Salesforge key is for Salesforge. A Warmforge key is for Warmforge. A Mailforge key is for Mailforge. Do not mix them in one environment variable and hope the receiving API figures it out.

Use a clear variable name:

export MAILFORGE_API_KEY="YOUR_MAILFORGE_API_KEY"

Store it server-side only. Use a secrets manager or environment variable, not browser code, app screenshots, shared spreadsheets or local files committed to Git.

For agencies, create separate keys per client or workspace where your internal security model allows it. That way one compromised integration does not force a full account-wide rotation.

How Mailforge API authentication works

For normal Mailforge resource calls, pass the API key in the Authorization header.

Use this as the smoke test:

curl --request GET \
  --url "https://api.mailforge.ai/public/workspaces" \
  --header "Authorization: ${MAILFORGE_API_KEY}" \
  --header "Accept: application/json" 

A successful response returns your workspaces:

[
  {
    "id": "workspace_123",
    "accountId": "account_123",
    "name": "Acme outbound",
    "slug": "acme-outbound"
  }
] 

If this fails, fix authentication before building the rest of the workflow.

Common failure points:

  • The key was generated in Salesforge instead of Mailforge.
  • The header name was changed from Authorization to a guessed custom header.
  • The key is being sent from browser-side code.
  • The integration is calling the wrong base path.
  • The key was rotated or disabled after the workflow was deployed.

The API-key management endpoints are different. Listing, creating, updating and deleting API keys use the /api-keys path family and require account-session authorization, not the same public Mailforge key pattern you use for domains and mailboxes. Most GTM teams should create keys in the UI and automate resource operations only.

Main Mailforge API endpoints for GTM automation

Here is the practical endpoint map.

Task Method Endpoint Main Input Watch For
List workspaces GET /workspaces API key Use returned workspace ID downstream.
Create workspace POST /workspaces name Returns 201 Created.
Check one domain GET /check-domain-availability domain query Returns availability and price.
Check domains in bulk POST /check-domain-availability-bulk domains array Maximum 100 domains per request.
Suggest alternatives POST /domains/alternative-domains SLD, TLD, count Good fallback after unavailable domains.
Purchase domains POST /domains domains, workspace ID, contact details Approval-gate this step.
List domains GET /domains optional status/search Filter before mutation.
Get DNS records GET /domains/{domainID}/dns domain ID Snapshot before changes.
Update one domain DNS PUT /domains/{domainID}/dns DNS records Can break authentication.
Bulk update DNS PUT /domains/bulk-dns domains and DNS payload Returns 202 Accepted.
Create mailboxes POST /mailboxes mailbox payloads Slot limits can block creation.
List mailboxes GET /mailboxes optional credentials flag Treat credentials as secrets.
Update mailbox PATCH /mailboxes/{mailboxID} name, signature, password, forwarding Avoid logging payloads.
Bulk forward mailboxes POST /mailboxes/bulk-forward included IDs or search, forwarding email Returns 202 Accepted.
Update domain forwards PATCH /domains/forwards domain ID, destination, masking flag Validate destination first.
Enable auto-renew PUT /domains/{domainID}/enable-autorenew domain ID Financial action.
Disable auto-renew PUT /domains/{domainID}/disable-autorenew domain ID Financial action.
Delete mailbox DELETE /mailboxes/{mailboxID} mailbox ID Restrict hard.
Delete workspace DELETE /workspaces/{workspaceID} workspace ID Restrict harder.

This is why the API belongs in your ops layer, not inside a random lead-routing Zap.

The same credential can touch domains, mailboxes, DNS and billing-adjacent actions. Treat it like production infrastructure access.

Step 1: Create or select the right workspace

Workspaces keep infrastructure separated by client, project, brand or GTM motion.

For a new client, create the workspace first:

curl --request POST \
  --url "https://api.mailforge.ai/public/workspaces" \
  --header "Authorization: ${MAILFORGE_API_KEY}" \
  --header "Content-Type: application/json" \
  --data '{
    "name": "Acme outbound"
  }' 

The response gives you the id. Store that as mailforgeWorkspaceId on the client or campaign record in your CRM or internal ops database.

That ID becomes the parent for domain purchases and transfers.

The mistake is using workspace names as your system key. Names change. IDs should not.

Step 2: Check domain availability before buying anything

Domain availability is safe to automate because it does not spend money or mutate infrastructure.

For one domain:

curl --request GET \
  --url "https://api.mailforge.ai/public/check-domain-availability?domain=tryacmeoutbound.com" \
  --header "Authorization: ${MAILFORGE_API_KEY}" \
  --header "Accept: application/json" 

For bulk checks:

curl --request POST \
  --url "https://api.mailforge.ai/public/check-domain-availability-bulk" \
  --header "Authorization: ${MAILFORGE_API_KEY}" \
  --header "Content-Type: application/json" \
  --data '{
    "domains": [
      "tryacmeoutbound.com",
      "getacmeoutbound.com",
      "acmegrowthmail.com"
    ]
  }' 

The bulk endpoint accepts up to 100 domains per request. Use the response to show availability and price before a human approves the purchase.

A clean buying workflow does this:

  1. Generate candidate domains from the client name, product line or campaign angle.
  2. Check availability in bulk.
  3. Remove unavailable or overpriced domains.
  4. Show the remaining domains and prices to the operator.
  5. Purchase only the approved domains.
Safe domain purchase sequence
This image shows the Safe domain purchase sequence

Step 3: Purchase domains with an approval gate

Domain purchase is where automation becomes financially consequential.

Use the purchase endpoint only after approval:

curl --request POST \
  --url "https://api.mailforge.ai/public/domains" \
  --header "Authorization: ${MAILFORGE_API_KEY}" \
  --header "Content-Type: application/json" \
  --data '{
    "workspaceId": "workspace_123",
    "domains": ["tryacmeoutbound.com"],
    "contactDetails": {
      "firstName": "Ops",
      "lastName": "Owner",
      "organization": "Acme Inc",
      "email": "[email protected]",
      "phone": "+15555550123",
      "address1": "123 Market St",
      "city": "San Francisco",
      "province": "CA",
      "postalCode": "94105",
      "country": "US",
      "dmarcEmail": "[email protected]",
      "forwardToDomain": "acme.com"
    }
  }' 

The response returns domain objects with IDs, status, price data, workspace ID, forwarding fields and renewal status.

Store the returned domain IDs immediately.

Do not retry domain purchases blindly after a timeout. First list domains and check whether the domain was already created. A naive retry can create billing confusion or leave ops wondering which attempt actually succeeded.

A 402 Payment Required means the account does not have a payment method ready for the purchase. That is an operator action, not a retry loop.

Step 4: Track domain and mailbox readiness

Mailforge domain and mailbox objects expose statuses. Your workflow should use them.

Domain statuses include:

  • draft
  • pending
  • active
  • failed
  • expired
  • scheduled_for_deletion
  • not_paid

Mailbox statuses include:

  • draft
  • pending
  • processing
  • active
  • failed
  • scheduled_for_deletion

Do not connect a mailbox to a campaign just because the creation request returned a response. Check that the domain and mailbox are active, then verify DNS and forwarding where your workflow depends on them.

A better status loop looks like this:

curl --request GET \
  --url "https://api.mailforge.ai/public/domains?status=active&search=tryacmeoutbound" \
  --header "Authorization: ${MAILFORGE_API_KEY}" \
  --header "Accept: application/json" 

Then check mailboxes:

curl --request GET \
  --url "https://api.mailforge.ai/public/mailboxes" \
  --header "Authorization: ${MAILFORGE_API_KEY}" \
  --header "Accept: application/json" 

Your internal system should move a client through states like infrastructure_requested, domains_purchased, mailboxes_processing, mailboxes_active, exported_to_salesforge, warmup_started and ready_for_sequence.

That state machine matters more than the API call itself.

Step 5: Create mailboxes from approved domains

Once domains are active, create the mailboxes your outbound plan needs.

curl --request POST \
  --url "https://api.mailforge.ai/public/mailboxes" \
  --header "Authorization: ${MAILFORGE_API_KEY}" \
  --header "Content-Type: application/json" \
  --data '{
    "mailboxes": [
      {
        "email": "[email protected]",
        "firstName": "Alex",
        "lastName": "Morgan",
        "forwardingEmail": "[email protected]",
        "signature": "Alex Morgan | Acme"
      },
      {
        "email": "[email protected]",
        "firstName": "Jamie",
        "lastName": "Reed",
        "forwardingEmail": "[email protected]",
        "signature": "Jamie Reed | Acme"
      }
    ]
  }' 

Mailforge bills around mailbox slots, not just visible active mailboxes. That matters for automation. If your script creates fewer mailboxes than purchased slots, the unused capacity still exists. If your script creates more than the available slot count, expect the request to fail.

The practical rule: calculate mailbox needs before purchase, store the slot target on the campaign record and reconcile actual mailbox count after provisioning.

Step 6: Retrieve credentials only when you need them

The mailbox list and mailbox detail endpoints support a with_credentials query parameter.

Use it carefully:

curl --request GET \
  --url "https://api.mailforge.ai/public/mailboxes?with_credentials=true" \
  --header "Authorization: ${MAILFORGE_API_KEY}" \
  --header "Accept: application/json" 

Credentials include IMAP and SMTP hostnames, ports, usernames and passwords.

That is sensitive material. Do not log the full response in CI. Do not paste it into Slack. Do not expose it in an internal admin page unless the viewer is allowed to connect mailboxes.

If you use Salesforge, the cleaner route is usually the native export from Mailforge to Salesforge. Use credentials for custom sending platforms or controlled fallback flows.

Step 7: Understand what DNS is automatic and what DNS is not

Mailforge automatically configures standard email authentication for Mailforge-created infrastructure, including SPF, DKIM and DMARC.

That means your default workflow should not immediately replace DNS records after buying a domain.

Use DNS endpoints when you need to inspect records, add custom records, adjust forwarding-related setup, replace specific records or run bulk maintenance across a controlled set of domains.

To inspect records:

curl --request GET \
  --url "https://api.mailforge.ai/public/domains/domain_123/dns" \
  --header "Authorization: ${MAILFORGE_API_KEY}" \
  --header "Accept: application/json" 

Before updating DNS, snapshot the current records. Some records are marked editable; respect that field.

A single-domain update uses:

curl --request PUT \
  --url "https://api.mailforge.ai/public/domains/domain_123/dns" \
  --header "Authorization: ${MAILFORGE_API_KEY}" \
  --header "Content-Type: application/json" \
  --data '{
    "records": [
      {
        "name": "track",
        "type": "CNAME",
        "value": "tracking.example.com",
        "editable": true
      }
    ]
  }' 

Bulk DNS changes use PUT /domains/bulk-dns and return 202 Accepted. Treat that as accepted for processing, not proof that every record is already live.

After a bulk DNS job, re-read affected domains and run a separate DNS health check before campaign activation.

Step 8: Configure forwarding without losing reply ownership

Forwarding is not just an admin convenience. It determines who sees replies and how quickly hot prospects get handled.

For domain forwarding:

curl --request PATCH \
  --url "https://api.mailforge.ai/public/domains/forwards" \
  --header "Authorization: ${MAILFORGE_API_KEY}" \
  --header "Content-Type: application/json" \
  --data '[
    {
      "domainId": "domain_123",
      "forwardToDomain": "acme.com",
      "domainMasking": false
    }
  ]' 

For mailbox forwarding in bulk:

curl --request POST \
  --url "https://api.mailforge.ai/public/mailboxes/bulk-forward" \
  --header "Authorization: ${MAILFORGE_API_KEY}" \
  --header "Content-Type: application/json" \
  --data '{
    "includedIds": ["mailbox_123", "mailbox_456"],
    "excludedIds": [],
    "forwardingEmail": "[email protected]"
  }' 

The bulk mailbox forwarding endpoint returns 202 Accepted, so verify forwarding status later. Forwarding status can be pending, active or failed.

Use one owner mailbox per campaign or client. Random forwarding destinations create reply leakage and reporting problems.

Step 9: Connect Mailforge to Salesforge

Mailforge integration with Salesforge
This image shows the Mailforge integration with Salesforge

Once Mailforge mailboxes are created, the GTM stack has two clean connection routes.

Native route: Mailforge to Salesforge

Use this when the team is already running Salesforge.

The workflow is:

  1. Create domains and mailboxes in Mailforge.
  2. In Mailforge, export mailboxes to the right Salesforge workspace.
  3. Confirm mailboxes appear in Salesforge with custom tracking domain and warmup enabled.
  4. Keep campaign sending disabled while warmup runs.
  5. Assign mailboxes to Salesforge sequences only after readiness checks pass.

This is the lowest-friction route because the Forge stack shares the operating environment. Mailforge handles infrastructure. Salesforge handles sequences, mailbox rotation, text-only sending, AI personalization across 21+ languages, Bounce Shield, built-in email validation, Primebox™ reply management and campaign analytics.

Custom route: Mailforge API to your sending platform

Use this when your sending platform is not Salesforge or when you need an internal provisioning portal.

The workflow is:

  1. Internal trigger fires from CRM, billing or project management.
  2. Your backend calls Mailforge to create workspace, check domains, purchase approved domains and create mailboxes.
  3. Your backend waits until domains and mailboxes are active.
  4. Your backend retrieves mailbox credentials only if the sending platform requires them.
  5. Your backend connects the mailbox to the sending platform API.
  6. Warmup starts before live campaign assignment.
  7. Campaign activation stays blocked until the mailbox is warm and DNS is healthy.

The mistake is treating mailbox creation as the finish line.

The finish line is a warmed, connected, monitored mailbox assigned to the right campaign owner.

Native route vs custom API route
This image shows the Native route vs custom API route

Step 10: Add Warmforge before sending volume

Mailforge gets infrastructure ready fast. Warmup still matters.

If you connect Mailforge mailboxes into Salesforge, Warmforge warmup is included at no additional cost with Salesforge and can run across connected mailboxes. Warmforge tracks Heat Score™, supports Inbox Placement Tests, runs Health Checks across DNS, MX and blacklist status, and keeps warmup activity continuous.

The operating rule is simple: do not let a newly created mailbox send cold outreach immediately just because it exists.

A sane activation gate checks:

  • Domain status is active.
  • Mailbox status is active.
  • Forwarding status is active if forwarding is part of the workflow.
  • SPF, DKIM and DMARC are present and healthy.
  • Warmup has started.
  • The mailbox is assigned to the right Salesforge workspace and campaign owner.
  • Sending limits are conservative for new infrastructure.

For most teams, the API should provision. Salesforge and Warmforge should control the live sending ramp.

REST API vs Forge MCP vs CLI

The REST API is best when your backend needs deterministic automation.

Use it for provisioning flows, internal tools, audit logs, approvals and system-to-system updates.

Forge MCP is best when an AI client needs controlled access to inspect or operate the Forge stack. The shared MCP endpoint is https://mcp.salesforge.ai/mcp, and Mailforge access uses the X-Mailforge-Key header.

For Claude Code, the setup shape is:

claude mcp add salesforge \
  --transport streamable-http \
  --url "https://mcp.salesforge.ai/mcp" \
  --header "X-Mailforge-Key: YOUR_MAILFORGE_API_KEY" \
  --header "X-Salesforge-Key: YOUR_SALESFORGE_API_KEY" \
  --header "X-Warmforge-Key: YOUR_WARMFORGE_API_KEY" 

Only include product keys you actually use.

The CLI is best for repeatable operator commands from a terminal or CI job. Use it when a human wants scriptable control without writing a full integration service. The same safety rule applies: read-only commands are low risk; purchases, DNS writes, renewal changes and deletions need approval.

For AI and CLI workflows, separate read tools from write tools. An assistant that can list domains is different from an assistant that can buy domains or delete mailboxes.

Error handling and retry rules

The Mailforge public spec documents common responses by endpoint, including 200, 201, 202, 204, 400, 401, 402 and 404.

Use this operating interpretation:

Code Meaning in Practice Retry? Operator Action
200 Request succeeded with a response body. No Store returned IDs and state.
201 Workspace created. No Store the workspace ID.
202 Bulk operation accepted. Poll or re-read resources. Do not treat the operation as complete.
204 Update or delete completed with no response body. No Re-read the resource if state verification is required.
400 Invalid request, unavailable domain, or bad DNS payload. No Fix the request input before trying again.
401 Unauthorized for API-key management endpoints. No Check account authentication or session.
402 Payment method missing for domain purchase. No Billing owner should update the payment method.
404 Workspace, domain, or mailbox not found. No Verify stored IDs and workspace scope.
429 Rate limited by the API or edge infrastructure. Yes, with backoff Reduce the request rate before retrying.
500–503 Service or network failure. Yes, bounded retry Reconcile the current state before retrying write operations.

The big rule: retry reads. Reconcile before retrying writes.

For a failed read, retry with exponential backoff. For a failed purchase, mailbox creation, DNS replacement, masking purchase, renewal change or deletion, first query current state. Only retry if you can prove the previous attempt did not apply.

Complete new-client provisioning workflow

Here is the implementation pattern I would use for an agency or GTM ops team.

Trigger: a deal moves to Closed Won in HubSpot, or a customer record moves to Ready for outbound setup in your internal system.

Inputs: client name, workspace naming convention, approved sending domain candidates, forwarding destination, mailbox naming pattern, contact details, target sending volume and campaign owner.

Process:

  1. Create a Mailforge workspace and store the workspace ID.
  2. Check domain availability in bulk.
  3. Present available domains and prices for approval.
  4. Purchase approved domains only.
  5. Store returned domain IDs and status values.
  6. Poll domain state until each domain is active or failed.
  7. Create the planned mailboxes.
  8. Poll mailbox state until each mailbox is active or failed.
  9. Configure forwarding and verify forwarding status.
  10. Get DNS records and run a health check.
  11. Export mailboxes to Salesforge natively, or connect credentials to another sending platform.
  12. Start Warmforge warmup.
  13. Keep the campaign disabled until warmup and health checks pass.
  14. Assign active mailboxes to the right Salesforge sequence.
  15. Log every mutation with actor, timestamp, workspace ID, domain IDs and mailbox IDs.

Failure path: if one mailbox fails, retry that mailbox only. Do not repeat the domain purchase. If DNS fails, isolate that domain from campaign assignment. If payment fails, stop and route to the billing owner. If forwarding fails, keep the mailbox out of production until replies have a controlled destination.

Output: active Mailforge infrastructure connected to the GTM stack, warmed before sending and traceable back to the CRM trigger that created it.

That is the difference between API automation and API chaos.

Security controls for Mailforge API workflows

Mailforge API access can affect domains, DNS, mailbox credentials and billing-adjacent actions. Treat it accordingly.

Your baseline controls should be:

  • Store keys in a server-side secret manager.
  • Keep production and development keys separate.
  • Rotate keys when an operator leaves or an integration is compromised.
  • Do not log API keys, mailbox passwords or full credential responses.
  • Require approval before purchases, deletions, DNS replacement, renewal changes and masking purchases.
  • Snapshot DNS before writes.
  • Block destructive actions in production workspaces unless the request includes an approved change ID.
  • Keep an audit log of who or what initiated each mutation.
  • Reconcile state after timeouts before retrying write operations.

This is not bureaucracy. It is how you avoid buying the same domain twice or breaking authentication across 50 senders because a script wrote the wrong record.

Where Mailforge fits in the Forge stack

Mailforge is the shared infrastructure layer of the Forge stack.

Use it when you want affordable, fast, distributed mailbox infrastructure built for cold outreach, with automated DNS, bulk domain and mailbox creation, domain forwarding, workspace separation, SSL and Domain Masking as an add-on, domain flexibility and API/MCP/CLI support.

If you need dedicated IP control, Infraforge is the private infrastructure option. If you need real Google Workspace or Microsoft 365 mailboxes with ESP matching, Primeforge is the provider-native option.

If you need lead discovery before provisioning campaigns, Leadsforge feeds lists into Salesforge. If you want autonomous prospecting, sequencing, replies and booking, Agent Frank can run the workflow end-to-end as a separate product.

For this specific use case, the clean order is:

Infrastructure first. Warmup second. List and copy third. Sending volume last.

Most outbound teams reverse that order. They build the campaign, then scramble to make the infrastructure behave.

The Mailforge API gives you a way to enforce the right order in software.

Personalized Outbound Strategy

Get The Right Outbound Strategy In Minutes

Enter your email to get a custom plan & stack recommendation for your business

It's being carefully crafted by AI

Please check your mailbox in 5 minutes

Final verdict

The Mailforge API is worth using when your GTM team provisions domains and mailboxes often enough that manual setup creates delays, mistakes or inconsistent handoffs.

Start with read-only automation: list workspaces, check domains, inspect DNS and list mailboxes. Then add guarded write actions: workspace creation, approved domain purchase, mailbox creation and forwarding. Keep purchases, DNS replacements, renewal changes and deletions behind approval until the workflow has a real audit trail.

If you use Salesforge, the best handoff is Mailforge infrastructure into Salesforge execution with Warmforge warmup before live sending. That gives your team one connected outbound workflow instead of a pile of scripts around a sending tool.

If your team is still setting up outbound infrastructure by hand every time a campaign or client launches, use Mailforge to turn that setup into a repeatable provisioning system. Then use Salesforge to run the sequence, manage replies in Primebox™ and scale sending without turning infrastructure work into another full-time job.