Your First API Call

Get from zero to a working Rex API integration in under 2 minutes.

Prerequisites

  • A Rex account (sign up free)
  • An API key (created in Settings > API Keys)
  • curl (or any HTTP client)

1. Set your credentials

export REX_URL="https://acme.rexgtm.com"
export REX_API_KEY="rex_live_..."

Replace acme with your subdomain and paste your actual API key.

2. Check the connection

curl "$REX_URL/healthz"

Expected response:

{
  "status": "ok"
}

3. Create a contact

curl -X POST "$REX_URL/contacts" \
  -H "X-Api-Key: $REX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "first_name": "Ada",
    "last_name": "Lovelace",
    "email": "ada@example.com",
    "stage": "lead",
    "source": "organic"
  }'

Expected response:

{
  "data": {
    "id": "cont_01HQ...",
    "first_name": "Ada",
    "last_name": "Lovelace",
    "email": "ada@example.com",
    "stage": "lead",
    "source": "organic",
    "created_at": "2026-03-16T12:00:00Z",
    "updated_at": "2026-03-16T12:00:00Z"
  }
}

4. List your contacts

curl "$REX_URL/contacts" \
  -H "X-Api-Key: $REX_API_KEY"

You should see Ada in the results.

5. Update the contact

curl -X PATCH "$REX_URL/contacts/cont_01HQ..." \
  -H "X-Api-Key: $REX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "stage": "prospect",
    "metadata": {
      "interest": "computing engines"
    }
  }'

What's next?

Was this page helpful?

·