Moab logoMoab
Get started
Moab Docs

API Quickstart

One key, nine calls — create a project with setup, connect a provider, run and approve a starting agent, and measure what it earned.

Create a key in MCP & API Keys and set MOAB_API_KEY. A key minted from a project page is pinned to that project; a workspace key sends Project-ID once the project exists. Every call on this page is rendered from Moab's declared operations, so what you read is what the API answers.

Create the project with setup: true. Setup researches the site and saves the product, goals, audience, content and paused starting agents.

RESPONSE=$(curl --fail-with-body "https://moabcrm.com/api/v1/projects" \
  -H "Authorization: Bearer $MOAB_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: acme-projects.create-1' \
  -d '{"setup":true,"name":"Acme CRM","url":"https://example.com","prompt":"Acme sells scheduling software to operations teams."}')
PROJECT_ID=$(printf '%s' "$RESPONSE" | jq -er '.project.id')
TASK_ID=$(printf '%s' "$RESPONSE" | jq -er '.setup.task.id')

Read the setup task until run.status is terminal.

curl --fail-with-body "https://moabcrm.com/api/v1/tasks/$TASK_ID" \
  -H "Authorization: Bearer $MOAB_API_KEY" \
  -H "Project-ID: $PROJECT_ID"

The setup projection lists what was created per collection — take the ids the next calls need.

RESPONSE=$(curl --fail-with-body "https://moabcrm.com/api/v1/projects/$PROJECT_ID/setup" \
  -H "Authorization: Bearer $MOAB_API_KEY" \
  -H "Project-ID: $PROJECT_ID")
AGENT_ID=$(printf '%s' "$RESPONSE" | jq -er '.created.agents[0]')

Connect the sending provider. The key is encrypted server-side and never returned.

Set $INSTANTLY_API_KEY in your shell first.

curl --fail-with-body "https://moabcrm.com/api/v1/integrations" \
  -H "Authorization: Bearer $MOAB_API_KEY" \
  -H "Project-ID: $PROJECT_ID" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: acme-integrations.create-1' \
  -d "$(jq -n --arg INSTANTLY_API_KEY "$INSTANTLY_API_KEY" '{"provider":"instantly","credentials":{"api_key":$INSTANTLY_API_KEY}}')"

Run one starting agent: it researches leads and prepares drafts, all pending.

curl --fail-with-body "https://moabcrm.com/api/v1/campaign-agents/$AGENT_ID/runs" \
  -H "Authorization: Bearer $MOAB_API_KEY" \
  -H "Project-ID: $PROJECT_ID" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: acme-campaign-agents.run-1' \
  -d '{}'

Review what it drafted — every row starts as a draft; nothing sends until you approve.

curl --fail-with-body "https://moabcrm.com/api/v1/outbox?agent_id=$AGENT_ID&status=draft" \
  -H "Authorization: Bearer $MOAB_API_KEY" \
  -H "Project-ID: $PROJECT_ID"

Activate the agent for ongoing work.

curl --fail-with-body "https://moabcrm.com/api/v1/campaign-agents/$AGENT_ID/approve" \
  -H "Authorization: Bearer $MOAB_API_KEY" \
  -H "Project-ID: $PROJECT_ID" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: acme-campaign-agents.approve-1' \
  -d '{}'

Project performance, on the dashboard's own windows and evidence.

curl --fail-with-body "https://moabcrm.com/api/v1/performance?metric=links_clicked&bucket=day" \
  -H "Authorization: Bearer $MOAB_API_KEY" \
  -H "Project-ID: $PROJECT_ID"

One agent's performance and cost.

curl --fail-with-body "https://moabcrm.com/api/v1/campaign-agents/$AGENT_ID/performance?metric=cost_usd&bucket=total" \
  -H "Authorization: Bearer $MOAB_API_KEY" \
  -H "Project-ID: $PROJECT_ID"

Reading work

GET /api/v1/tasks/{id} is the one read for anything asynchronous — the task with its latest run's receipt inlined as run: status, result, usage, cost_usd (null when unknown, never 0), a named error on failure, and gaps[] on a success that fell short somewhere. A campaign agent run answers with the same acknowledgement, so it is read the same way. GET /api/v1/tasks/{id}/runs is the history; POST /api/v1/tasks/{id}/cancel stops the active run.

Retries and the advanced forms

Send the same Idempotency-Key with the same body to recover an acknowledgement; a changed body under an existing key is 409 idempotency_conflict. Beyond the quickstart: the resource pages carry the create and update calls for every object setup seeded — products and goals, people and companies, content, pages, sequences — and Channels & Sending explains what an approved draft actually does at the provider.

On this page

Moab logoMoab

Ready to build? Connect an agent and go — no credit card needed to start.

Get startedSee our plans