{
  "info": {
    "name": "AutoRelay API",
    "description": "Official Postman collection for the AutoRelay v1 REST API (v2.0.0 unified contract). Configure `apiKey` and `baseUrl` in the environment, then fire requests. All request/response bodies use snake_case. Lists use cursor pagination (`limit` + `cursor`). Mutating requests accept an optional `Idempotency-Key` header.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{apiKey}}",
        "type": "string"
      }
    ]
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://autorelay.hlptechnologies.com/api/v1"
    },
    {
      "key": "localBaseUrl",
      "value": "http://localhost:3000/api/v1"
    },
    {
      "key": "apiKey",
      "value": "ak_live_replace_me"
    },
    {
      "key": "idempotencyKey",
      "value": "replace-with-unique-key"
    },
    {
      "key": "fromEmail",
      "value": "Acme <you@yourdomain.com>",
      "type": "string"
    },
    {
      "key": "emailId",
      "value": "replace_me"
    },
    {
      "key": "contactId",
      "value": "replace_me"
    },
    {
      "key": "listId",
      "value": "replace_me"
    },
    {
      "key": "campaignId",
      "value": "replace_me"
    },
    {
      "key": "domainId",
      "value": "replace_me"
    },
    {
      "key": "webhookId",
      "value": "replace_me"
    },
    {
      "key": "templateId",
      "value": "replace_me"
    },
    {
      "key": "assetId",
      "value": "replace_me"
    }
  ],
  "item": [
    {
      "name": "Emails",
      "item": [
        {
          "name": "Send single",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{idempotencyKey}}",
                "disabled": true
              }
            ],
            "url": "{{baseUrl}}/emails",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"to\": \"you@example.com\",\n  \"cc\": [\"manager@example.com\"],\n  \"bcc\": [\"audit@example.com\"],\n  \"from\": \"{{fromEmail}}\",\n  \"subject\": \"Welcome\",\n  \"html\": \"<p>Hi there, glad you're here.</p>\",\n  \"reply_to\": \"support@yourdomain.com\"\n}"
            }
          }
        },
        {
          "name": "Send single (with template)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{idempotencyKey}}",
                "disabled": true
              }
            ],
            "url": "{{baseUrl}}/emails",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"to\": \"you@example.com\",\n  \"from\": \"{{fromEmail}}\",\n  \"subject\": \"Welcome\",\n  \"template_id\": \"{{templateId}}\",\n  \"data\": {\n    \"first_name\": \"Ada\"\n  }\n}"
            }
          }
        },
        {
          "name": "Send batch",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{idempotencyKey}}",
                "disabled": true
              }
            ],
            "url": "{{baseUrl}}/emails/batch",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"emails\": [\n    {\n      \"to\": \"a@example.com\",\n      \"cc\": [\"manager@example.com\"],\n      \"from\": \"{{fromEmail}}\",\n      \"subject\": \"Hi\",\n      \"html\": \"<p>Hello A</p>\"\n    },\n    {\n      \"to\": \"b@example.com\",\n      \"from\": \"{{fromEmail}}\",\n      \"subject\": \"Hi\",\n      \"template_id\": \"{{templateId}}\",\n      \"data\": {\n        \"first_name\": \"Babbage\"\n      }\n    }\n  ]\n}"
            }
          }
        },
        {
          "name": "List emails",
          "request": {
            "method": "GET",
            "url": "{{baseUrl}}/emails?limit=20"
          }
        },
        {
          "name": "Get by ID",
          "request": {
            "method": "GET",
            "url": "{{baseUrl}}/emails/{{emailId}}"
          }
        }
      ]
    },
    {
      "name": "Contacts",
      "item": [
        {
          "name": "List",
          "request": {
            "method": "GET",
            "url": "{{baseUrl}}/contacts?limit=50"
          }
        },
        {
          "name": "Create",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{idempotencyKey}}",
                "disabled": true
              }
            ],
            "url": "{{baseUrl}}/contacts",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"new@example.com\",\n  \"first_name\": \"Ada\",\n  \"last_name\": \"Lovelace\",\n  \"list_id\": \"{{listId}}\"\n}"
            }
          }
        },
        {
          "name": "Import",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{idempotencyKey}}",
                "disabled": true
              }
            ],
            "url": "{{baseUrl}}/contacts/import",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"list_id\": \"{{listId}}\",\n  \"contacts\": [\n    { \"email\": \"a@example.com\", \"first_name\": \"Ada\" },\n    { \"email\": \"b@example.com\", \"first_name\": \"Babbage\" }\n  ]\n}"
            }
          }
        },
        {
          "name": "Get by ID",
          "request": {
            "method": "GET",
            "url": "{{baseUrl}}/contacts/{{contactId}}"
          }
        },
        {
          "name": "Update",
          "request": {
            "method": "PUT",
            "url": "{{baseUrl}}/contacts/{{contactId}}",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{idempotencyKey}}",
                "disabled": true
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"first_name\": \"Jane\",\n  \"last_name\": \"Doe\",\n  \"status\": \"unsubscribed\"\n}"
            }
          }
        },
        {
          "name": "Delete",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "Idempotency-Key",
                "value": "{{idempotencyKey}}",
                "disabled": true
              }
            ],
            "url": "{{baseUrl}}/contacts/{{contactId}}"
          }
        }
      ]
    },
    {
      "name": "Lists",
      "item": [
        {
          "name": "List",
          "request": {
            "method": "GET",
            "url": "{{baseUrl}}/lists?limit=50"
          }
        },
        {
          "name": "Create",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{idempotencyKey}}",
                "disabled": true
              }
            ],
            "url": "{{baseUrl}}/lists",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"VIPs\"\n}"
            }
          }
        }
      ]
    },
    {
      "name": "Campaigns",
      "item": [
        {
          "name": "List campaigns",
          "request": {
            "method": "GET",
            "url": "{{baseUrl}}/campaigns?limit=20"
          }
        },
        {
          "name": "Create",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{idempotencyKey}}",
                "disabled": true
              }
            ],
            "url": "{{baseUrl}}/campaigns",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"April newsletter\",\n  \"subject\": \"What's new this month\",\n  \"from_email\": \"hello@yourdomain.com\",\n  \"list_ids\": [\"{{listId}}\"],\n  \"template_id\": \"{{templateId}}\",\n  \"content\": \"<p>Hi there ...</p>\",\n  \"reply_to\": \"support@yourdomain.com\",\n  \"cc\": [\"manager@example.com\"],\n  \"bcc\": [\"audit@example.com\"],\n  \"scheduled_at\": \"2026-07-01T09:00:00Z\"\n}"
            }
          }
        },
        {
          "name": "Get by ID",
          "request": {
            "method": "GET",
            "url": "{{baseUrl}}/campaigns/{{campaignId}}"
          }
        },
        {
          "name": "Update draft",
          "request": {
            "method": "PUT",
            "url": "{{baseUrl}}/campaigns/{{campaignId}}",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{idempotencyKey}}",
                "disabled": true
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"subject\": \"Updated subject line\"\n}"
            }
          }
        },
        {
          "name": "Launch",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Idempotency-Key",
                "value": "{{idempotencyKey}}",
                "disabled": true
              }
            ],
            "url": "{{baseUrl}}/campaigns/{{campaignId}}/launch"
          }
        },
        {
          "name": "Delete draft",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "Idempotency-Key",
                "value": "{{idempotencyKey}}",
                "disabled": true
              }
            ],
            "url": "{{baseUrl}}/campaigns/{{campaignId}}"
          }
        }
      ]
    },
    {
      "name": "Templates",
      "item": [
        {
          "name": "List",
          "request": {
            "method": "GET",
            "url": "{{baseUrl}}/templates?limit=50"
          }
        }
      ]
    },
    {
      "name": "Assets",
      "item": [
        {
          "name": "List",
          "request": {
            "method": "GET",
            "url": "{{baseUrl}}/assets?limit=50"
          }
        },
        {
          "name": "Upload",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Idempotency-Key",
                "value": "{{idempotencyKey}}",
                "disabled": true
              }
            ],
            "url": "{{baseUrl}}/assets",
            "body": {
              "mode": "formdata",
              "formdata": [
                {
                  "key": "file",
                  "type": "file",
                  "src": []
                }
              ]
            }
          }
        }
      ]
    },
    {
      "name": "Domains",
      "item": [
        {
          "name": "List",
          "request": {
            "method": "GET",
            "url": "{{baseUrl}}/domains?limit=50"
          }
        },
        {
          "name": "Add",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{idempotencyKey}}",
                "disabled": true
              }
            ],
            "url": "{{baseUrl}}/domains",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"domain\": \"mail.example.com\"\n}"
            }
          }
        },
        {
          "name": "Get by ID",
          "request": {
            "method": "GET",
            "url": "{{baseUrl}}/domains/{{domainId}}"
          }
        },
        {
          "name": "Verify",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Idempotency-Key",
                "value": "{{idempotencyKey}}",
                "disabled": true
              }
            ],
            "url": "{{baseUrl}}/domains/{{domainId}}/verify"
          }
        },
        {
          "name": "Delete",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "Idempotency-Key",
                "value": "{{idempotencyKey}}",
                "disabled": true
              }
            ],
            "url": "{{baseUrl}}/domains/{{domainId}}"
          }
        }
      ]
    },
    {
      "name": "Webhooks",
      "item": [
        {
          "name": "List",
          "request": {
            "method": "GET",
            "url": "{{baseUrl}}/webhooks"
          }
        },
        {
          "name": "Create",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{idempotencyKey}}",
                "disabled": true
              }
            ],
            "url": "{{baseUrl}}/webhooks",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"url\": \"https://your-app.example.com/webhooks/autorelay\",\n  \"events\": [\"send\", \"delivery\", \"bounce\", \"complaint\", \"open\", \"click\"]\n}"
            }
          }
        },
        {
          "name": "Get by ID",
          "request": {
            "method": "GET",
            "url": "{{baseUrl}}/webhooks/{{webhookId}}"
          }
        },
        {
          "name": "Update",
          "request": {
            "method": "PATCH",
            "url": "{{baseUrl}}/webhooks/{{webhookId}}",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{idempotencyKey}}",
                "disabled": true
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"events\": [\"delivery\", \"bounce\", \"complaint\"],\n  \"active\": false\n}"
            }
          }
        },
        {
          "name": "List deliveries",
          "request": {
            "method": "GET",
            "url": "{{baseUrl}}/webhooks/{{webhookId}}/deliveries?limit=20"
          }
        },
        {
          "name": "Delete",
          "request": {
            "method": "DELETE",
            "header": [
              {
                "key": "Idempotency-Key",
                "value": "{{idempotencyKey}}",
                "disabled": true
              }
            ],
            "url": "{{baseUrl}}/webhooks/{{webhookId}}"
          }
        }
      ]
    },
    {
      "name": "Stats",
      "item": [
        {
          "name": "Get account stats",
          "request": {
            "method": "GET",
            "url": "{{baseUrl}}/stats"
          }
        }
      ]
    },
    {
      "name": "OTP",
      "item": [
        {
          "name": "OTP send",
          "request": {
            "method": "POST",
            "url": "{{baseUrl}}/otp/send",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{idempotencyKey}}",
                "disabled": true
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"alice@example.com\",\n  \"product_name\": \"Acme\"\n}"
            }
          }
        },
        {
          "name": "OTP send (custom template)",
          "request": {
            "method": "POST",
            "url": "{{baseUrl}}/otp/send",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{idempotencyKey}}",
                "disabled": true
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"alice@example.com\",\n  \"product_name\": \"Acme\",\n  \"from\": \"Acme <noreply@acme.com>\",\n  \"reply_to\": \"support@acme.com\",\n  \"subject\": \"{{product_name}} code: {{otp}}\",\n  \"html\": \"<p>Hi there, your {{product_name}} verification code is <strong>{{otp}}</strong>. It expires in 10 minutes.</p>\",\n  \"data\": {\n    \"greeting\": \"Welcome back\"\n  }\n}"
            }
          }
        },
        {
          "name": "OTP send (with template_id)",
          "request": {
            "method": "POST",
            "url": "{{baseUrl}}/otp/send",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{idempotencyKey}}",
                "disabled": true
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"alice@example.com\",\n  \"template_id\": \"{{templateId}}\",\n  \"data\": {\n    \"first_name\": \"Ada\"\n  }\n}"
            }
          }
        },
        {
          "name": "OTP verify",
          "request": {
            "method": "POST",
            "url": "{{baseUrl}}/otp/verify",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Idempotency-Key",
                "value": "{{idempotencyKey}}",
                "disabled": true
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"alice@example.com\",\n  \"code\": \"123456\"\n}"
            }
          }
        }
      ]
    },
    {
      "name": "Unsubscribe",
      "item": [
        {
          "name": "Unsubscribe (process)",
          "request": {
            "method": "POST",
            "url": "{{baseUrl}}/unsubscribe",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"token\": \"unsub_token_abc123\"\n}"
            },
            "auth": {
              "type": "noauth"
            }
          }
        },
        {
          "name": "Unsubscribe landing",
          "request": {
            "method": "GET",
            "url": "{{baseUrl}}/unsubscribe?token=unsub_token_abc123",
            "auth": {
              "type": "noauth"
            }
          }
        }
      ]
    }
  ]
}
