{
  "openapi": "3.1.0",
  "info": {
    "title": "Motorical Public API: Send API",
    "version": "1.12.0",
    "description": "Send API. Part of the full specification at https://docs.motorical.com/openapi.json (same version, same operationIds). Transactional email HTTP API and analytics for Motorical Sending SMTP — same job class as SendGrid/Postmark-style send APIs. One Motor Block per project: an isolated sending stream with its own domain, auth, keys, SMTP credentials, rates, logs, webhooks, and automation. Developer sandbox: unpaid agent onboarding uses a Motorical-owned `.sandbox` domain (instant, no DNS) or a sandbox Motor Block on your own fully verified domain (on a Free account, created automatically once DKIM and SPF pass when automatic provisioning is enabled; otherwise call the provision route), with outbound locked to an allowlist until convert + Motorical Plan. Onboarding auth: register → verify-code (returns a single-use setupToken) → set-password {email, password, setupToken} → dashboard JWT (~15m) + refreshToken (7d). Agents store refreshToken and POST /api/auth/refresh with JSON body (cookies optional). After domain ownership verify, call POST /api/public/v1/domains/{id}/check-dns (or re-call verify) to flip dkim_configured/spf_configured before /v1/send. Domains are account-wide, not Motor-Block-scoped (a Motor Block is created from a verified domain, not the reverse) — GET/POST /api/public/v1/domains* need no motorBlockId. Public API covers email sending, analytics, logs, configuration, domain management, domain health, webhooks, and exports. SMTP submission is an out-of-band protocol on mail.motorical.com:2587 (STARTTLS) or :2465 (implicit TLS) using password, OAuth 2.0 access token as SMTP password (or XOAUTH2), or mTLS + password — see https://docs.motorical.com/smtp-integration/authentication-methods. Do not use OAuth access tokens or Bearer tokens on POST /v1/send (Motor Block ApiKey mk_live_ only)."
  },
  "servers": [
    {
      "url": "https://api.motorical.com",
      "description": "Motorical production API. The only host that serves the HTTP Send API (/v1/*); also serves the Public API (/api/public/v1/*) and the dashboard/auth API (/api/*). Use this host for every API call except the Communications API (/comm-api/*): those operations name https://motorical.com as their own server, and api.motorical.com answers 404 for /comm-api."
    },
    {
      "url": "https://motorical.com",
      "description": "Dashboard host — OAuth AS endpoints. Also answers /api/* and /api/public/v1/*, but POST /v1/send is NOT served here (nginx answers 405)."
    }
  ],
  "tags": [
    {
      "name": "Send",
      "description": "Transactional email via HTTP API (POST /v1/send)"
    },
    {
      "name": "Status",
      "description": "Platform status: the same live data as https://motorical.com/status, for monitors and agents"
    }
  ],
  "paths": {
    "/v1/test-email": {
      "post": {
        "tags": [
          "Send"
        ],
        "summary": "Test SMTP setup parameters",
        "description": "Validate SMTP setup parameters for customer setup flows. Authenticated with a Motor Block API key supplied as `Authorization: ApiKey mk_live_...` or `X-Api-Key: mk_live_...`.",
        "security": [
          {
            "apiKeyAuth": []
          },
          {
            "xApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "method",
                  "host",
                  "port",
                  "username",
                  "to",
                  "subject"
                ],
                "properties": {
                  "method": {
                    "type": "string",
                    "enum": [
                      "basic_auth",
                      "starttls",
                      "api_key",
                      "oauth2",
                      "mtls"
                    ]
                  },
                  "host": {
                    "type": "string"
                  },
                  "port": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 65535
                  },
                  "username": {
                    "type": "string"
                  },
                  "password": {
                    "type": "string"
                  },
                  "to": {
                    "type": "string",
                    "format": "email"
                  },
                  "subject": {
                    "type": "string"
                  },
                  "requireTLS": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "SMTP test accepted"
          },
          "401": {
            "description": "Motor Block API key missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "operationId": "sendTestEmail"
      }
    },
    "/v1/send": {
      "post": {
        "tags": [
          "Send"
        ],
        "summary": "Send or validate an email",
        "description": "Queue an email for immediate delivery, or validate the payload only when `dryRun: true`. `dryRun` defaults to false on this route: the email is sent unless you pass `dryRun: true`, so always set it explicitly. Authenticated via Motor Block API key (`Authorization: ApiKey mk_live_...` or `X-Api-Key: mk_live_...`).\n\n**Dry run:** `dryRun: true` performs the same authentication, domain, DNS, recipient, subject, and body-size checks but does not insert an email log or push delivery work to Redis.\n\n**Idempotency:** Include an `Idempotency-Key` header to prevent duplicate sends on retries (24h window).\n\n**Webhook verification:** Delivery events are posted to your webhook endpoints with an `X-Motorical-Signature` header containing an HMAC-SHA256 hex digest computed over the JSON body using the webhook secret you received at creation time. Verify with: `crypto.createHmac(\"sha256\", secret).update(body).digest(\"hex\")`.",
        "security": [
          {
            "apiKeyAuth": []
          },
          {
            "xApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "from",
                  "to",
                  "subject"
                ],
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "email",
                    "description": "Sender address (must match motor block domain). Bare email only — use fromName for display name."
                  },
                  "fromName": {
                    "type": "string",
                    "maxLength": 78,
                    "description": "Optional From display name (e.g. \"Acme Billing\"). Produces From: \"Acme Billing\" <addr@domain>. Do not set a From custom header (DISALLOWED_HEADERS).",
                    "example": "Acme Billing"
                  },
                  "to": {
                    "oneOf": [
                      {
                        "type": "string",
                        "format": "email"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "format": "email"
                        },
                        "maxItems": 50
                      }
                    ],
                    "description": "Recipient address, or a list of addresses. One request is one message: every recipient receives the same message and the To header shows the addresses as written. For a separate message per person, send one request each."
                  },
                  "cc": {
                    "oneOf": [
                      {
                        "type": "string",
                        "format": "email"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "format": "email"
                        },
                        "maxItems": 50
                      }
                    ],
                    "description": "Copy recipients, named in the Cc header. to, cc and bcc together take at most 50 addresses. Rolling out per Motor Block: 422 feature_not_enabled where not available."
                  },
                  "bcc": {
                    "oneOf": [
                      {
                        "type": "string",
                        "format": "email"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "string",
                          "format": "email"
                        },
                        "maxItems": 50
                      }
                    ],
                    "description": "Blind-copy recipients: they receive the message but are named in no header. Rolling out per Motor Block."
                  },
                  "replyTo": {
                    "type": "string",
                    "format": "email",
                    "description": "Reply-To address. Not allowed together with a Reply-To custom header (422 conflicting_fields). Rolling out per Motor Block."
                  },
                  "subject": {
                    "type": "string",
                    "maxLength": 998,
                    "description": "Email subject"
                  },
                  "text": {
                    "type": "string",
                    "description": "Plain text body"
                  },
                  "html": {
                    "type": "string",
                    "description": "HTML body"
                  },
                  "headers": {
                    "type": "object",
                    "description": "Custom headers applied to the outgoing message and DKIM-signed (e.g. In-Reply-To, References, Reply-To, List-Unsubscribe, custom X-*). Reserved/spoofable headers are rejected with 400 DISALLOWED_HEADERS: From, Sender, Return-Path, To, Cc, Bcc, Subject, Date, Message-ID, MIME-Version, Content-*, DKIM-Signature, Received, Authentication-Results, ARC-*, X-Motorical-*. Header values containing CR/LF are also rejected.",
                    "additionalProperties": {
                      "type": "string"
                    }
                  },
                  "attachments": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 20,
                    "description": "Files to attach. Your plan decides how many, how large (per file and in total) and which types, exactly as over SMTP; a refusal names the plan and the limit. Rolling out per Motor Block: 422 feature_not_enabled where not available.",
                    "items": {
                      "type": "object",
                      "required": [
                        "filename",
                        "content"
                      ],
                      "additionalProperties": false,
                      "properties": {
                        "filename": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 255,
                          "description": "No path separators or control characters"
                        },
                        "content": {
                          "type": "string",
                          "description": "The file bytes, base64 (standard alphabet, no data: prefix; line breaks are tolerated)"
                        },
                        "contentType": {
                          "type": "string",
                          "maxLength": 127,
                          "description": "MIME type; derived from the filename when omitted"
                        },
                        "contentId": {
                          "type": "string",
                          "maxLength": 128,
                          "description": "For an inline image: reference it in html as cid:<contentId>"
                        },
                        "disposition": {
                          "type": "string",
                          "enum": [
                            "attachment",
                            "inline"
                          ],
                          "description": "inline requires a contentId"
                        }
                      }
                    }
                  },
                  "dryRun": {
                    "type": "boolean",
                    "default": false,
                    "description": "Validate without queueing or writing email logs. With attachments it also runs the plan check (not the virus and content scan)."
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Unique key to prevent duplicate sends (24h window)"
          }
        ],
        "responses": {
          "200": {
            "description": "Email queued, or payload validated when dryRun=true",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "dryRun": {
                      "type": "boolean"
                    },
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "acceptanceStatus": {
                          "type": "string",
                          "enum": [
                            "queued",
                            "validated"
                          ]
                        },
                        "from": {
                          "type": "string"
                        },
                        "fromName": {
                          "type": "string",
                          "nullable": true
                        },
                        "to": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "subject": {
                          "type": "string"
                        },
                        "domain": {
                          "type": "string"
                        },
                        "bodySize": {
                          "type": "integer"
                        },
                        "recipientCount": {
                          "type": "integer"
                        },
                        "cc": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "Echoed when cc was sent"
                        },
                        "bcc": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "Echoed when bcc was sent"
                        },
                        "replyTo": {
                          "type": "string",
                          "description": "Echoed when replyTo was sent"
                        },
                        "skipped": {
                          "type": "array",
                          "description": "Recipients that were not sent to (today: suppressed)",
                          "items": {
                            "type": "object",
                            "properties": {
                              "address": {
                                "type": "string"
                              },
                              "role": {
                                "type": "string",
                                "enum": [
                                  "to",
                                  "cc",
                                  "bcc"
                                ]
                              },
                              "reason": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "attachments": {
                          "type": "array",
                          "description": "dryRun only: what would be attached, with decoded sizes in bytes",
                          "items": {
                            "type": "object",
                            "properties": {
                              "filename": {
                                "type": "string"
                              },
                              "size": {
                                "type": "integer"
                              },
                              "contentType": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "attachmentBytes": {
                          "type": "integer",
                          "description": "dryRun only: total decoded size of the attachments"
                        },
                        "timestamp": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "validated"
                          ],
                          "description": "Present on dryRun responses only"
                        },
                        "hasText": {
                          "type": "boolean",
                          "description": "dryRun only"
                        },
                        "hasHtml": {
                          "type": "boolean",
                          "description": "dryRun only"
                        },
                        "motorBlockId": {
                          "type": "string",
                          "format": "uuid",
                          "description": "dryRun only"
                        },
                        "sandboxPreview": {
                          "type": "object",
                          "description": "dryRun on a sandbox Motor Block only: what a real send would be refused for. Nothing is refused by the dry run itself.",
                          "properties": {
                            "allowlistChecked": {
                              "type": "boolean"
                            },
                            "wouldRefuse": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              },
                              "description": "Recipients a real send would refuse; empty when fine"
                            },
                            "code": {
                              "type": "string",
                              "nullable": true,
                              "enum": [
                                "sandbox_outbound_locked",
                                "sandbox_recipient_denied",
                                null
                              ]
                            },
                            "allowlist": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "sandboxRedirect": {
                          "type": "object",
                          "nullable": true,
                          "deprecated": true,
                          "description": "No longer returned; sandbox sends to a recipient outside the allowlist are refused with 403 sandbox_outbound_locked (a locked sandbox, the default) or sandbox_recipient_denied (after an explicit unlock).",
                          "properties": {
                            "requestedTo": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "format": "email"
                              }
                            },
                            "deliveredTo": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "format": "email"
                              }
                            },
                            "reason": {
                              "type": "string",
                              "example": "sandbox_outbound_locked"
                            }
                          }
                        }
                      }
                    },
                    "idempotent": {
                      "type": "boolean",
                      "description": "true when an Idempotency-Key matched a send from the last 24h"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Disallowed custom header(s) (code DISALLOWED_HEADERS) or invalid from address",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "401": {
            "description": "Checked before the body is validated. `code` is `api_key_required` (no sending credential, or a Motor Block key sent as `Bearer` instead of `ApiKey`) or `invalid_api_key` (malformed, revoked or unknown key).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "403": {
            "description": "Domain mismatch, unverified, DOMAIN_DNS_INCOMPLETE (hint: check-dns), `no_motor_block_covered` (the authorization covers no Motor Block yet; reconnect), a sandbox or Free recipient refusal (`sandbox_recipient_denied` or `sandbox_outbound_locked` for a recipient outside the sandbox allowlist, with `denied` and `allowlist`, never redirected; `free_recipient_not_confirmed` for an unconfirmed Free recipient; each with a `nextAction`), or `use_comms_api`: the API key belongs to a marketing motor block. Marketing blocks send only through Communications (campaigns in the dashboard, or the Comms Block API with your account API key and a workspace); use a transactional block for transactional email.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "404": {
            "description": "Motor block not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "413": {
            "description": "Request body or attachments too large. `error` is attachment_too_large or attachments_total_too_large (the body names the plan, the limit and the actual size) or payload_too_large (the JSON body is over the platform message capacity).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "422": {
            "description": "Validation error (VALIDATION_ERROR), or a refusal that names its reason in `code`: feature_not_enabled (cc, bcc, replyTo or attachments are not enabled for this Motor Block yet), conflicting_fields, invalid_attachment (not valid base64), too_many_attachments, attachment_type_not_allowed, attachments_not_allowed, content_policy_rejected.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "429": {
            "description": "Send quota exceeded. `error` is one of free_limit_hour, free_limit_day or free_limit_month (Free account window cap on non-sandbox Motor Blocks; `nextAction` says whether to retry after Retry-After or subscribe), sandbox_monthly_limit (the sandbox real-send cap for the month; subscribe and convert), rate_limited_block (Motor Block burst/hourly/daily ceiling, enforced today), rate_limited_account (account-wide hourly/daily ceiling, enforced), or rate_limited_warmup (sending domain is warming up and its buffer is full, enforced). Large requests are also bounded: too_many_large_requests (too many large bodies in flight for the Motor Block or the platform) and dryrun_rate_limited (dryRun checks with large attachments, per minute). Retry-After (seconds) is always set. RateLimit-Limit / RateLimit-Remaining / RateLimit-Reset are set for the block and account ceilings, but not for rate_limited_warmup.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until the bound window resets"
              },
              "RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "The ceiling that bound (absent on rate_limited_warmup)"
              },
              "RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                },
                "description": "0 on a quota refusal (absent on rate_limited_warmup)"
              },
              "RateLimit-Reset": {
                "schema": {
                  "type": "integer"
                },
                "description": "Seconds until reset (absent on rate_limited_warmup)"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "string",
                      "enum": [
                        "rate_limited_block",
                        "rate_limited_account",
                        "rate_limited_warmup",
                        "too_many_large_requests",
                        "dryrun_rate_limited"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "retryAfterSeconds": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The sending service is briefly unavailable, or an attachment scan could not run. Nothing was sent: retry after Retry-After, with the same Idempotency-Key.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "operationId": "sendEmail"
      }
    },
    "/api/system/public-status": {
      "get": {
        "tags": [
          "Status"
        ],
        "summary": "Platform status (overall and per component)",
        "description": "The data behind https://motorical.com/status. No authentication. Cached briefly on the server and by `Cache-Control` (its `max-age` says how long), so polling more often than that returns the same answer. Always answers 200: when the status check itself fails, `status` is `unavailable` and every component is `unavailable` too. A component that is down is reported as `degraded`. It is served from the same servers it reports on, so a failure to reach it is itself a signal. For whether HTTP sending is up, `GET /v1/status` answers too.",
        "security": [],
        "responses": {
          "200": {
            "description": "Current platform status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "status",
                    "updatedAt",
                    "components"
                  ],
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "operational",
                        "degraded",
                        "unavailable"
                      ],
                      "description": "Overall state. Treat an unknown value as degraded."
                    },
                    "message": {
                      "type": "string",
                      "description": "One sentence for people."
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "description": "When these figures were computed."
                    },
                    "components": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "name",
                          "status"
                        ],
                        "properties": {
                          "name": {
                            "type": "string",
                            "description": "For example Delivery Pipeline, Public API, Communications API, Webhook Delivery."
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "operational",
                              "degraded",
                              "unavailable"
                            ]
                          },
                          "summary": {
                            "type": "string"
                          },
                          "metrics": {
                            "type": "object",
                            "additionalProperties": {
                              "type": "string"
                            },
                            "description": "Coarse labels such as normal, elevated, limited or unavailable; never raw numbers."
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "success": true,
                  "status": "operational",
                  "message": "All monitored systems are operating normally.",
                  "updatedAt": "2026-11-27T21:23:48.078Z",
                  "components": [
                    {
                      "name": "Delivery Pipeline",
                      "status": "operational",
                      "summary": "Message processing and delivery automation are monitored continuously.",
                      "metrics": {
                        "queue": "normal",
                        "processing": "normal",
                        "latency": "normal"
                      }
                    }
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Too many requests (code rate_limit_exceeded or RATE_LIMIT_ANONYMOUS); wait X-RateLimit-Reset seconds."
          }
        },
        "operationId": "getPlatformStatus"
      }
    },
    "/v1/status": {
      "get": {
        "tags": [
          "Send"
        ],
        "summary": "Get HTTP Send API service status",
        "responses": {
          "200": {
            "description": "Service status",
            "content": {
              "application/json": {
                "example": {
                  "success": true,
                  "data": {
                    "service": "Motorical API v1",
                    "serviceStatus": "operational",
                    "version": "1.0.0",
                    "timestamp": "2026-11-27T23:04:12.750Z",
                    "endpoints": {
                      "POST /v1/test-email": "Test SMTP configuration",
                      "POST /v1/send": "Send production emails",
                      "GET /v1/status": "API status check"
                    }
                  },
                  "message": "Motorical API v1 is operational"
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": [
                        "boolean",
                        "null"
                      ]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "service": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "serviceStatus": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "version": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "timestamp": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "date-time"
                        },
                        "endpoints": {
                          "type": "object",
                          "properties": {
                            "POST /v1/test-email": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "POST /v1/send": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "GET /v1/status": {
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "additionalProperties": true
                        }
                      },
                      "additionalProperties": true
                    },
                    "message": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "additionalProperties": true,
                  "required": [
                    "success",
                    "data"
                  ],
                  "x-shape-source": "recorded",
                  "description": "Shape of a real response recorded from a live account (fields observed; more may appear; any value may be null)."
                }
              }
            }
          },
          "429": {
            "description": "Too many requests (code rate_limit_exceeded or RATE_LIMIT_ANONYMOUS); wait X-RateLimit-Reset seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            },
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          }
        },
        "operationId": "getSendStatus"
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Short-lived Public Analytics API token used for /api/public/v1 endpoints."
      },
      "dashboardBearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Dashboard session JWT used only to mint Public Analytics API tokens."
      },
      "accountApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization",
        "description": "Account API key for token minting. Format: ApiKey ak_live_..."
      },
      "apiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization",
        "description": "Motor Block API key. Format: ApiKey mk_live_..."
      },
      "xApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Api-Key",
        "description": "Alternative API key header. Use ak_live_... for token minting or mk_live_... for /v1/send."
      },
      "tenantHeaderAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Tenant-Id",
        "description": "Communications Block tenant identifier used to scope lists, templates, campaigns, suppressions, and analytics."
      }
    },
    "schemas": {
      "MotorBlocksListResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "name": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "RateLimitsResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "burst": {
                "$ref": "#/components/schemas/LimitBucket"
              },
              "hourly": {
                "$ref": "#/components/schemas/LimitBucket"
              },
              "daily": {
                "$ref": "#/components/schemas/LimitBucket"
              },
              "limits": {
                "type": "object",
                "description": "Raw customer-configured limits (unaffected by throttling)"
              },
              "throttled": {
                "type": "boolean",
                "description": "Whether a system-imposed throttle is currently lowering the effective ceiling below the configured limits"
              },
              "throttleReason": {
                "type": "string",
                "nullable": true,
                "description": "Reason for the active throttle, if any"
              },
              "timestamp": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          "warning": {
            "type": "string",
            "description": "Present only when counter data was temporarily unavailable; the bucket values are then ceiling-only estimates, not live counts. Note this sits at the response root here, while AccountRateLimitsResponse carries it inside data."
          }
        }
      },
      "AccountRateLimitsResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "hourly": {
                "$ref": "#/components/schemas/AccountLimitBucket"
              },
              "daily": {
                "$ref": "#/components/schemas/AccountLimitBucket"
              },
              "source": {
                "type": "string",
                "description": "Where the account ceiling came from -- \"plan\" or \"fallback\""
              },
              "timestamp": {
                "type": "string",
                "format": "date-time"
              },
              "warning": {
                "type": "string",
                "description": "Present only when account usage data was temporarily unavailable (e.g. a Redis outage); the bucket values above are then fallback estimates, not live counts"
              }
            }
          }
        }
      },
      "AccountLimitBucket": {
        "type": "object",
        "properties": {
          "used": {
            "type": "integer"
          },
          "limit": {
            "type": "integer"
          },
          "remaining": {
            "type": "integer"
          },
          "resetIn": {
            "type": "integer"
          }
        }
      },
      "LimitBucket": {
        "type": "object",
        "properties": {
          "used": {
            "type": "integer"
          },
          "limit": {
            "type": "integer"
          },
          "remaining": {
            "type": "integer"
          },
          "percentage": {
            "type": "integer"
          },
          "resetIn": {
            "type": "integer"
          }
        }
      },
      "LogsResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/LogItem"
                }
              },
              "nextCursor": {
                "type": "string",
                "nullable": true
              }
            }
          }
        }
      },
      "MessageSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "smtpMessageId": {
            "type": "string",
            "nullable": true
          },
          "recipient": {
            "type": "string"
          },
          "currentOutcome": {
            "type": "string",
            "enum": [
              "queued",
              "processed",
              "deferred",
              "delivered",
              "bounced",
              "failed",
              "complained"
            ]
          },
          "smtpCode": {
            "type": "string",
            "nullable": true
          },
          "queuedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "MessageResource": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "smtpMessageId": {
            "type": "string",
            "nullable": true
          },
          "currentOutcome": {
            "type": "string"
          },
          "isTerminal": {
            "type": "boolean"
          },
          "from": {
            "type": "string"
          },
          "recipient": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "queuedAt": {
            "type": "string",
            "format": "date-time"
          },
          "processedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "deliveredAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "bouncedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "smtpCode": {
            "type": "string",
            "nullable": true
          },
          "smtpResponse": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "WebhookEvent": {
        "type": "object",
        "properties": {
          "event": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "smtpMessageId": {
            "type": "string",
            "nullable": true
          },
          "motorBlockId": {
            "type": "string",
            "format": "uuid"
          },
          "from": {
            "type": "string"
          },
          "recipient": {
            "type": "string"
          },
          "recipients": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "subject": {
            "type": "string"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          },
          "currentOutcome": {
            "type": "string"
          },
          "isTerminal": {
            "type": "boolean"
          },
          "smtpCode": {
            "type": "string",
            "nullable": true
          },
          "smtpResponse": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "LogItem": {
        "$ref": "#/components/schemas/MessageSummary"
      },
      "MetricsResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "series": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MetricsPoint"
                }
              },
              "totals": {
                "$ref": "#/components/schemas/MetricsTotals"
              }
            }
          }
        }
      },
      "MetricsPoint": {
        "type": "object",
        "properties": {
          "t": {
            "type": "string",
            "format": "date-time"
          },
          "total": {
            "type": "integer"
          },
          "processed": {
            "type": "integer"
          },
          "delivered": {
            "type": "integer"
          },
          "bounced": {
            "type": "integer"
          },
          "deferred": {
            "type": "integer"
          },
          "failed": {
            "type": "integer"
          },
          "complained": {
            "type": "integer"
          }
        }
      },
      "MetricsTotals": {
        "type": "object",
        "properties": {
          "total": {
            "type": "integer"
          },
          "processed": {
            "type": "integer"
          },
          "delivered": {
            "type": "integer"
          },
          "bounced": {
            "type": "integer"
          },
          "deferred": {
            "type": "integer"
          },
          "failed": {
            "type": "integer"
          },
          "complained": {
            "type": "integer"
          }
        }
      },
      "OverviewResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "timeWindow": {
                "type": "object",
                "properties": {
                  "from": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "to": {
                    "type": "string",
                    "format": "date-time"
                  }
                }
              },
              "totals": {
                "type": "object",
                "properties": {
                  "sent": {
                    "type": "integer"
                  },
                  "delivered": {
                    "type": "integer"
                  },
                  "bounced": {
                    "type": "integer"
                  },
                  "complained": {
                    "type": "integer"
                  }
                }
              },
              "rates": {
                "type": "object",
                "properties": {
                  "deliveryRate": {
                    "type": "number"
                  },
                  "bounceRate": {
                    "type": "number"
                  },
                  "complaintRate": {
                    "type": "number"
                  }
                }
              }
            }
          }
        }
      },
      "MessageResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "$ref": "#/components/schemas/MessageResource"
          }
        }
      },
      "Error": {
        "type": "object",
        "description": "Every error body on this API. Branch on `code` (case-sensitive, never changes once published); never on `error` or `message` text. Every code: https://docs.motorical.com/api-reference/errors",
        "required": [
          "success",
          "error",
          "code"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "const": false
          },
          "code": {
            "type": "string",
            "description": "Stable machine code. New codes are lower snake_case; some older codes are upper case and stay that way. Catalogue: https://docs.motorical.com/api-reference/errors",
            "examples": [
              "api_key_required",
              "VALIDATION_ERROR",
              "rate_limited_block"
            ]
          },
          "error": {
            "type": "string",
            "description": "Short description, or the code itself on some routes. For display, not for branching."
          },
          "message": {
            "type": "string",
            "description": "Human-readable explanation. Can change."
          },
          "requestId": {
            "type": "string",
            "description": "Same value as the X-Request-Id response header."
          },
          "details": {
            "description": "Per-field problems on validation errors, or extra context."
          },
          "nextAction": {
            "type": "object",
            "description": "When present: what to do next, and whether a person must do it (humanRequired).",
            "additionalProperties": true
          },
          "retryAfterSeconds": {
            "type": "integer",
            "description": "On some 429 and 503 answers: seconds to wait. The Retry-After header carries the same value where set."
          }
        },
        "additionalProperties": true,
        "example": {
          "success": false,
          "code": "api_key_required",
          "error": "API key required for /v1/send",
          "message": "API key required for /v1/send: send Authorization: ApiKey mk_live_<prefix>_<secret> (or X-Api-Key), or an OAuth token with send:transactional",
          "requestId": "req_5f0c2a9d4b7e41c3a8e2f6b1"
        }
      }
    },
    "headers": {
      "RequestId": {
        "description": "Unique id of this request, on every response. Quote it to support. A safe caller-supplied X-Request-Id is echoed back.",
        "schema": {
          "type": "string"
        }
      }
    }
  },
  "x-motorical-error-codes": [
    "api_key_required",
    "invalid_api_key",
    "access_token_required",
    "invalid_access_token",
    "invalid_token_type",
    "authorization_revoked",
    "INVALID_TOKEN",
    "TOKEN_EXPIRED",
    "unauthorized",
    "missing_scope",
    "grant_mismatch",
    "delegation_grant_mismatch",
    "motor_block_not_authorized",
    "motor_block_not_owned",
    "motor_block_not_found",
    "motor_block_id_required",
    "motor_block_id_conflict",
    "no_motor_block_covered",
    "oauth_grant_inactive",
    "subscription_required",
    "account_suspended",
    "ACCOUNT_NOT_VERIFIED",
    "use_comms_api",
    "feature_not_enabled",
    "forbidden",
    "MISSING_TOKEN",
    "AUTH_ERROR",
    "MISSING_REFRESH_TOKEN",
    "INVALID_REFRESH_TOKEN",
    "PASSWORD_NOT_SET",
    "PASSWORD_SETUP_NOT_REQUIRED",
    "ACCOUNT_SUSPENDED",
    "SIGNS_IN_ELSEWHERE",
    "VERIFIED_NO_PASSWORD",
    "UNVERIFIED_TOKEN_REFRESHED",
    "UNVERIFIED_EXPIRING_SOON",
    "EMAIL_CODE_REQUIRED",
    "EMAIL_CODE_NOT_APPLICABLE",
    "EMAIL_CODE_RATE_LIMITED",
    "NO_MFA_FACTOR",
    "TOTP_ALREADY_ENABLED",
    "AUTH_RATE_LIMIT",
    "signup_handoff_rate_limit",
    "signup_handoff_status_rate_limit",
    "ACCESS_DENIED",
    "DNS_TOKEN_MISMATCH",
    "DNS_RECORD_NOT_FOUND",
    "DNS_VERIFICATION_FAILED",
    "EMAIL_REQUIRED",
    "INVALID_EMAIL",
    "DOMAIN_HAS_MOTOR_BLOCKS",
    "VALIDATION_ERROR",
    "MISSING_REQUIRED_FIELD",
    "DISALLOWED_HEADERS",
    "ILLEGAL_HEADER_CHARS",
    "conflicting_fields",
    "invalid_attachment",
    "invalid_email",
    "invalid_id",
    "invalid_smtp_code",
    "IDEMPOTENCY_KEY_REQUIRED",
    "IDEMPOTENCY_KEY_INVALID",
    "idempotency_key_conflict",
    "webhook_url_blocked",
    "bad_request",
    "unprocessable",
    "DOMAIN_DNS_INCOMPLETE",
    "recipient_suppressed",
    "content_policy_rejected",
    "attachment_too_large",
    "attachments_total_too_large",
    "too_many_attachments",
    "attachment_type_not_allowed",
    "attachments_not_allowed",
    "payload_too_large",
    "message_too_large",
    "gateway_reply_unreadable",
    "delivery_status_unknown",
    "temporarily_unavailable",
    "sandbox_outbound_locked",
    "sandbox_recipient_denied",
    "allowlist_full",
    "sandbox_monthly_limit",
    "sandbox_dns_unavailable",
    "domain_has_motor_block",
    "free_recipient_not_confirmed",
    "free_policy_unavailable",
    "own_address",
    "recipient_limit",
    "invalid_code",
    "expired",
    "email_send_failed",
    "rate_limited_block",
    "rate_limited_account",
    "rate_limited_warmup",
    "rate_limit_exceeded",
    "RATE_LIMIT_EXCEEDED",
    "RATE_LIMIT_ANONYMOUS",
    "rate_limited",
    "dryrun_rate_limited",
    "too_many_large_requests",
    "allowlist_request_rate_limit",
    "free_recipient_request_rate_limit",
    "NOT_FOUND",
    "not_found",
    "domain_not_found",
    "account_not_found",
    "user_not_found",
    "grant_not_found",
    "not_an_oauth_grant",
    "DUPLICATE_RESOURCE",
    "FOREIGN_KEY_ERROR",
    "conflict",
    "method_not_allowed",
    "INTERNAL_ERROR",
    "APPLICATION_ERROR",
    "SERVICE_UNAVAILABLE",
    "FILE_TOO_LARGE",
    "TOO_MANY_FILES",
    "internal_error",
    "bad_gateway",
    "service_unavailable",
    "gateway_timeout"
  ]
}
