{
  "openapi": "3.1.0",
  "info": {
    "title": "Vaartix API",
    "version": "2026-10-beta",
    "summary": "Transactional email for Indian developers.",
    "description": "The Vaartix REST API. Every request needs an API key in the `Authorization` header:\n\n```\nAuthorization: Bearer vx_live_...\n```\n\nRequest and response bodies are JSON, with camelCase field names. Errors always have the shape\n`{ \"error\": { \"type\": \"...\", \"message\": \"...\" } }`.\n",
    "contact": {
      "email": "hello@vaartix.com"
    }
  },
  "servers": [
    {
      "url": "https://api.vaartix.com"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "tags": [
    {
      "name": "Emails",
      "description": "Send emails and follow what happens to them."
    },
    {
      "name": "Domains",
      "description": "Add and verify the domains you send from."
    },
    {
      "name": "API keys",
      "description": "Create and revoke API keys. Requires a full-access key."
    },
    {
      "name": "Webhooks",
      "description": "Get a signed request on your server when something happens to an email. Requires a full-access key."
    }
  ],
  "paths": {
    "/emails": {
      "post": {
        "tags": [
          "Emails"
        ],
        "operationId": "sendEmail",
        "summary": "Send an email",
        "description": "Accepts an email and queues it for sending. Returns as soon as it is queued; follow its\nprogress with `GET /emails/{id}`.\n\nWorks with send-only and full-access keys. Limited to 10 requests per second per key.\n",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Retrying with the same key within 24 hours returns the first email instead of sending\nagain. Reusing a key with a different body returns `409 idempotency_conflict`.\n",
            "schema": {
              "type": "string",
              "maxLength": 256
            },
            "example": "order-1042-receipt"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendEmailRequest"
              },
              "example": {
                "from": "Acme <orders@acme.in>",
                "to": [
                  "priya@example.com"
                ],
                "subject": "Your Acme order",
                "html": "<p>Thanks for your order, Priya.</p>",
                "tags": [
                  {
                    "name": "category",
                    "value": "receipt"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The email is queued (or scheduled).",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailId"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`domain_not_verified`: the `from` domain is not verified for your team.\n`account_paused`: sending is paused for this account.\n`forbidden`: this key is limited to a different domain.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "type": "domain_not_verified",
                    "message": "acme.in is not verified yet. Check its DNS records."
                  }
                }
              }
            }
          },
          "409": {
            "description": "`idempotency_conflict`: the Idempotency-Key was used with a different request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      },
      "get": {
        "tags": [
          "Emails"
        ],
        "operationId": "listEmails",
        "summary": "List emails",
        "description": "Your team's emails, newest first. Requires a full-access key.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "How many emails to return (1-100).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "before",
            "in": "query",
            "description": "Return emails older than this email ID. Use the last ID of the previous page.",
            "schema": {
              "type": "string"
            },
            "example": "em_7hq2kv9xr4m1c8d3"
          },
          {
            "name": "status",
            "in": "query",
            "description": "Only emails with this status.",
            "schema": {
              "type": "string",
              "enum": [
                "queued",
                "scheduled",
                "sending",
                "sent",
                "delivered",
                "delivery_delayed",
                "bounced",
                "complained",
                "suppressed",
                "failed",
                "canceled"
              ]
            }
          },
          {
            "name": "search",
            "in": "query",
            "description": "Case-insensitive text to find in any recipient, the sender or the subject.",
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "example": "priya@example.com"
          },
          {
            "name": "days",
            "in": "query",
            "description": "Only emails from the last this many days.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 365
            }
          },
          {
            "name": "apiKeyId",
            "in": "query",
            "description": "Only emails sent with this API key.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of emails.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "hasMore"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/EmailSummary"
                      }
                    },
                    "hasMore": {
                      "type": "boolean",
                      "description": "True if older emails exist."
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/emails/batch": {
      "post": {
        "tags": [
          "Emails"
        ],
        "operationId": "sendBatch",
        "summary": "Send a batch",
        "description": "Up to 100 emails in one request. All emails are validated first: if any is invalid, none\nare sent and the error message starts with its index, for example `[3]`. Batch emails\ncannot have attachments or `scheduledAt`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "minItems": 1,
                "maxItems": 100,
                "items": {
                  "$ref": "#/components/schemas/BatchEmail"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "All emails are queued, in the same order as the request.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/EmailId"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "429": {
            "$ref": "#/components/responses/TooManyRequests"
          }
        }
      }
    },
    "/emails/{id}": {
      "get": {
        "tags": [
          "Emails"
        ],
        "operationId": "getEmail",
        "summary": "Get an email",
        "description": "An email with its content and full event timeline. Requires a full-access key.",
        "parameters": [
          {
            "$ref": "#/components/parameters/EmailIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "The email.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Email"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/emails/{id}/cancel": {
      "post": {
        "tags": [
          "Emails"
        ],
        "operationId": "cancelEmail",
        "summary": "Cancel a scheduled email",
        "description": "Cancels an email that is still `scheduled`. Its recipients are given back to today's\ndaily limit. Emails that are already being sent cannot be canceled.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/EmailIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "The canceled email.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailSummary"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "description": "`conflict`: only scheduled emails can be canceled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/domains": {
      "get": {
        "tags": [
          "Domains"
        ],
        "operationId": "listDomains",
        "summary": "List domains",
        "responses": {
          "200": {
            "description": "Your team's domains.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Domain"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      },
      "post": {
        "tags": [
          "Domains"
        ],
        "operationId": "addDomain",
        "summary": "Add a domain",
        "description": "Registers a domain and returns the DNS records to publish. Vaartix checks the records\nevery 10 minutes for 72 hours; call `POST /domains/{id}/verify` to check immediately.\nA domain can belong to one team only. The Free plan allows one domain.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "The domain or subdomain you will send from.",
                    "example": "acme.in"
                  },
                  "returnPath": {
                    "type": "string",
                    "enum": [
                      "vxmail"
                    ],
                    "deprecated": true,
                    "description": "Not needed. The return path (MAIL FROM), which Gmail shows as \"mailed-by\" under \"Show details\", is always `vxmail.<domain>` (`vx-bounces.<domain>` only if vxmail.<domain> already has an MX, CNAME or SPF record, or can't be checked). `vxmail` is accepted for older clients; any other value is refused (`400`)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The domain, with its DNS records.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Domain"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "`forbidden`: your plan does not allow more domains, or the key is send-only.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`conflict`: the domain is already registered with Vaartix.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/domains/{id}": {
      "get": {
        "tags": [
          "Domains"
        ],
        "operationId": "getDomain",
        "summary": "Get a domain",
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "The domain.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Domain"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "patch": {
        "tags": [
          "Domains"
        ],
        "operationId": "updateDomain",
        "summary": "Change a domain's tracking defaults",
        "description": "Turns open and click tracking on or off for emails sent from this domain. Both are off until you turn them on, and each email can override them with `tracking`. Don't use click tracking for password reset, magic link or one-time code emails. Owners and admins only.",
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainIdPath"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "openTracking": {
                    "type": "boolean",
                    "description": "Add an open-tracking pixel to HTML emails."
                  },
                  "clickTracking": {
                    "type": "boolean",
                    "description": "Rewrite links in HTML emails to count clicks."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The domain.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Domain"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "tags": [
          "Domains"
        ],
        "operationId": "deleteDomain",
        "summary": "Delete a domain",
        "description": "Removes the domain. Emails can no longer be sent from it.",
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainIdPath"
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/domains/{id}/return-path": {
      "put": {
        "tags": [
          "Domains"
        ],
        "operationId": "setReturnPath",
        "summary": "Move the return path to vxmail",
        "description": "Moves a domain added before `vxmail` was the standard (on `vx-bounces`, or a subdomain chosen back then) to vxmail.<domain>, so Gmail's \"Show details\" shows \"mailed-by vxmail.acme.in\". The return path can't be anything else: other values are refused (`400`), and asking for `vxmail` on a domain already there changes nothing. Publish the new MX and TXT records the response lists; sending carries on meanwhile, with Amazon SES's own return path until they verify. Refused (`409`) if vxmail.<domain> already has MX records (pointing it at Vaartix would stop it receiving email), a CNAME or an SPF record. Owners and admins only.",
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainIdPath"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "subdomain"
                ],
                "properties": {
                  "subdomain": {
                    "type": "string",
                    "enum": [
                      "vxmail"
                    ],
                    "description": "Always `vxmail` (`vxmail.<domain>` is accepted too).",
                    "example": "vxmail"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The domain, with the new return-path records.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Domain"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/domains/{id}/verify": {
      "post": {
        "tags": [
          "Domains"
        ],
        "operationId": "verifyDomain",
        "summary": "Check a domain now",
        "description": "Checks the DNS records immediately and returns the updated domain.",
        "parameters": [
          {
            "$ref": "#/components/parameters/DomainIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "The domain with its latest status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Domain"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api-keys": {
      "get": {
        "tags": [
          "API keys"
        ],
        "operationId": "listApiKeys",
        "summary": "List API keys",
        "description": "Active keys. The key itself is never returned again after creation.",
        "responses": {
          "200": {
            "description": "Your team's API keys.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiKey"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      },
      "post": {
        "tags": [
          "API keys"
        ],
        "operationId": "createApiKey",
        "summary": "Create an API key",
        "description": "The response contains the key once. Store it in a secret manager; Vaartix only keeps a hash.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60,
                    "example": "Production server"
                  },
                  "scope": {
                    "type": "string",
                    "enum": [
                      "send",
                      "full"
                    ],
                    "default": "send",
                    "description": "`send` can only send emails. `full` can also read emails and manage domains and keys."
                  },
                  "domainIds": {
                    "type": [
                      "array",
                      "null"
                    ],
                    "items": {
                      "type": "string"
                    },
                    "maxItems": 50,
                    "description": "Limit the key to sending from these domains (IDs from `GET /domains`). Leave out to allow all of the team's domains."
                  },
                  "preset": {
                    "type": "string",
                    "enum": [
                      "agent"
                    ],
                    "description": "`agent`: a key for an AI agent or MCP server. It starts with no email content, test addresses only, 20 emails an hour and 50 a day (any `limits` you send are applied on top), and is labelled as an AI agent key."
                  },
                  "limits": {
                    "$ref": "#/components/schemas/ApiKeyLimits",
                    "description": "Optional limits. Leave out for none."
                  },
                  "domainId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "deprecated": true,
                    "description": "The older form of `domainIds` with a single domain. Still accepted."
                  },
                  "expiresAt": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time",
                    "description": "When the key stops working, at most 2 years ahead. Leave out for a key that doesn't expire."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new key, including the secret token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiKeyCreated"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/api-keys/{id}": {
      "delete": {
        "tags": [
          "API keys"
        ],
        "operationId": "revokeApiKey",
        "summary": "Revoke an API key",
        "description": "The key stops working immediately.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "key_02qa6ntf6p3nd3ng"
          }
        ],
        "responses": {
          "204": {
            "description": "Revoked."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/metrics": {
      "get": {
        "tags": [
          "Emails"
        ],
        "operationId": "getMetrics",
        "summary": "Get sending metrics",
        "description": "Daily counts for the last `days` days (in IST, today included), with delivery, bounce and\ncomplaint rates. Counts are per recipient; test-mode emails are not counted. Requires a\nfull-access key.\n",
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 90,
              "default": 15
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Metrics.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Metrics"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      }
    },
    "/webhooks": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "listWebhooks",
        "summary": "List webhook endpoints",
        "responses": {
          "200": {
            "description": "Your team's endpoints. Signing secrets are not included.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Webhook"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          }
        }
      },
      "post": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "createWebhook",
        "summary": "Create a webhook endpoint",
        "description": "Vaartix sends a signed `POST` to the URL for each event you choose. The response includes\nthe signing secret once; store it to verify requests. A team can have up to 10 endpoints.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url",
                  "events"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri",
                    "description": "A public `https://` URL.",
                    "example": "https://api.acme.in/webhooks/vaartix"
                  },
                  "events": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "$ref": "#/components/schemas/WebhookEventType"
                    },
                    "example": [
                      "email.delivered",
                      "email.bounced",
                      "email.complained"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The new endpoint, including its signing secret.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookCreated"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    },
    "/webhooks/{id}": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "getWebhook",
        "summary": "Get a webhook endpoint",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "The endpoint.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Webhook"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "patch": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "updateWebhook",
        "summary": "Update a webhook endpoint",
        "description": "Change the URL or events, or turn the endpoint off and on. Turning it off cancels its\npending deliveries. Turning it back on resets its failure count.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookIdPath"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "events": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "$ref": "#/components/schemas/WebhookEventType"
                    }
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "enabled",
                      "disabled"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated endpoint.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Webhook"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationError"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "delete": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "deleteWebhook",
        "summary": "Delete a webhook endpoint",
        "description": "The endpoint and its delivery log are deleted.",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookIdPath"
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted."
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/webhooks/{id}/rotate-secret": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "rotateWebhookSecret",
        "summary": "Rotate the signing secret",
        "description": "Creates a new signing secret. The old one stops working immediately.",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookIdPath"
          }
        ],
        "responses": {
          "200": {
            "description": "The endpoint with its new secret.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookCreated"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/webhooks/{id}/deliveries": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "listWebhookDeliveries",
        "summary": "List deliveries",
        "description": "The most recent deliveries to this endpoint, newest first, with your server's response.",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookIdPath"
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deliveries.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/WebhookDelivery"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/webhooks/{id}/deliveries/{deliveryId}/retry": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "operationId": "retryWebhookDelivery",
        "summary": "Retry a delivery",
        "description": "Sends the delivery again from the first attempt, with the same `webhook-id`, so your\nserver can recognise it. The endpoint must be enabled.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookIdPath"
          },
          {
            "name": "deliveryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "whd_8m3k1q7v2c9x4d6p"
          }
        ],
        "responses": {
          "202": {
            "description": "Queued for sending.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDelivery"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          }
        }
      }
    }
  },
  "webhooks": {
    "emailEvent": {
      "post": {
        "summary": "Email event",
        "description": "What Vaartix sends to your endpoint. Verify the `webhook-signature` header before trusting\nthe body (see the Webhooks guide), answer with any 2xx status within 10 seconds, and do slow\nwork afterwards. Other responses are retried for about 24 hours.\n",
        "parameters": [
          {
            "name": "webhook-id",
            "in": "header",
            "required": true,
            "description": "Unique per delivery and the same on every retry. Use it to ignore duplicates.",
            "schema": {
              "type": "string",
              "example": "whd_8m3k1q7v2c9x4d6p"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "required": true,
            "description": "Unix time in seconds when this attempt was signed.",
            "schema": {
              "type": "string",
              "example": "1793181600"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "required": true,
            "description": "`v1,` followed by the base64 HMAC-SHA256 of `webhook-id.webhook-timestamp.body`.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookPayload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx response marks the delivery as succeeded."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "An API key starting with `vx_live_`."
      }
    },
    "parameters": {
      "EmailIdPath": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        },
        "example": "em_7hq2kv9xr4m1c8d3"
      },
      "DomainIdPath": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        },
        "example": "dom_5bvatg1v837anztd"
      },
      "WebhookIdPath": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string"
        },
        "example": "wh_4n8x2k7q1m9c3v5d"
      }
    },
    "headers": {
      "RateLimitLimit": {
        "description": "Requests allowed per second for this key.",
        "schema": {
          "type": "integer",
          "example": 10
        }
      },
      "RateLimitRemaining": {
        "description": "Requests left in the current second.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimitReset": {
        "description": "Seconds until the limit resets.",
        "schema": {
          "type": "integer"
        }
      }
    },
    "responses": {
      "ValidationError": {
        "description": "`validation_error`: the request is invalid. The message says which field and why.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": {
                "type": "validation_error",
                "message": "to: \"priya@\" is not a valid email address."
              }
            }
          }
        }
      },
      "Unauthorized": {
        "description": "`unauthorized`: the API key is missing, invalid or revoked.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden": {
        "description": "`forbidden`: the key cannot do this, for example a send-only key on a management endpoint.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "`not_found`: no such resource in your team.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Conflict": {
        "description": "`conflict`: the request clashes with the current state, for example too many endpoints.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "TooManyRequests": {
        "description": "`rate_limited`: more than 10 requests in one second (see the `Retry-After` header).\n`daily_quota_exceeded`: your team's daily limit is used up; it resets at midnight IST.\n",
        "headers": {
          "Retry-After": {
            "description": "Seconds to wait before retrying (rate limits only).",
            "schema": {
              "type": "integer"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "type",
              "message"
            ],
            "properties": {
              "type": {
                "type": "string",
                "description": "Stable, machine-readable error type.",
                "enum": [
                  "validation_error",
                  "unauthorized",
                  "forbidden",
                  "not_found",
                  "conflict",
                  "rate_limited",
                  "daily_quota_exceeded",
                  "domain_not_verified",
                  "invalid_from_address",
                  "account_paused",
                  "domain_needs_review",
                  "content_rejected",
                  "idempotency_conflict",
                  "bad_request",
                  "internal_error"
                ]
              },
              "message": {
                "type": "string",
                "description": "Human-readable explanation, safe to show to developers."
              }
            }
          }
        }
      },
      "AddressList": {
        "description": "One address or a list. Addresses can include a name, e.g. `Priya Sharma <priya@example.com>`.",
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        ]
      },
      "Tag": {
        "type": "object",
        "required": [
          "name",
          "value"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,256}$",
            "example": "category"
          },
          "value": {
            "type": "string",
            "pattern": "^[A-Za-z0-9_-]{1,256}$",
            "example": "receipt"
          }
        }
      },
      "Attachment": {
        "type": "object",
        "required": [
          "filename",
          "content"
        ],
        "properties": {
          "filename": {
            "type": "string",
            "example": "invoice-1042.pdf"
          },
          "content": {
            "type": "string",
            "contentEncoding": "base64",
            "description": "Base64-encoded file content."
          },
          "contentType": {
            "type": "string",
            "description": "Detected from the filename if omitted.",
            "example": "application/pdf"
          },
          "contentId": {
            "type": "string",
            "description": "For inline images. Reference it in your HTML as `cid:<contentId>`."
          }
        }
      },
      "BatchEmail": {
        "type": "object",
        "required": [
          "from",
          "to",
          "subject"
        ],
        "properties": {
          "from": {
            "type": "string",
            "description": "Must be on a domain your team has verified (or a subdomain of it), or `test.vaartix.com` for test mode.",
            "example": "Acme <orders@acme.in>"
          },
          "to": {
            "$ref": "#/components/schemas/AddressList"
          },
          "cc": {
            "$ref": "#/components/schemas/AddressList"
          },
          "bcc": {
            "$ref": "#/components/schemas/AddressList"
          },
          "replyTo": {
            "$ref": "#/components/schemas/AddressList"
          },
          "subject": {
            "type": "string",
            "maxLength": 998
          },
          "html": {
            "type": "string",
            "description": "HTML body. Provide `html`, `text` or both."
          },
          "text": {
            "type": "string",
            "description": "Plain-text body."
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Custom headers such as `List-Unsubscribe`. Standard headers (From, To, Subject, ...) cannot be set."
          },
          "tags": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/Tag"
            }
          },
          "tracking": {
            "$ref": "#/components/schemas/TrackingSettings"
          }
        }
      },
      "TrackingSettings": {
        "type": "object",
        "additionalProperties": false,
        "description": "Open and click tracking for this email, overriding the sending domain's defaults (both off unless changed). A field left out uses the domain's setting. Only HTML parts are tracked.",
        "properties": {
          "opens": {
            "type": "boolean",
            "description": "Add an open-tracking pixel."
          },
          "clicks": {
            "type": "boolean",
            "description": "Rewrite http and https links to count clicks."
          }
        },
        "example": {
          "opens": true,
          "clicks": false
        }
      },
      "SendEmailRequest": {
        "allOf": [
          {
            "$ref": "#/components/schemas/BatchEmail"
          },
          {
            "type": "object",
            "properties": {
              "attachments": {
                "type": "array",
                "description": "Up to 30 MB in total. Executable files are not allowed.",
                "items": {
                  "$ref": "#/components/schemas/Attachment"
                }
              },
              "scheduledAt": {
                "type": "string",
                "format": "date-time",
                "description": "Send later, up to 30 days ahead. Times in the past send immediately.",
                "example": "2026-11-01T09:00:00+05:30"
              }
            }
          }
        ]
      },
      "EmailId": {
        "type": "object",
        "required": [
          "id"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "em_7hq2kv9xr4m1c8d3"
          }
        }
      },
      "EmailStatus": {
        "type": "string",
        "description": "See the status guide for what each one means.",
        "enum": [
          "queued",
          "scheduled",
          "sending",
          "sent",
          "delivered",
          "delivery_delayed",
          "bounced",
          "complained",
          "suppressed",
          "failed",
          "canceled"
        ]
      },
      "EmailSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "from": {
            "type": "string"
          },
          "to": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "cc": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "bcc": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "replyTo": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "subject": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/EmailStatus"
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Tag"
            }
          },
          "tracking": {
            "description": "The email's own tracking setting, or null to use the domain's defaults.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/TrackingSettings"
              },
              {
                "type": "null"
              }
            ]
          },
          "attachments": {
            "type": "array",
            "description": "Attachment details (the content is not kept after sending).",
            "items": {
              "type": "object",
              "properties": {
                "filename": {
                  "type": "string"
                },
                "contentType": {
                  "type": "string"
                },
                "size": {
                  "type": "integer",
                  "description": "Size in bytes."
                }
              }
            }
          },
          "scheduledAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "sentAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "lastEventAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "error": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why the email failed, if it did."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EmailEvent": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "sent",
              "delivered",
              "delivery_delayed",
              "bounced",
              "complained",
              "rejected",
              "rendering_failure",
              "suppressed",
              "opened",
              "clicked"
            ]
          },
          "recipient": {
            "type": [
              "string",
              "null"
            ]
          },
          "data": {
            "type": "object",
            "description": "Details such as the bounce type, the SMTP response or the suppression reason. For `delivery_delayed` a `DelayedEventDetails`, for `bounced` a `BouncedEventDetails` (including the receiving server's reply, `diagnosticCode`). For `opened` and `clicked`: `machine` and `machineReason` (privacy proxies and link scanners), `userAgentFamily`, `country`, `asn`, and for clicks `link` and `linkIndex`. No IP address is stored."
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Email": {
        "allOf": [
          {
            "$ref": "#/components/schemas/EmailSummary"
          },
          {
            "type": "object",
            "properties": {
              "html": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "text": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "headers": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "events": {
                "type": "array",
                "description": "Oldest first.",
                "items": {
                  "$ref": "#/components/schemas/EmailEvent"
                }
              }
            }
          }
        ]
      },
      "DnsRecord": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "CNAME",
              "MX",
              "TXT"
            ]
          },
          "name": {
            "type": "string",
            "example": "vxmail.mail.acme.in",
            "description": "Full record name."
          },
          "host": {
            "type": "string",
            "example": "vxmail.mail",
            "description": "The name relative to the registrable domain (by the public suffix list), which is what goes in a DNS provider's Name or Host field. `@` for the registrable domain itself."
          },
          "value": {
            "type": "string",
            "example": "feedback-smtp.ap-south-1.amazonses.com"
          },
          "priority": {
            "type": "integer",
            "description": "MX records only."
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "verified",
              "failed"
            ],
            "description": "For the optional DMARC record: `verified` when a DMARC record was found (on the domain or its registrable domain) at the last check, `pending` when not, and left out until the domain has been checked once."
          },
          "optional": {
            "type": "boolean",
            "description": "True for the recommended DMARC record: it isn't needed to send, so its status doesn't affect the domain's status."
          }
        }
      },
      "Domain": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "dom_5bvatg1v837anztd"
          },
          "name": {
            "type": "string",
            "example": "acme.in"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "verified",
              "failed",
              "temporary_failure"
            ]
          },
          "region": {
            "type": "string",
            "example": "ap-south-1"
          },
          "records": {
            "type": "array",
            "description": "The DKIM TXT record (`vaartix._domainkey`, with the domain's public key), the MAIL FROM MX and SPF TXT records on the return path (`vxmail` for new domains, `vx-bounces` if vxmail was in use and for older domains), and a recommended DMARC TXT record. Domains added before 30 October 2026 show three DKIM CNAME records and `send` instead.",
            "example": [
              {
                "type": "TXT",
                "name": "vaartix._domainkey.acme.in",
                "host": "vaartix._domainkey",
                "value": "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...",
                "status": "pending"
              },
              {
                "type": "MX",
                "name": "vxmail.acme.in",
                "host": "vxmail",
                "value": "feedback-smtp.ap-south-1.amazonses.com",
                "priority": 10,
                "status": "pending"
              },
              {
                "type": "TXT",
                "name": "vxmail.acme.in",
                "host": "vxmail",
                "value": "v=spf1 include:amazonses.com ~all",
                "status": "pending"
              },
              {
                "type": "TXT",
                "name": "_dmarc.acme.in",
                "host": "_dmarc",
                "value": "v=DMARC1; p=none;"
              }
            ],
            "items": {
              "$ref": "#/components/schemas/DnsRecord"
            }
          },
          "returnPath": {
            "type": [
              "string",
              "null"
            ],
            "description": "The return-path (MAIL FROM) domain: where bounces go, and what Gmail shows as \"mailed-by\" under \"Show details\". Always `vxmail.<domain>`, except `vx-bounces.<domain>` when vxmail was in use, and on domains added before vxmail was the standard (which can move with `PUT /domains/{id}/return-path`).",
            "example": "vxmail.acme.in"
          },
          "openTracking": {
            "type": "boolean",
            "description": "Default for emails from this domain. Off unless turned on."
          },
          "clickTracking": {
            "type": "boolean",
            "description": "Default for emails from this domain. Off unless turned on."
          },
          "verifiedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "lastCheckedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ApiKey": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "prefix": {
            "type": "string",
            "description": "The first characters of the key, to recognise it.",
            "example": "vx_live_pt7m"
          },
          "scope": {
            "type": "string",
            "enum": [
              "send",
              "full"
            ]
          },
          "domainRestricted": {
            "type": "boolean",
            "description": "Whether the key may only send from `domainIds`. A restricted key whose domains were all deleted can't send from any domain except test.vaartix.com."
          },
          "domainIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The domains a restricted key may send from. Empty for an unrestricted key."
          },
          "domainId": {
            "type": [
              "string",
              "null"
            ],
            "deprecated": true,
            "description": "Set when the key is limited to exactly one domain. Use `domainIds`."
          },
          "expiresAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the key stops working, or null if it doesn't expire. Expired keys still appear in `GET /api-keys`."
          },
          "limits": {
            "$ref": "#/components/schemas/ApiKeyLimits"
          },
          "lastUsedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "revokedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ApiKeyLimits": {
        "type": "object",
        "description": "Optional limits, mostly for keys an AI agent uses (for example with the vaartix-mcp package). A key has none unless you set them; owners and admins change them in the dashboard. Sends that break a limit are refused with 403 (`recipient_not_allowed`, `from_not_allowed`) or 429 (`cap_hourly`, `cap_daily`).",
        "properties": {
          "agent": {
            "type": "boolean",
            "description": "Created with the `agent` preset. Only a label; the other fields are what's enforced."
          },
          "readContent": {
            "type": "boolean",
            "description": "Whether `GET /emails/{id}` returns the email's HTML, text and headers. Always false for send-only keys."
          },
          "recipients": {
            "type": "object",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "any",
                  "list",
                  "test"
                ],
                "description": "`any`: no limit. `list`: only the addresses or domains in `list`. `test`: only test addresses such as delivered@test.vaartix.com."
              },
              "list": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "allowedFrom": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "The only From addresses it may use, or null for any (on its allowed domains)."
          },
          "hourlyCap": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Emails it may send per rolling hour",
            "or null for no cap.": null
          },
          "dailyCap": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Emails it may send per day (midnight IST)",
            "or null for no cap.": null
          }
        }
      },
      "ApiKeyCreated": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ApiKey"
          },
          {
            "type": "object",
            "required": [
              "token"
            ],
            "properties": {
              "token": {
                "type": "string",
                "description": "The API key. Shown only in this response.",
                "example": "vx_live_pt7m2k9xr4m1c8d3hq2kv9xr4m1c8d3"
              }
            }
          }
        ]
      },
      "WebhookEventType": {
        "type": "string",
        "enum": [
          "email.sent",
          "email.delivered",
          "email.delivery_delayed",
          "email.bounced",
          "email.complained",
          "email.rejected",
          "email.rendering_failure",
          "email.suppressed",
          "email.opened",
          "email.clicked"
        ]
      },
      "Webhook": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "wh_4n8x2k7q1m9c3v5d"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookEventType"
            }
          },
          "status": {
            "type": "string",
            "enum": [
              "enabled",
              "disabled"
            ],
            "description": "Endpoints are turned off automatically after 5 deliveries in a row fail every attempt."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "WebhookCreated": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Webhook"
          },
          {
            "type": "object",
            "required": [
              "secret"
            ],
            "properties": {
              "secret": {
                "type": "string",
                "description": "The signing secret. Shown only when created or rotated.",
                "example": "whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw"
              }
            }
          }
        ]
      },
      "WebhookDelivery": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Also sent as the `webhook-id` header."
          },
          "type": {
            "$ref": "#/components/schemas/WebhookEventType"
          },
          "eventId": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "succeeded",
              "failed"
            ]
          },
          "attempts": {
            "type": "integer"
          },
          "responseStatus": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Your server's HTTP status on the last attempt, or null if it couldn't be reached."
          },
          "responseBody": {
            "type": [
              "string",
              "null"
            ],
            "description": "The first 2 KB of your server's response, or the connection error."
          },
          "nextAttemptAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "deliveredAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "payload": {
            "$ref": "#/components/schemas/WebhookPayload"
          }
        }
      },
      "WebhookPayload": {
        "type": "object",
        "required": [
          "type",
          "createdAt",
          "data"
        ],
        "properties": {
          "type": {
            "$ref": "#/components/schemas/WebhookEventType"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the event happened."
          },
          "data": {
            "type": "object",
            "properties": {
              "emailId": {
                "type": "string",
                "example": "em_7hq2kv9xr4m1c8d3"
              },
              "eventId": {
                "type": "string",
                "example": "evt_2m9k4q7v1c8x3d6p"
              },
              "recipient": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The address this event is about, for per-recipient events.",
                "example": "priya@example.com"
              },
              "from": {
                "type": "string",
                "example": "Acme <login@acme.in>"
              },
              "to": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "cc": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "bcc": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "subject": {
                "type": "string",
                "example": "Your login code"
              },
              "tags": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    }
                  }
                }
              },
              "emailCreatedAt": {
                "type": "string",
                "format": "date-time"
              },
              "details": {
                "type": "object",
                "additionalProperties": true,
                "description": "Event details, such as the bounce type or SMTP response from the mail provider. For `email.delivery_delayed` it is a `DelayedEventDetails`, for `email.bounced` a `BouncedEventDetails`, for `email.opened` an `OpenedEventDetails`, for `email.clicked` a `ClickedEventDetails`."
              }
            }
          }
        }
      },
      "DelayedEventDetails": {
        "type": "object",
        "description": "`details` of an `email.delivery_delayed` event, and `data` of a `delivery_delayed` event: the receiving server temporarily refused the email, and Amazon SES keeps retrying until `expirationTime`. One event per delayed recipient. Soft bounces are also recorded as `delivery_delayed`; they carry `BouncedEventDetails` fields (`bounceType` `Transient`) instead of `delayType`.",
        "properties": {
          "delayType": {
            "type": "string",
            "description": "Why, as Amazon SES reports it: `InternalFailure`, `General`, `MailboxFull`, `SpamDetected`, `RecipientServerError`, `IPFailure`, `TransientCommunicationFailure`, `BYOIPHostNameLookupUnavailable` or `Undetermined`; more may be added.",
            "example": "TransientCommunicationFailure"
          },
          "expirationTime": {
            "type": "string",
            "format": "date-time",
            "description": "When Amazon SES stops retrying. If it still fails then, a bounce follows."
          },
          "diagnosticCode": {
            "type": "string",
            "maxLength": 1000,
            "description": "The receiving server's reply for this recipient, word for word. Absent when the mail provider didn't report one (it is kept for delays recorded from 14 November 2026).",
            "example": "smtp; 421 4.7.0 [TSS04] Messages from 54.240.0.1 temporarily deferred due to unexpected volume or user complaints - 4.16.55.1; see https://postmaster.yahooinc.com/error-codes"
          },
          "statusCode": {
            "type": "string",
            "description": "The enhanced SMTP status code for this recipient, when reported.",
            "example": "4.7.0"
          }
        },
        "example": {
          "delayType": "TransientCommunicationFailure",
          "expirationTime": "2026-11-15T10:00:00.000Z",
          "diagnosticCode": "smtp; 421 4.7.0 [TSS04] Messages from 54.240.0.1 temporarily deferred due to unexpected volume or user complaints - 4.16.55.1; see https://postmaster.yahooinc.com/error-codes",
          "statusCode": "4.7.0"
        }
      },
      "BouncedEventDetails": {
        "type": "object",
        "description": "`details` of an `email.bounced` event (and of a soft bounce, recorded as `delivery_delayed`). One event per bounced recipient.",
        "properties": {
          "bounceType": {
            "type": "string",
            "enum": [
              "Permanent",
              "Transient",
              "Undetermined"
            ]
          },
          "bounceSubType": {
            "type": "string",
            "description": "Amazon SES's bounce subtype, such as `General`, `NoEmail` or `MailboxFull`.",
            "example": "General"
          },
          "diagnosticCode": {
            "type": "string",
            "maxLength": 1000,
            "description": "The receiving server's reply for this recipient, word for word, when reported (kept per recipient for bounces recorded from 14 November 2026).",
            "example": "smtp; 550 5.1.1 user unknown"
          },
          "statusCode": {
            "type": "string",
            "description": "The enhanced SMTP status code for this recipient, when reported.",
            "example": "5.1.1"
          },
          "diagnostics": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "deprecated": true,
            "description": "Every bounced recipient's reply in the same notification. Use `diagnosticCode`, which is this recipient's only."
          }
        },
        "example": {
          "bounceType": "Permanent",
          "bounceSubType": "General",
          "diagnosticCode": "smtp; 550 5.1.1 user unknown",
          "statusCode": "5.1.1",
          "diagnostics": [
            "smtp; 550 5.1.1 user unknown"
          ]
        }
      },
      "OpenedEventDetails": {
        "type": "object",
        "required": [
          "machine",
          "machineReason",
          "userAgentFamily",
          "country",
          "asn"
        ],
        "description": "`details` of an `email.opened` event. No IP address or full user agent is stored or sent. `recipient` is null when the email had more than one recipient.",
        "properties": {
          "machine": {
            "type": "boolean",
            "description": "True when the open was most likely not a person: an image proxy, Apple Mail Privacy Protection, or a fetch within 2 seconds of sending."
          },
          "machineReason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "image_proxy",
              "apple_mpp",
              "too_fast",
              null
            ],
            "description": "Why `machine` is true; null when it is false."
          },
          "userAgentFamily": {
            "type": "string",
            "description": "The user agent reduced to a family name. One of `Gmail image proxy`, `Yahoo image proxy`, `scanner`, `Outlook`, `Thunderbird`, `Edge`, `Samsung Internet`, `Opera`, `Firefox`, `Chrome`, `Safari`, `Apple Mail`, `other`, `unknown`; more may be added.",
            "example": "Chrome"
          },
          "country": {
            "type": [
              "string",
              "null"
            ],
            "description": "Two-letter country code (ISO 3166-1), or null when unknown.",
            "example": "IN"
          },
          "asn": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The network (autonomous system number) the request came from, or null.",
            "example": 24560
          }
        },
        "example": {
          "machine": true,
          "machineReason": "image_proxy",
          "userAgentFamily": "Gmail image proxy",
          "country": "US",
          "asn": 15169
        }
      },
      "ClickedEventDetails": {
        "type": "object",
        "required": [
          "machine",
          "machineReason",
          "linkIndex",
          "link",
          "userAgentFamily",
          "country",
          "asn"
        ],
        "description": "`details` of an `email.clicked` event. No IP address or full user agent is stored or sent. `recipient` is null when the email had more than one recipient.",
        "properties": {
          "machine": {
            "type": "boolean",
            "description": "True when the click was most likely not a person: a link scanner, a security vendor's network, a click within 10 seconds of delivery, or different links clicked within 1 second."
          },
          "machineReason": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "scanner",
              "scanner_network",
              "too_fast",
              "burst",
              null
            ],
            "description": "Why `machine` is true; null when it is false."
          },
          "linkIndex": {
            "type": "integer",
            "minimum": 0,
            "description": "The link's position among the email's tracked links, from 0."
          },
          "link": {
            "type": "string",
            "format": "uri",
            "description": "The original URL that was clicked."
          },
          "userAgentFamily": {
            "type": "string",
            "description": "The same families as in `OpenedEventDetails`.",
            "example": "Chrome"
          },
          "country": {
            "type": [
              "string",
              "null"
            ],
            "description": "Two-letter country code (ISO 3166-1), or null when unknown.",
            "example": "IN"
          },
          "asn": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The network (autonomous system number) the request came from, or null.",
            "example": 24560
          }
        },
        "example": {
          "machine": false,
          "machineReason": null,
          "linkIndex": 0,
          "link": "https://acme.in/orders/123",
          "userAgentFamily": "Chrome",
          "country": "IN",
          "asn": 24560
        }
      },
      "Metrics": {
        "type": "object",
        "properties": {
          "days": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "day": {
                  "type": "string",
                  "format": "date",
                  "example": "2026-10-28"
                },
                "sent": {
                  "type": "integer"
                },
                "delivered": {
                  "type": "integer"
                },
                "bounced": {
                  "type": "integer"
                },
                "complained": {
                  "type": "integer"
                }
              }
            }
          },
          "totals": {
            "type": "object",
            "properties": {
              "sent": {
                "type": "integer"
              },
              "delivered": {
                "type": "integer"
              },
              "bounced": {
                "type": "integer"
              },
              "complained": {
                "type": "integer"
              }
            }
          },
          "rates": {
            "type": "object",
            "description": "Shares of `totals.sent`, from 0 to 1.",
            "properties": {
              "delivered": {
                "type": "number",
                "example": 0.982
              },
              "bounced": {
                "type": "number",
                "example": 0.011
              },
              "complained": {
                "type": "number",
                "example": 0.0002
              }
            }
          },
          "limits": {
            "type": "object",
            "description": "Above these rates over 7 days (after 100 emails), sending is paused automatically.",
            "properties": {
              "bounceRate": {
                "type": "number",
                "example": 0.04
              },
              "complaintRate": {
                "type": "number",
                "example": 0.0008
              }
            }
          },
          "today": {
            "type": "object",
            "properties": {
              "sent": {
                "type": "integer"
              },
              "dailyLimit": {
                "type": "integer"
              }
            }
          }
        }
      }
    }
  }
}
