{
  "openapi": "3.1.1",
  "info": {
    "title": "Tellnod API",
    "version": "2026-11-10",
    "summary": "Contacts, events, email drafts, test sends and results for Tellnod workspaces.",
    "description": "The public REST API of Tellnod (v1). JSON with snake_case fields and ISO 8601 times; lists are cursor pages (limit, starting_after); every write that creates, changes or sends honours Idempotency-Key for 24 hours; every response carries Request-Id; errors have one shape.\n\nVersions are dates sent as Tellnod-Version (latest 2026-11-10); a breaking change only ever appears in a new date. info.version is the latest date.\n\nRate limits are per key per minute by plan (free 60, trial 120, starter 300, growth 600), reported in RateLimit-* headers; over the limit is a 429 with Retry-After.\n\nA tn_test_ key behaves like a live key but delivers only to the workspace's own verified addresses.",
    "contact": {
      "name": "Tellnod",
      "url": "https://tellnod.com/docs/api"
    },
    "x-tellnod-versions": [
      "2026-11-10"
    ]
  },
  "jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
  "servers": [
    {
      "url": "https://api.tellnod.com/v1",
      "description": "Production"
    },
    {
      "url": "https://mcp.tellnod.com/v1",
      "description": "Production, until api.tellnod.com is mapped (kept during the move)"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Account",
      "description": "The workspace, its plan and usage"
    },
    {
      "name": "Contacts",
      "description": "People, their consent and subscription state"
    },
    {
      "name": "Events",
      "description": "Orders and browsing events from the store"
    },
    {
      "name": "Messages",
      "description": "Email drafts"
    },
    {
      "name": "Sends",
      "description": "Test sends (campaigns are confirmed in Tellnod)"
    },
    {
      "name": "Results",
      "description": "Delivery, engagement and revenue"
    },
    {
      "name": "Insights",
      "description": "Where the store's recoverable revenue is (estimates)"
    },
    {
      "name": "Meta",
      "description": "This document"
    }
  ],
  "paths": {
    "/openapi.json": {
      "get": {
        "operationId": "getOpenApiDocument",
        "tags": [
          "Meta"
        ],
        "summary": "This document",
        "description": "The OpenAPI 3.1 document of this API version. No API key needed; cacheable for 5 minutes.",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/TellnodVersion"
          }
        ],
        "responses": {
          "200": {
            "description": "The document",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Tellnod-Version": {
                "$ref": "#/components/headers/Tellnod-Version"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/Cache-Control"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenApiDocument"
                }
              }
            }
          },
          "400": {
            "description": "Error: version_invalid",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "version_invalid": {
                    "$ref": "#/components/examples/version_invalid"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "version_invalid"
            ]
          },
          "500": {
            "description": "Error: internal_error",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "$ref": "#/components/examples/internal_error"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "internal_error"
            ]
          }
        },
        "x-tellnod-scopes": [],
        "x-tellnod-idempotent": false
      }
    },
    "/workspace": {
      "get": {
        "operationId": "getWorkspace",
        "tags": [
          "Account"
        ],
        "summary": "Get the workspace",
        "description": "The workspace the key belongs to: plan, limits, review state and the sending domain, and the key itself. Any valid key may read it.",
        "parameters": [
          {
            "$ref": "#/components/parameters/TellnodVersion"
          }
        ],
        "responses": {
          "200": {
            "description": "The workspace",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Tellnod-Version": {
                "$ref": "#/components/headers/Tellnod-Version"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Workspace"
                },
                "example": {
                  "object": "workspace",
                  "id": "f1e2d3c4-b5a6-4978-8a6b-5c4d3e2f1a0b",
                  "name": "Ninefold",
                  "plan": "starter",
                  "status": "active",
                  "approved_for_sending": true,
                  "frozen": false,
                  "created_at": "2026-10-21T02:00:00.000Z",
                  "billing": {
                    "status": "active",
                    "trial_ends_at": null,
                    "restriction": null,
                    "grace_ends_at": null
                  },
                  "limits": {
                    "contacts": 2500,
                    "emails_per_month": 8000
                  },
                  "sending_domain": {
                    "domain": "ninefold.com",
                    "status": "verified",
                    "spf": true,
                    "dkim": true,
                    "dmarc": true
                  },
                  "api_key": {
                    "id": "9a8b7c6d-5e4f-4a3b-9c2d-1e0f9a8b7c6d",
                    "name": "Ninefold storefront",
                    "mode": "live",
                    "scopes": [
                      "contacts:read",
                      "contacts:write",
                      "segments:read",
                      "segments:write",
                      "events:write",
                      "messages:read",
                      "messages:write",
                      "sends:read",
                      "webhooks:read",
                      "webhooks:write",
                      "results:read"
                    ],
                    "prefix": "tn_live_7Qk2mX9a"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Error: version_invalid",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "version_invalid": {
                    "$ref": "#/components/examples/version_invalid"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "version_invalid"
            ]
          },
          "401": {
            "description": "Error: api_key_missing, api_key_invalid, api_key_revoked, api_key_expired, api_key_inactive",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "api_key_missing": {
                    "$ref": "#/components/examples/api_key_missing"
                  },
                  "api_key_invalid": {
                    "$ref": "#/components/examples/api_key_invalid"
                  },
                  "api_key_revoked": {
                    "$ref": "#/components/examples/api_key_revoked"
                  },
                  "api_key_expired": {
                    "$ref": "#/components/examples/api_key_expired"
                  },
                  "api_key_inactive": {
                    "$ref": "#/components/examples/api_key_inactive"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "api_key_missing",
              "api_key_invalid",
              "api_key_revoked",
              "api_key_expired",
              "api_key_inactive"
            ]
          },
          "429": {
            "description": "Error: rate_limited",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "$ref": "#/components/examples/rate_limited"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "description": "Error: internal_error",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "$ref": "#/components/examples/internal_error"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "internal_error"
            ]
          }
        },
        "x-tellnod-scopes": [],
        "x-tellnod-idempotent": false
      }
    },
    "/usage": {
      "get": {
        "operationId": "getUsage",
        "tags": [
          "Account"
        ],
        "summary": "Get usage",
        "description": "This month's emails and contacts against the plan, and the key's rate limit. Any valid key may read it.",
        "parameters": [
          {
            "$ref": "#/components/parameters/TellnodVersion"
          }
        ],
        "responses": {
          "200": {
            "description": "Usage",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Tellnod-Version": {
                "$ref": "#/components/headers/Tellnod-Version"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Usage"
                },
                "example": {
                  "object": "usage",
                  "workspace_id": "f1e2d3c4-b5a6-4978-8a6b-5c4d3e2f1a0b",
                  "plan": "starter",
                  "emails": {
                    "sent_this_month": 1240,
                    "monthly_limit": 8000,
                    "send_pack_balance": 0
                  },
                  "contacts": {
                    "total": 1832,
                    "sendable": 1790,
                    "limit": 2500
                  },
                  "rate_limit": {
                    "requests_per_minute": 300
                  },
                  "api_key": {
                    "id": "9a8b7c6d-5e4f-4a3b-9c2d-1e0f9a8b7c6d",
                    "name": "Ninefold storefront",
                    "mode": "live",
                    "scopes": [
                      "contacts:read",
                      "contacts:write",
                      "segments:read",
                      "segments:write",
                      "events:write",
                      "messages:read",
                      "messages:write",
                      "sends:read",
                      "webhooks:read",
                      "webhooks:write",
                      "results:read"
                    ],
                    "prefix": "tn_live_7Qk2mX9a"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Error: version_invalid",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "version_invalid": {
                    "$ref": "#/components/examples/version_invalid"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "version_invalid"
            ]
          },
          "401": {
            "description": "Error: api_key_missing, api_key_invalid, api_key_revoked, api_key_expired, api_key_inactive",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "api_key_missing": {
                    "$ref": "#/components/examples/api_key_missing"
                  },
                  "api_key_invalid": {
                    "$ref": "#/components/examples/api_key_invalid"
                  },
                  "api_key_revoked": {
                    "$ref": "#/components/examples/api_key_revoked"
                  },
                  "api_key_expired": {
                    "$ref": "#/components/examples/api_key_expired"
                  },
                  "api_key_inactive": {
                    "$ref": "#/components/examples/api_key_inactive"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "api_key_missing",
              "api_key_invalid",
              "api_key_revoked",
              "api_key_expired",
              "api_key_inactive"
            ]
          },
          "429": {
            "description": "Error: rate_limited",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "$ref": "#/components/examples/rate_limited"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "description": "Error: internal_error",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "$ref": "#/components/examples/internal_error"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "internal_error"
            ]
          }
        },
        "x-tellnod-scopes": [],
        "x-tellnod-idempotent": false
      }
    },
    "/contacts": {
      "get": {
        "operationId": "listContacts",
        "tags": [
          "Contacts"
        ],
        "summary": "List contacts",
        "description": "Contacts, newest first. Deleted people are not listed.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/StartingAfter"
          },
          {
            "$ref": "#/components/parameters/TellnodVersion"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of contacts",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Tellnod-Version": {
                "$ref": "#/components/headers/Tellnod-Version"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactList"
                },
                "example": {
                  "object": "list",
                  "data": [
                    {
                      "object": "contact",
                      "id": "0b6f3c1e-5a2d-4e8f-9c71-3d2a6b8e4f10",
                      "email": "mia.chen@example.com",
                      "first_name": "Mia",
                      "last_name": "Chen",
                      "phone": "+886912345678",
                      "consent": "granted",
                      "consent_source": "import:customers.csv",
                      "consent_at": "2026-11-10T08:15:00.000Z",
                      "subscription_status": "subscribed",
                      "paused": false,
                      "unsubscribed_at": null,
                      "tags": [
                        "vip",
                        "autumn-2026"
                      ],
                      "attributes": {
                        "city": "Taipei",
                        "size": "M"
                      },
                      "created_at": "2026-11-10T08:15:00.000Z"
                    }
                  ],
                  "has_more": true,
                  "next_cursor": "0b6f3c1e-5a2d-4e8f-9c71-3d2a6b8e4f10"
                }
              }
            }
          },
          "400": {
            "description": "Error: version_invalid, parameter_invalid",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "version_invalid": {
                    "$ref": "#/components/examples/version_invalid"
                  },
                  "parameter_invalid": {
                    "$ref": "#/components/examples/parameter_invalid"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "version_invalid",
              "parameter_invalid"
            ]
          },
          "401": {
            "description": "Error: api_key_missing, api_key_invalid, api_key_revoked, api_key_expired, api_key_inactive",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "api_key_missing": {
                    "$ref": "#/components/examples/api_key_missing"
                  },
                  "api_key_invalid": {
                    "$ref": "#/components/examples/api_key_invalid"
                  },
                  "api_key_revoked": {
                    "$ref": "#/components/examples/api_key_revoked"
                  },
                  "api_key_expired": {
                    "$ref": "#/components/examples/api_key_expired"
                  },
                  "api_key_inactive": {
                    "$ref": "#/components/examples/api_key_inactive"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "api_key_missing",
              "api_key_invalid",
              "api_key_revoked",
              "api_key_expired",
              "api_key_inactive"
            ]
          },
          "403": {
            "description": "Error: scope_required",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_required": {
                    "$ref": "#/components/examples/scope_required"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "scope_required"
            ]
          },
          "429": {
            "description": "Error: rate_limited",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "$ref": "#/components/examples/rate_limited"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "description": "Error: internal_error",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "$ref": "#/components/examples/internal_error"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "internal_error"
            ]
          }
        },
        "x-tellnod-scopes": [
          "contacts:read"
        ],
        "x-tellnod-idempotent": false
      },
      "post": {
        "operationId": "upsertContact",
        "tags": [
          "Contacts"
        ],
        "summary": "Create or update a contact",
        "description": "Upserts one contact by email through the same rules as a file import: plan limits, prior opt-outs and deleted people hold, and an unsubscribed person is never subscribed again. A new contact needs consent.",
        "parameters": [
          {
            "$ref": "#/components/parameters/TellnodVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactInput"
              },
              "example": {
                "email": "mia.chen@example.com",
                "first_name": "Mia",
                "last_name": "Chen",
                "phone": "+886912345678",
                "consent": "granted",
                "tags": [
                  "vip"
                ],
                "attributes": {
                  "city": "Taipei",
                  "size": "M"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated (the email was already a contact)",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Tellnod-Version": {
                "$ref": "#/components/headers/Tellnod-Version"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                }
              }
            }
          },
          "201": {
            "description": "Created",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Tellnod-Version": {
                "$ref": "#/components/headers/Tellnod-Version"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                },
                "example": {
                  "object": "contact",
                  "id": "0b6f3c1e-5a2d-4e8f-9c71-3d2a6b8e4f10",
                  "email": "mia.chen@example.com",
                  "first_name": "Mia",
                  "last_name": "Chen",
                  "phone": "+886912345678",
                  "consent": "granted",
                  "consent_source": "import:customers.csv",
                  "consent_at": "2026-11-10T08:15:00.000Z",
                  "subscription_status": "subscribed",
                  "paused": false,
                  "unsubscribed_at": null,
                  "tags": [
                    "vip",
                    "autumn-2026"
                  ],
                  "attributes": {
                    "city": "Taipei",
                    "size": "M"
                  },
                  "created_at": "2026-11-10T08:15:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Error: version_invalid, invalid_json, parameter_invalid, parameter_unknown, idempotency_key_invalid, parameter_missing, email_invalid, phone_invalid, consent_required, field_read_only",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "version_invalid": {
                    "$ref": "#/components/examples/version_invalid"
                  },
                  "invalid_json": {
                    "$ref": "#/components/examples/invalid_json"
                  },
                  "parameter_invalid": {
                    "$ref": "#/components/examples/parameter_invalid"
                  },
                  "parameter_unknown": {
                    "$ref": "#/components/examples/parameter_unknown"
                  },
                  "idempotency_key_invalid": {
                    "$ref": "#/components/examples/idempotency_key_invalid"
                  },
                  "parameter_missing": {
                    "$ref": "#/components/examples/parameter_missing"
                  },
                  "email_invalid": {
                    "$ref": "#/components/examples/email_invalid"
                  },
                  "phone_invalid": {
                    "$ref": "#/components/examples/phone_invalid"
                  },
                  "consent_required": {
                    "$ref": "#/components/examples/consent_required"
                  },
                  "field_read_only": {
                    "$ref": "#/components/examples/field_read_only"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "version_invalid",
              "invalid_json",
              "parameter_invalid",
              "parameter_unknown",
              "idempotency_key_invalid",
              "parameter_missing",
              "email_invalid",
              "phone_invalid",
              "consent_required",
              "field_read_only"
            ]
          },
          "401": {
            "description": "Error: api_key_missing, api_key_invalid, api_key_revoked, api_key_expired, api_key_inactive",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "api_key_missing": {
                    "$ref": "#/components/examples/api_key_missing"
                  },
                  "api_key_invalid": {
                    "$ref": "#/components/examples/api_key_invalid"
                  },
                  "api_key_revoked": {
                    "$ref": "#/components/examples/api_key_revoked"
                  },
                  "api_key_expired": {
                    "$ref": "#/components/examples/api_key_expired"
                  },
                  "api_key_inactive": {
                    "$ref": "#/components/examples/api_key_inactive"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "api_key_missing",
              "api_key_invalid",
              "api_key_revoked",
              "api_key_expired",
              "api_key_inactive"
            ]
          },
          "403": {
            "description": "Error: scope_required, contact_limit_exceeded",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_required": {
                    "$ref": "#/components/examples/scope_required"
                  },
                  "contact_limit_exceeded": {
                    "$ref": "#/components/examples/contact_limit_exceeded"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "scope_required",
              "contact_limit_exceeded"
            ]
          },
          "409": {
            "description": "Error: idempotency_conflict, idempotency_in_progress, contact_deleted",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "idempotency_conflict": {
                    "$ref": "#/components/examples/idempotency_conflict"
                  },
                  "idempotency_in_progress": {
                    "$ref": "#/components/examples/idempotency_in_progress"
                  },
                  "contact_deleted": {
                    "$ref": "#/components/examples/contact_deleted"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "idempotency_conflict",
              "idempotency_in_progress",
              "contact_deleted"
            ]
          },
          "413": {
            "description": "Error: body_too_large",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "body_too_large": {
                    "$ref": "#/components/examples/body_too_large"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "body_too_large"
            ]
          },
          "429": {
            "description": "Error: rate_limited",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "$ref": "#/components/examples/rate_limited"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "description": "Error: internal_error",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "$ref": "#/components/examples/internal_error"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "internal_error"
            ]
          }
        },
        "x-tellnod-scopes": [
          "contacts:write"
        ],
        "x-tellnod-idempotent": true
      }
    },
    "/contacts/batch": {
      "post": {
        "operationId": "upsertContacts",
        "tags": [
          "Contacts"
        ],
        "summary": "Create or update contacts in a batch",
        "description": "Up to 1,000 contacts with one result per row; an invalid row never stops the others. Counts once toward the rate limit.",
        "parameters": [
          {
            "$ref": "#/components/parameters/TellnodVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactBatchInput"
              },
              "example": {
                "contacts": [
                  {
                    "email": "mia.chen@example.com",
                    "first_name": "Mia",
                    "last_name": "Chen",
                    "phone": "+886912345678",
                    "consent": "granted",
                    "tags": [
                      "vip"
                    ],
                    "attributes": {
                      "city": "Taipei",
                      "size": "M"
                    }
                  },
                  {
                    "email": "leo.wang@example.com",
                    "first_name": "Leo",
                    "consent": "denied"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "One result per row, in order",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Tellnod-Version": {
                "$ref": "#/components/headers/Tellnod-Version"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactBatchResult"
                },
                "example": {
                  "object": "contact_batch",
                  "created": 1,
                  "updated": 0,
                  "skipped": 0,
                  "failed": 1,
                  "results": [
                    {
                      "index": 0,
                      "outcome": "created",
                      "id": "0b6f3c1e-5a2d-4e8f-9c71-3d2a6b8e4f10",
                      "error": null
                    },
                    {
                      "index": 1,
                      "outcome": "failed",
                      "id": null,
                      "error": {
                        "code": "email_invalid",
                        "message": "email must be a valid email address.",
                        "param": "contacts[1].email"
                      }
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Error: version_invalid, invalid_json, parameter_invalid, parameter_unknown, idempotency_key_invalid",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "version_invalid": {
                    "$ref": "#/components/examples/version_invalid"
                  },
                  "invalid_json": {
                    "$ref": "#/components/examples/invalid_json"
                  },
                  "parameter_invalid": {
                    "$ref": "#/components/examples/parameter_invalid"
                  },
                  "parameter_unknown": {
                    "$ref": "#/components/examples/parameter_unknown"
                  },
                  "idempotency_key_invalid": {
                    "$ref": "#/components/examples/idempotency_key_invalid"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "version_invalid",
              "invalid_json",
              "parameter_invalid",
              "parameter_unknown",
              "idempotency_key_invalid"
            ]
          },
          "401": {
            "description": "Error: api_key_missing, api_key_invalid, api_key_revoked, api_key_expired, api_key_inactive",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "api_key_missing": {
                    "$ref": "#/components/examples/api_key_missing"
                  },
                  "api_key_invalid": {
                    "$ref": "#/components/examples/api_key_invalid"
                  },
                  "api_key_revoked": {
                    "$ref": "#/components/examples/api_key_revoked"
                  },
                  "api_key_expired": {
                    "$ref": "#/components/examples/api_key_expired"
                  },
                  "api_key_inactive": {
                    "$ref": "#/components/examples/api_key_inactive"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "api_key_missing",
              "api_key_invalid",
              "api_key_revoked",
              "api_key_expired",
              "api_key_inactive"
            ]
          },
          "403": {
            "description": "Error: scope_required, contact_limit_exceeded",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_required": {
                    "$ref": "#/components/examples/scope_required"
                  },
                  "contact_limit_exceeded": {
                    "$ref": "#/components/examples/contact_limit_exceeded"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "scope_required",
              "contact_limit_exceeded"
            ]
          },
          "409": {
            "description": "Error: idempotency_conflict, idempotency_in_progress",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "idempotency_conflict": {
                    "$ref": "#/components/examples/idempotency_conflict"
                  },
                  "idempotency_in_progress": {
                    "$ref": "#/components/examples/idempotency_in_progress"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "idempotency_conflict",
              "idempotency_in_progress"
            ]
          },
          "413": {
            "description": "Error: body_too_large",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "body_too_large": {
                    "$ref": "#/components/examples/body_too_large"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "body_too_large"
            ]
          },
          "429": {
            "description": "Error: rate_limited",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "$ref": "#/components/examples/rate_limited"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "description": "Error: internal_error",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "$ref": "#/components/examples/internal_error"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "internal_error"
            ]
          }
        },
        "x-tellnod-scopes": [
          "contacts:write"
        ],
        "x-tellnod-idempotent": true
      }
    },
    "/contacts/{id}": {
      "get": {
        "operationId": "getContact",
        "tags": [
          "Contacts"
        ],
        "summary": "Get a contact",
        "description": "One contact with its consent and subscription state.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The contact's id. An id of another workspace is the same 404 as an unknown one.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/TellnodVersion"
          }
        ],
        "responses": {
          "200": {
            "description": "The contact",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Tellnod-Version": {
                "$ref": "#/components/headers/Tellnod-Version"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                },
                "example": {
                  "object": "contact",
                  "id": "0b6f3c1e-5a2d-4e8f-9c71-3d2a6b8e4f10",
                  "email": "mia.chen@example.com",
                  "first_name": "Mia",
                  "last_name": "Chen",
                  "phone": "+886912345678",
                  "consent": "granted",
                  "consent_source": "import:customers.csv",
                  "consent_at": "2026-11-10T08:15:00.000Z",
                  "subscription_status": "subscribed",
                  "paused": false,
                  "unsubscribed_at": null,
                  "tags": [
                    "vip",
                    "autumn-2026"
                  ],
                  "attributes": {
                    "city": "Taipei",
                    "size": "M"
                  },
                  "created_at": "2026-11-10T08:15:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Error: version_invalid",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "version_invalid": {
                    "$ref": "#/components/examples/version_invalid"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "version_invalid"
            ]
          },
          "401": {
            "description": "Error: api_key_missing, api_key_invalid, api_key_revoked, api_key_expired, api_key_inactive",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "api_key_missing": {
                    "$ref": "#/components/examples/api_key_missing"
                  },
                  "api_key_invalid": {
                    "$ref": "#/components/examples/api_key_invalid"
                  },
                  "api_key_revoked": {
                    "$ref": "#/components/examples/api_key_revoked"
                  },
                  "api_key_expired": {
                    "$ref": "#/components/examples/api_key_expired"
                  },
                  "api_key_inactive": {
                    "$ref": "#/components/examples/api_key_inactive"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "api_key_missing",
              "api_key_invalid",
              "api_key_revoked",
              "api_key_expired",
              "api_key_inactive"
            ]
          },
          "403": {
            "description": "Error: scope_required",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_required": {
                    "$ref": "#/components/examples/scope_required"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "scope_required"
            ]
          },
          "404": {
            "description": "Error: not_found",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "not_found": {
                    "$ref": "#/components/examples/not_found"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "not_found"
            ]
          },
          "429": {
            "description": "Error: rate_limited",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "$ref": "#/components/examples/rate_limited"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "description": "Error: internal_error",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "$ref": "#/components/examples/internal_error"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "internal_error"
            ]
          }
        },
        "x-tellnod-scopes": [
          "contacts:read"
        ],
        "x-tellnod-idempotent": false
      },
      "patch": {
        "operationId": "updateContact",
        "tags": [
          "Contacts"
        ],
        "summary": "Update a contact",
        "description": "Names, phone, consent, tags (added) and attributes (merged). email and subscription state cannot change here.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The contact's id. An id of another workspace is the same 404 as an unknown one.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/TellnodVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactUpdate"
              },
              "example": {
                "tags": [
                  "autumn-2026"
                ],
                "attributes": {
                  "size": "S"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated contact",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Tellnod-Version": {
                "$ref": "#/components/headers/Tellnod-Version"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                },
                "example": {
                  "object": "contact",
                  "id": "0b6f3c1e-5a2d-4e8f-9c71-3d2a6b8e4f10",
                  "email": "mia.chen@example.com",
                  "first_name": "Mia",
                  "last_name": "Chen",
                  "phone": "+886912345678",
                  "consent": "granted",
                  "consent_source": "import:customers.csv",
                  "consent_at": "2026-11-10T08:15:00.000Z",
                  "subscription_status": "subscribed",
                  "paused": false,
                  "unsubscribed_at": null,
                  "tags": [
                    "vip",
                    "autumn-2026"
                  ],
                  "attributes": {
                    "city": "Taipei",
                    "size": "M"
                  },
                  "created_at": "2026-11-10T08:15:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Error: version_invalid, invalid_json, parameter_invalid, parameter_unknown, idempotency_key_invalid, phone_invalid, field_read_only, contact_has_no_email",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "version_invalid": {
                    "$ref": "#/components/examples/version_invalid"
                  },
                  "invalid_json": {
                    "$ref": "#/components/examples/invalid_json"
                  },
                  "parameter_invalid": {
                    "$ref": "#/components/examples/parameter_invalid"
                  },
                  "parameter_unknown": {
                    "$ref": "#/components/examples/parameter_unknown"
                  },
                  "idempotency_key_invalid": {
                    "$ref": "#/components/examples/idempotency_key_invalid"
                  },
                  "phone_invalid": {
                    "$ref": "#/components/examples/phone_invalid"
                  },
                  "field_read_only": {
                    "$ref": "#/components/examples/field_read_only"
                  },
                  "contact_has_no_email": {
                    "$ref": "#/components/examples/contact_has_no_email"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "version_invalid",
              "invalid_json",
              "parameter_invalid",
              "parameter_unknown",
              "idempotency_key_invalid",
              "phone_invalid",
              "field_read_only",
              "contact_has_no_email"
            ]
          },
          "401": {
            "description": "Error: api_key_missing, api_key_invalid, api_key_revoked, api_key_expired, api_key_inactive",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "api_key_missing": {
                    "$ref": "#/components/examples/api_key_missing"
                  },
                  "api_key_invalid": {
                    "$ref": "#/components/examples/api_key_invalid"
                  },
                  "api_key_revoked": {
                    "$ref": "#/components/examples/api_key_revoked"
                  },
                  "api_key_expired": {
                    "$ref": "#/components/examples/api_key_expired"
                  },
                  "api_key_inactive": {
                    "$ref": "#/components/examples/api_key_inactive"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "api_key_missing",
              "api_key_invalid",
              "api_key_revoked",
              "api_key_expired",
              "api_key_inactive"
            ]
          },
          "403": {
            "description": "Error: scope_required",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_required": {
                    "$ref": "#/components/examples/scope_required"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "scope_required"
            ]
          },
          "404": {
            "description": "Error: not_found",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "not_found": {
                    "$ref": "#/components/examples/not_found"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "not_found"
            ]
          },
          "409": {
            "description": "Error: idempotency_conflict, idempotency_in_progress",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "idempotency_conflict": {
                    "$ref": "#/components/examples/idempotency_conflict"
                  },
                  "idempotency_in_progress": {
                    "$ref": "#/components/examples/idempotency_in_progress"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "idempotency_conflict",
              "idempotency_in_progress"
            ]
          },
          "413": {
            "description": "Error: body_too_large",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "body_too_large": {
                    "$ref": "#/components/examples/body_too_large"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "body_too_large"
            ]
          },
          "429": {
            "description": "Error: rate_limited",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "$ref": "#/components/examples/rate_limited"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "description": "Error: internal_error",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "$ref": "#/components/examples/internal_error"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "internal_error"
            ]
          }
        },
        "x-tellnod-scopes": [
          "contacts:write"
        ],
        "x-tellnod-idempotent": true
      },
      "delete": {
        "operationId": "deleteContact",
        "tags": [
          "Contacts"
        ],
        "summary": "Delete a contact",
        "description": "Erases the person, or keeps only a do-not-email record when they had unsubscribed, bounced or complained, so they are never emailed again.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The contact's id. An id of another workspace is the same 404 as an unknown one.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/TellnodVersion"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Tellnod-Version": {
                "$ref": "#/components/headers/Tellnod-Version"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedContact"
                },
                "example": {
                  "object": "contact",
                  "id": "0b6f3c1e-5a2d-4e8f-9c71-3d2a6b8e4f10",
                  "deleted": true,
                  "outcome": "deleted"
                }
              }
            }
          },
          "400": {
            "description": "Error: version_invalid",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "version_invalid": {
                    "$ref": "#/components/examples/version_invalid"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "version_invalid"
            ]
          },
          "401": {
            "description": "Error: api_key_missing, api_key_invalid, api_key_revoked, api_key_expired, api_key_inactive",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "api_key_missing": {
                    "$ref": "#/components/examples/api_key_missing"
                  },
                  "api_key_invalid": {
                    "$ref": "#/components/examples/api_key_invalid"
                  },
                  "api_key_revoked": {
                    "$ref": "#/components/examples/api_key_revoked"
                  },
                  "api_key_expired": {
                    "$ref": "#/components/examples/api_key_expired"
                  },
                  "api_key_inactive": {
                    "$ref": "#/components/examples/api_key_inactive"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "api_key_missing",
              "api_key_invalid",
              "api_key_revoked",
              "api_key_expired",
              "api_key_inactive"
            ]
          },
          "403": {
            "description": "Error: scope_required",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_required": {
                    "$ref": "#/components/examples/scope_required"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "scope_required"
            ]
          },
          "404": {
            "description": "Error: not_found",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "not_found": {
                    "$ref": "#/components/examples/not_found"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "not_found"
            ]
          },
          "429": {
            "description": "Error: rate_limited",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "$ref": "#/components/examples/rate_limited"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "description": "Error: internal_error",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "$ref": "#/components/examples/internal_error"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "internal_error"
            ]
          }
        },
        "x-tellnod-scopes": [
          "contacts:write"
        ],
        "x-tellnod-idempotent": false
      }
    },
    "/contacts/{id}/unsubscribe": {
      "post": {
        "operationId": "unsubscribeContact",
        "tags": [
          "Contacts"
        ],
        "summary": "Unsubscribe a contact",
        "description": "Stops email to this contact on the business's side (paused: true). Reversible in Tellnod; the recipient's own unsubscribe is not.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The contact's id. An id of another workspace is the same 404 as an unknown one.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/TellnodVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "The contact, unsubscribed",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Tellnod-Version": {
                "$ref": "#/components/headers/Tellnod-Version"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Contact"
                },
                "example": {
                  "object": "contact",
                  "id": "0b6f3c1e-5a2d-4e8f-9c71-3d2a6b8e4f10",
                  "email": "mia.chen@example.com",
                  "first_name": "Mia",
                  "last_name": "Chen",
                  "phone": "+886912345678",
                  "consent": "granted",
                  "consent_source": "import:customers.csv",
                  "consent_at": "2026-11-10T08:15:00.000Z",
                  "subscription_status": "unsubscribed",
                  "paused": true,
                  "unsubscribed_at": "2026-11-10T09:00:00.000Z",
                  "tags": [
                    "vip",
                    "autumn-2026"
                  ],
                  "attributes": {
                    "city": "Taipei",
                    "size": "M"
                  },
                  "created_at": "2026-11-10T08:15:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Error: version_invalid, idempotency_key_invalid",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "version_invalid": {
                    "$ref": "#/components/examples/version_invalid"
                  },
                  "idempotency_key_invalid": {
                    "$ref": "#/components/examples/idempotency_key_invalid"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "version_invalid",
              "idempotency_key_invalid"
            ]
          },
          "401": {
            "description": "Error: api_key_missing, api_key_invalid, api_key_revoked, api_key_expired, api_key_inactive",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "api_key_missing": {
                    "$ref": "#/components/examples/api_key_missing"
                  },
                  "api_key_invalid": {
                    "$ref": "#/components/examples/api_key_invalid"
                  },
                  "api_key_revoked": {
                    "$ref": "#/components/examples/api_key_revoked"
                  },
                  "api_key_expired": {
                    "$ref": "#/components/examples/api_key_expired"
                  },
                  "api_key_inactive": {
                    "$ref": "#/components/examples/api_key_inactive"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "api_key_missing",
              "api_key_invalid",
              "api_key_revoked",
              "api_key_expired",
              "api_key_inactive"
            ]
          },
          "403": {
            "description": "Error: scope_required",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_required": {
                    "$ref": "#/components/examples/scope_required"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "scope_required"
            ]
          },
          "404": {
            "description": "Error: not_found",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "not_found": {
                    "$ref": "#/components/examples/not_found"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "not_found"
            ]
          },
          "409": {
            "description": "Error: idempotency_conflict, idempotency_in_progress",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "idempotency_conflict": {
                    "$ref": "#/components/examples/idempotency_conflict"
                  },
                  "idempotency_in_progress": {
                    "$ref": "#/components/examples/idempotency_in_progress"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "idempotency_conflict",
              "idempotency_in_progress"
            ]
          },
          "429": {
            "description": "Error: rate_limited",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "$ref": "#/components/examples/rate_limited"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "description": "Error: internal_error",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "$ref": "#/components/examples/internal_error"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "internal_error"
            ]
          }
        },
        "x-tellnod-scopes": [
          "contacts:write"
        ],
        "x-tellnod-idempotent": true
      }
    },
    "/events": {
      "post": {
        "operationId": "recordEvent",
        "tags": [
          "Events"
        ],
        "summary": "Record an event",
        "description": "One store event of a known contact. Orders go through the same path as an order import; product, cart and checkout events feed segments, product interest and journeys. Events of people who are not contacts are unmatched and not kept.",
        "parameters": [
          {
            "$ref": "#/components/parameters/TellnodVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventInput"
              },
              "example": {
                "type": "order.created",
                "id": "order-10482",
                "email": "mia.chen@example.com",
                "occurred_at": "2026-11-10T08:30:00.000Z",
                "data": {
                  "order_id": "10482",
                  "currency": "TWD",
                  "items": [
                    {
                      "handle": "wool-overshirt",
                      "title": "Wool overshirt",
                      "quantity": 1,
                      "price": 2980
                    }
                  ]
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Recorded, a duplicate, unmatched or too old",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Tellnod-Version": {
                "$ref": "#/components/headers/Tellnod-Version"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Event"
                },
                "example": {
                  "object": "event",
                  "id": "order-10482",
                  "type": "order.created",
                  "status": "recorded"
                }
              }
            }
          },
          "400": {
            "description": "Error: version_invalid, invalid_json, parameter_invalid, parameter_unknown, idempotency_key_invalid, parameter_missing, event_type_invalid, event_type_not_supported, email_invalid",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "version_invalid": {
                    "$ref": "#/components/examples/version_invalid"
                  },
                  "invalid_json": {
                    "$ref": "#/components/examples/invalid_json"
                  },
                  "parameter_invalid": {
                    "$ref": "#/components/examples/parameter_invalid"
                  },
                  "parameter_unknown": {
                    "$ref": "#/components/examples/parameter_unknown"
                  },
                  "idempotency_key_invalid": {
                    "$ref": "#/components/examples/idempotency_key_invalid"
                  },
                  "parameter_missing": {
                    "$ref": "#/components/examples/parameter_missing"
                  },
                  "event_type_invalid": {
                    "$ref": "#/components/examples/event_type_invalid"
                  },
                  "event_type_not_supported": {
                    "$ref": "#/components/examples/event_type_not_supported"
                  },
                  "email_invalid": {
                    "$ref": "#/components/examples/email_invalid"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "version_invalid",
              "invalid_json",
              "parameter_invalid",
              "parameter_unknown",
              "idempotency_key_invalid",
              "parameter_missing",
              "event_type_invalid",
              "event_type_not_supported",
              "email_invalid"
            ]
          },
          "401": {
            "description": "Error: api_key_missing, api_key_invalid, api_key_revoked, api_key_expired, api_key_inactive",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "api_key_missing": {
                    "$ref": "#/components/examples/api_key_missing"
                  },
                  "api_key_invalid": {
                    "$ref": "#/components/examples/api_key_invalid"
                  },
                  "api_key_revoked": {
                    "$ref": "#/components/examples/api_key_revoked"
                  },
                  "api_key_expired": {
                    "$ref": "#/components/examples/api_key_expired"
                  },
                  "api_key_inactive": {
                    "$ref": "#/components/examples/api_key_inactive"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "api_key_missing",
              "api_key_invalid",
              "api_key_revoked",
              "api_key_expired",
              "api_key_inactive"
            ]
          },
          "403": {
            "description": "Error: scope_required",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_required": {
                    "$ref": "#/components/examples/scope_required"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "scope_required"
            ]
          },
          "409": {
            "description": "Error: idempotency_conflict, idempotency_in_progress",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "idempotency_conflict": {
                    "$ref": "#/components/examples/idempotency_conflict"
                  },
                  "idempotency_in_progress": {
                    "$ref": "#/components/examples/idempotency_in_progress"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "idempotency_conflict",
              "idempotency_in_progress"
            ]
          },
          "413": {
            "description": "Error: body_too_large",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "body_too_large": {
                    "$ref": "#/components/examples/body_too_large"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "body_too_large"
            ]
          },
          "429": {
            "description": "Error: rate_limited",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "$ref": "#/components/examples/rate_limited"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "description": "Error: internal_error",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "$ref": "#/components/examples/internal_error"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "internal_error"
            ]
          }
        },
        "x-tellnod-scopes": [
          "events:write"
        ],
        "x-tellnod-idempotent": true
      }
    },
    "/events/batch": {
      "post": {
        "operationId": "recordEvents",
        "tags": [
          "Events"
        ],
        "summary": "Record events in a batch",
        "description": "Up to 1,000 events with one result each; an invalid event never stops the others. Counts once toward the rate limit.",
        "parameters": [
          {
            "$ref": "#/components/parameters/TellnodVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EventBatchInput"
              },
              "example": {
                "events": [
                  {
                    "type": "product.viewed",
                    "email": "mia.chen@example.com",
                    "data": {
                      "handle": "wool-overshirt",
                      "title": "Wool overshirt"
                    }
                  },
                  {
                    "type": "cart.updated",
                    "email": "mia.chen@example.com",
                    "data": {
                      "items": [
                        {
                          "handle": "wool-overshirt",
                          "quantity": 1,
                          "price": 2980
                        }
                      ]
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "One result per event, in order",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Tellnod-Version": {
                "$ref": "#/components/headers/Tellnod-Version"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventBatchResult"
                },
                "example": {
                  "object": "event_batch",
                  "recorded": 2,
                  "duplicates": 0,
                  "unmatched": 0,
                  "skipped": 0,
                  "failed": 0,
                  "results": [
                    {
                      "index": 0,
                      "id": "7c1d2e3f-4a5b-4c6d-8e9f-0a1b2c3d4e5f",
                      "status": "recorded",
                      "error": null
                    },
                    {
                      "index": 1,
                      "id": "8d2e3f4a-5b6c-4d7e-9f0a-1b2c3d4e5f6a",
                      "status": "recorded",
                      "error": null
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Error: version_invalid, invalid_json, parameter_invalid, parameter_unknown, idempotency_key_invalid",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "version_invalid": {
                    "$ref": "#/components/examples/version_invalid"
                  },
                  "invalid_json": {
                    "$ref": "#/components/examples/invalid_json"
                  },
                  "parameter_invalid": {
                    "$ref": "#/components/examples/parameter_invalid"
                  },
                  "parameter_unknown": {
                    "$ref": "#/components/examples/parameter_unknown"
                  },
                  "idempotency_key_invalid": {
                    "$ref": "#/components/examples/idempotency_key_invalid"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "version_invalid",
              "invalid_json",
              "parameter_invalid",
              "parameter_unknown",
              "idempotency_key_invalid"
            ]
          },
          "401": {
            "description": "Error: api_key_missing, api_key_invalid, api_key_revoked, api_key_expired, api_key_inactive",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "api_key_missing": {
                    "$ref": "#/components/examples/api_key_missing"
                  },
                  "api_key_invalid": {
                    "$ref": "#/components/examples/api_key_invalid"
                  },
                  "api_key_revoked": {
                    "$ref": "#/components/examples/api_key_revoked"
                  },
                  "api_key_expired": {
                    "$ref": "#/components/examples/api_key_expired"
                  },
                  "api_key_inactive": {
                    "$ref": "#/components/examples/api_key_inactive"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "api_key_missing",
              "api_key_invalid",
              "api_key_revoked",
              "api_key_expired",
              "api_key_inactive"
            ]
          },
          "403": {
            "description": "Error: scope_required",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_required": {
                    "$ref": "#/components/examples/scope_required"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "scope_required"
            ]
          },
          "409": {
            "description": "Error: idempotency_conflict, idempotency_in_progress",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "idempotency_conflict": {
                    "$ref": "#/components/examples/idempotency_conflict"
                  },
                  "idempotency_in_progress": {
                    "$ref": "#/components/examples/idempotency_in_progress"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "idempotency_conflict",
              "idempotency_in_progress"
            ]
          },
          "413": {
            "description": "Error: body_too_large",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "body_too_large": {
                    "$ref": "#/components/examples/body_too_large"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "body_too_large"
            ]
          },
          "429": {
            "description": "Error: rate_limited",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "$ref": "#/components/examples/rate_limited"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "description": "Error: internal_error",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "$ref": "#/components/examples/internal_error"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "internal_error"
            ]
          }
        },
        "x-tellnod-scopes": [
          "events:write"
        ],
        "x-tellnod-idempotent": true
      }
    },
    "/messages": {
      "get": {
        "operationId": "listMessages",
        "tags": [
          "Messages"
        ],
        "summary": "List drafts",
        "description": "Email drafts, newest first.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/StartingAfter"
          },
          {
            "$ref": "#/components/parameters/TellnodVersion"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of drafts",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Tellnod-Version": {
                "$ref": "#/components/headers/Tellnod-Version"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageList"
                },
                "example": {
                  "object": "list",
                  "data": [
                    {
                      "object": "message",
                      "id": "6e2a9d47-1c3b-4f58-8a90-b7d4e2c1f365",
                      "name": "Autumn edit",
                      "status": "draft",
                      "subject": "The autumn edit is here",
                      "created_at": "2026-11-10T08:18:00.000Z",
                      "updated_at": "2026-11-10T08:19:00.000Z"
                    }
                  ],
                  "has_more": false,
                  "next_cursor": null
                }
              }
            }
          },
          "400": {
            "description": "Error: version_invalid, parameter_invalid",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "version_invalid": {
                    "$ref": "#/components/examples/version_invalid"
                  },
                  "parameter_invalid": {
                    "$ref": "#/components/examples/parameter_invalid"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "version_invalid",
              "parameter_invalid"
            ]
          },
          "401": {
            "description": "Error: api_key_missing, api_key_invalid, api_key_revoked, api_key_expired, api_key_inactive",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "api_key_missing": {
                    "$ref": "#/components/examples/api_key_missing"
                  },
                  "api_key_invalid": {
                    "$ref": "#/components/examples/api_key_invalid"
                  },
                  "api_key_revoked": {
                    "$ref": "#/components/examples/api_key_revoked"
                  },
                  "api_key_expired": {
                    "$ref": "#/components/examples/api_key_expired"
                  },
                  "api_key_inactive": {
                    "$ref": "#/components/examples/api_key_inactive"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "api_key_missing",
              "api_key_invalid",
              "api_key_revoked",
              "api_key_expired",
              "api_key_inactive"
            ]
          },
          "403": {
            "description": "Error: scope_required",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_required": {
                    "$ref": "#/components/examples/scope_required"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "scope_required"
            ]
          },
          "429": {
            "description": "Error: rate_limited",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "$ref": "#/components/examples/rate_limited"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "description": "Error: internal_error",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "$ref": "#/components/examples/internal_error"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "internal_error"
            ]
          }
        },
        "x-tellnod-scopes": [
          "messages:read"
        ],
        "x-tellnod-idempotent": false
      },
      "post": {
        "operationId": "createMessage",
        "tags": [
          "Messages"
        ],
        "summary": "Create a draft",
        "description": "An email draft from plain text, blocks or your own HTML, laid out in the brand. Nothing is sent.",
        "parameters": [
          {
            "$ref": "#/components/parameters/TellnodVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MessageCreate"
              },
              "example": {
                "name": "Autumn edit",
                "subject": "The autumn edit is here",
                "body_text": "Two new pieces, in stock since last week.",
                "cta": {
                  "label": "Shop the edit",
                  "url": "https://ninefold.com/autumn"
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The draft",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Tellnod-Version": {
                "$ref": "#/components/headers/Tellnod-Version"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Message"
                },
                "example": {
                  "object": "message",
                  "id": "6e2a9d47-1c3b-4f58-8a90-b7d4e2c1f365",
                  "name": "Autumn edit",
                  "status": "draft",
                  "subject": "The autumn edit is here",
                  "preheader": null,
                  "html": "<!doctype html><html>…</html>",
                  "text": "Two new pieces, in stock since last week.\n\nShop the edit: https://ninefold.com/autumn",
                  "layout": "branded",
                  "style": "lookbook",
                  "from_name": null,
                  "revision": "3f9a1c2e",
                  "scheduled_send": null,
                  "content_removed": null
                }
              }
            }
          },
          "400": {
            "description": "Error: version_invalid, invalid_json, parameter_invalid, parameter_unknown, idempotency_key_invalid, parameter_missing, validation",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "version_invalid": {
                    "$ref": "#/components/examples/version_invalid"
                  },
                  "invalid_json": {
                    "$ref": "#/components/examples/invalid_json"
                  },
                  "parameter_invalid": {
                    "$ref": "#/components/examples/parameter_invalid"
                  },
                  "parameter_unknown": {
                    "$ref": "#/components/examples/parameter_unknown"
                  },
                  "idempotency_key_invalid": {
                    "$ref": "#/components/examples/idempotency_key_invalid"
                  },
                  "parameter_missing": {
                    "$ref": "#/components/examples/parameter_missing"
                  },
                  "validation": {
                    "$ref": "#/components/examples/validation"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "version_invalid",
              "invalid_json",
              "parameter_invalid",
              "parameter_unknown",
              "idempotency_key_invalid",
              "parameter_missing",
              "validation"
            ]
          },
          "401": {
            "description": "Error: api_key_missing, api_key_invalid, api_key_revoked, api_key_expired, api_key_inactive",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "api_key_missing": {
                    "$ref": "#/components/examples/api_key_missing"
                  },
                  "api_key_invalid": {
                    "$ref": "#/components/examples/api_key_invalid"
                  },
                  "api_key_revoked": {
                    "$ref": "#/components/examples/api_key_revoked"
                  },
                  "api_key_expired": {
                    "$ref": "#/components/examples/api_key_expired"
                  },
                  "api_key_inactive": {
                    "$ref": "#/components/examples/api_key_inactive"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "api_key_missing",
              "api_key_invalid",
              "api_key_revoked",
              "api_key_expired",
              "api_key_inactive"
            ]
          },
          "403": {
            "description": "Error: scope_required",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_required": {
                    "$ref": "#/components/examples/scope_required"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "scope_required"
            ]
          },
          "409": {
            "description": "Error: idempotency_conflict, idempotency_in_progress",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "idempotency_conflict": {
                    "$ref": "#/components/examples/idempotency_conflict"
                  },
                  "idempotency_in_progress": {
                    "$ref": "#/components/examples/idempotency_in_progress"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "idempotency_conflict",
              "idempotency_in_progress"
            ]
          },
          "413": {
            "description": "Error: body_too_large",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "body_too_large": {
                    "$ref": "#/components/examples/body_too_large"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "body_too_large"
            ]
          },
          "429": {
            "description": "Error: rate_limited",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "$ref": "#/components/examples/rate_limited"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "description": "Error: internal_error",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "$ref": "#/components/examples/internal_error"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "internal_error"
            ]
          }
        },
        "x-tellnod-scopes": [
          "messages:write"
        ],
        "x-tellnod-idempotent": true
      }
    },
    "/messages/{id}": {
      "get": {
        "operationId": "getMessage",
        "tags": [
          "Messages"
        ],
        "summary": "Get a draft",
        "description": "One draft with its HTML and plain-text versions.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The message's id. An id of another workspace is the same 404 as an unknown one.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/TellnodVersion"
          }
        ],
        "responses": {
          "200": {
            "description": "The draft",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Tellnod-Version": {
                "$ref": "#/components/headers/Tellnod-Version"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Message"
                },
                "example": {
                  "object": "message",
                  "id": "6e2a9d47-1c3b-4f58-8a90-b7d4e2c1f365",
                  "name": "Autumn edit",
                  "status": "draft",
                  "subject": "The autumn edit is here",
                  "preheader": null,
                  "html": "<!doctype html><html>…</html>",
                  "text": "Two new pieces, in stock since last week.\n\nShop the edit: https://ninefold.com/autumn",
                  "layout": "branded",
                  "style": "lookbook",
                  "from_name": null,
                  "revision": "3f9a1c2e",
                  "scheduled_send": null,
                  "content_removed": null
                }
              }
            }
          },
          "400": {
            "description": "Error: version_invalid",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "version_invalid": {
                    "$ref": "#/components/examples/version_invalid"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "version_invalid"
            ]
          },
          "401": {
            "description": "Error: api_key_missing, api_key_invalid, api_key_revoked, api_key_expired, api_key_inactive",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "api_key_missing": {
                    "$ref": "#/components/examples/api_key_missing"
                  },
                  "api_key_invalid": {
                    "$ref": "#/components/examples/api_key_invalid"
                  },
                  "api_key_revoked": {
                    "$ref": "#/components/examples/api_key_revoked"
                  },
                  "api_key_expired": {
                    "$ref": "#/components/examples/api_key_expired"
                  },
                  "api_key_inactive": {
                    "$ref": "#/components/examples/api_key_inactive"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "api_key_missing",
              "api_key_invalid",
              "api_key_revoked",
              "api_key_expired",
              "api_key_inactive"
            ]
          },
          "403": {
            "description": "Error: scope_required",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_required": {
                    "$ref": "#/components/examples/scope_required"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "scope_required"
            ]
          },
          "404": {
            "description": "Error: not_found",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "not_found": {
                    "$ref": "#/components/examples/not_found"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "not_found"
            ]
          },
          "429": {
            "description": "Error: rate_limited",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "$ref": "#/components/examples/rate_limited"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "description": "Error: internal_error",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "$ref": "#/components/examples/internal_error"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "internal_error"
            ]
          }
        },
        "x-tellnod-scopes": [
          "messages:read"
        ],
        "x-tellnod-idempotent": false
      },
      "patch": {
        "operationId": "updateMessage",
        "tags": [
          "Messages"
        ],
        "summary": "Update a draft",
        "description": "Given fields replace, the others stay; edits change one part without passing the whole email. Pass base_revision to refuse an edit over a newer one.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The message's id. An id of another workspace is the same 404 as an unknown one.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/TellnodVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MessageUpdate"
              },
              "example": {
                "subject": "The autumn edit: two new pieces",
                "base_revision": "3f9a1c2e"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated draft",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Tellnod-Version": {
                "$ref": "#/components/headers/Tellnod-Version"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Message"
                },
                "example": {
                  "object": "message",
                  "id": "6e2a9d47-1c3b-4f58-8a90-b7d4e2c1f365",
                  "name": "Autumn edit",
                  "status": "draft",
                  "subject": "The autumn edit is here",
                  "preheader": null,
                  "html": "<!doctype html><html>…</html>",
                  "text": "Two new pieces, in stock since last week.\n\nShop the edit: https://ninefold.com/autumn",
                  "layout": "branded",
                  "style": "lookbook",
                  "from_name": null,
                  "revision": "3f9a1c2e",
                  "scheduled_send": null,
                  "content_removed": null
                }
              }
            }
          },
          "400": {
            "description": "Error: version_invalid, invalid_json, parameter_invalid, parameter_unknown, idempotency_key_invalid, validation",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "version_invalid": {
                    "$ref": "#/components/examples/version_invalid"
                  },
                  "invalid_json": {
                    "$ref": "#/components/examples/invalid_json"
                  },
                  "parameter_invalid": {
                    "$ref": "#/components/examples/parameter_invalid"
                  },
                  "parameter_unknown": {
                    "$ref": "#/components/examples/parameter_unknown"
                  },
                  "idempotency_key_invalid": {
                    "$ref": "#/components/examples/idempotency_key_invalid"
                  },
                  "validation": {
                    "$ref": "#/components/examples/validation"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "version_invalid",
              "invalid_json",
              "parameter_invalid",
              "parameter_unknown",
              "idempotency_key_invalid",
              "validation"
            ]
          },
          "401": {
            "description": "Error: api_key_missing, api_key_invalid, api_key_revoked, api_key_expired, api_key_inactive",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "api_key_missing": {
                    "$ref": "#/components/examples/api_key_missing"
                  },
                  "api_key_invalid": {
                    "$ref": "#/components/examples/api_key_invalid"
                  },
                  "api_key_revoked": {
                    "$ref": "#/components/examples/api_key_revoked"
                  },
                  "api_key_expired": {
                    "$ref": "#/components/examples/api_key_expired"
                  },
                  "api_key_inactive": {
                    "$ref": "#/components/examples/api_key_inactive"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "api_key_missing",
              "api_key_invalid",
              "api_key_revoked",
              "api_key_expired",
              "api_key_inactive"
            ]
          },
          "403": {
            "description": "Error: scope_required",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_required": {
                    "$ref": "#/components/examples/scope_required"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "scope_required"
            ]
          },
          "404": {
            "description": "Error: not_found",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "not_found": {
                    "$ref": "#/components/examples/not_found"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "not_found"
            ]
          },
          "409": {
            "description": "Error: idempotency_conflict, idempotency_in_progress, draft_edit_conflict",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "idempotency_conflict": {
                    "$ref": "#/components/examples/idempotency_conflict"
                  },
                  "idempotency_in_progress": {
                    "$ref": "#/components/examples/idempotency_in_progress"
                  },
                  "draft_edit_conflict": {
                    "$ref": "#/components/examples/draft_edit_conflict"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "idempotency_conflict",
              "idempotency_in_progress",
              "draft_edit_conflict"
            ]
          },
          "413": {
            "description": "Error: body_too_large",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "body_too_large": {
                    "$ref": "#/components/examples/body_too_large"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "body_too_large"
            ]
          },
          "429": {
            "description": "Error: rate_limited",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "$ref": "#/components/examples/rate_limited"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "description": "Error: internal_error",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "$ref": "#/components/examples/internal_error"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "internal_error"
            ]
          }
        },
        "x-tellnod-scopes": [
          "messages:write"
        ],
        "x-tellnod-idempotent": true
      }
    },
    "/messages/{id}/render": {
      "post": {
        "operationId": "renderMessage",
        "tags": [
          "Messages"
        ],
        "summary": "Render a draft",
        "description": "The email exactly as it will be sent, with merge tags filled for a sample contact and the checks a campaign must pass. Read-only.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The message's id. An id of another workspace is the same 404 as an unknown one.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/TellnodVersion"
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MessageRenderInput"
              },
              "example": {
                "sample_contact_id": "0b6f3c1e-5a2d-4e8f-9c71-3d2a6b8e4f10"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The rendered email",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Tellnod-Version": {
                "$ref": "#/components/headers/Tellnod-Version"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageRender"
                },
                "example": {
                  "object": "message_render",
                  "message_id": "6e2a9d47-1c3b-4f58-8a90-b7d4e2c1f365",
                  "subject": "The autumn edit is here",
                  "preheader": null,
                  "from": "Ninefold <hello@ninefold.com>",
                  "html": "<!doctype html><html>…</html>",
                  "text": "Two new pieces, in stock since last week.",
                  "preview_url": "https://mcp.tellnod.com/preview/6e2a9d47-1c3b-4f58-8a90-b7d4e2c1f365",
                  "sample_contact_id": "0b6f3c1e-5a2d-4e8f-9c71-3d2a6b8e4f10",
                  "uses_shared_domain": false,
                  "missing_address": false,
                  "checks": {
                    "blocking": [],
                    "warnings": []
                  }
                }
              }
            }
          },
          "400": {
            "description": "Error: version_invalid, invalid_json, parameter_invalid, parameter_unknown",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "version_invalid": {
                    "$ref": "#/components/examples/version_invalid"
                  },
                  "invalid_json": {
                    "$ref": "#/components/examples/invalid_json"
                  },
                  "parameter_invalid": {
                    "$ref": "#/components/examples/parameter_invalid"
                  },
                  "parameter_unknown": {
                    "$ref": "#/components/examples/parameter_unknown"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "version_invalid",
              "invalid_json",
              "parameter_invalid",
              "parameter_unknown"
            ]
          },
          "401": {
            "description": "Error: api_key_missing, api_key_invalid, api_key_revoked, api_key_expired, api_key_inactive",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "api_key_missing": {
                    "$ref": "#/components/examples/api_key_missing"
                  },
                  "api_key_invalid": {
                    "$ref": "#/components/examples/api_key_invalid"
                  },
                  "api_key_revoked": {
                    "$ref": "#/components/examples/api_key_revoked"
                  },
                  "api_key_expired": {
                    "$ref": "#/components/examples/api_key_expired"
                  },
                  "api_key_inactive": {
                    "$ref": "#/components/examples/api_key_inactive"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "api_key_missing",
              "api_key_invalid",
              "api_key_revoked",
              "api_key_expired",
              "api_key_inactive"
            ]
          },
          "403": {
            "description": "Error: scope_required",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_required": {
                    "$ref": "#/components/examples/scope_required"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "scope_required"
            ]
          },
          "404": {
            "description": "Error: not_found",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "not_found": {
                    "$ref": "#/components/examples/not_found"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "not_found"
            ]
          },
          "413": {
            "description": "Error: body_too_large",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "body_too_large": {
                    "$ref": "#/components/examples/body_too_large"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "body_too_large"
            ]
          },
          "429": {
            "description": "Error: rate_limited",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "$ref": "#/components/examples/rate_limited"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "description": "Error: internal_error",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "$ref": "#/components/examples/internal_error"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "internal_error"
            ]
          }
        },
        "x-tellnod-scopes": [
          "messages:read"
        ],
        "x-tellnod-idempotent": false
      }
    },
    "/sends": {
      "post": {
        "operationId": "createSend",
        "tags": [
          "Sends"
        ],
        "summary": "Send a test",
        "description": "type test: the draft to your own verified address, at most 20 a day; a tn_test_ key never reaches anyone else. Needs messages:write. type campaign needs sends:write and is not available through the API yet: a person confirms campaigns in Tellnod.",
        "parameters": [
          {
            "$ref": "#/components/parameters/TellnodVersion"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendCreate"
              },
              "example": {
                "type": "test",
                "message_id": "6e2a9d47-1c3b-4f58-8a90-b7d4e2c1f365"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The test send",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Tellnod-Version": {
                "$ref": "#/components/headers/Tellnod-Version"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              },
              "Idempotent-Replayed": {
                "$ref": "#/components/headers/Idempotent-Replayed"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TestSendCreated"
                },
                "example": {
                  "object": "send",
                  "id": "a3c5e7f9-2b4d-4c6e-8f10-1a3b5c7d9e2f",
                  "type": "test",
                  "message_id": "6e2a9d47-1c3b-4f58-8a90-b7d4e2c1f365",
                  "to": "owner@ninefold.com",
                  "status": "queued",
                  "failure_code": null,
                  "created_at": "2026-11-10T08:20:00.000Z",
                  "sent_at": null,
                  "mode": "test",
                  "from": "Ninefold <hello@ninefold.com>",
                  "subject": "The autumn edit is here",
                  "delivery": "queued",
                  "simulated": false,
                  "remaining_today": 19
                }
              }
            }
          },
          "400": {
            "description": "Error: version_invalid, invalid_json, parameter_invalid, parameter_unknown, idempotency_key_invalid, parameter_missing, send_type_not_available",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "version_invalid": {
                    "$ref": "#/components/examples/version_invalid"
                  },
                  "invalid_json": {
                    "$ref": "#/components/examples/invalid_json"
                  },
                  "parameter_invalid": {
                    "$ref": "#/components/examples/parameter_invalid"
                  },
                  "parameter_unknown": {
                    "$ref": "#/components/examples/parameter_unknown"
                  },
                  "idempotency_key_invalid": {
                    "$ref": "#/components/examples/idempotency_key_invalid"
                  },
                  "parameter_missing": {
                    "$ref": "#/components/examples/parameter_missing"
                  },
                  "send_type_not_available": {
                    "$ref": "#/components/examples/send_type_not_available"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "version_invalid",
              "invalid_json",
              "parameter_invalid",
              "parameter_unknown",
              "idempotency_key_invalid",
              "parameter_missing",
              "send_type_not_available"
            ]
          },
          "401": {
            "description": "Error: api_key_missing, api_key_invalid, api_key_revoked, api_key_expired, api_key_inactive",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "api_key_missing": {
                    "$ref": "#/components/examples/api_key_missing"
                  },
                  "api_key_invalid": {
                    "$ref": "#/components/examples/api_key_invalid"
                  },
                  "api_key_revoked": {
                    "$ref": "#/components/examples/api_key_revoked"
                  },
                  "api_key_expired": {
                    "$ref": "#/components/examples/api_key_expired"
                  },
                  "api_key_inactive": {
                    "$ref": "#/components/examples/api_key_inactive"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "api_key_missing",
              "api_key_invalid",
              "api_key_revoked",
              "api_key_expired",
              "api_key_inactive"
            ]
          },
          "403": {
            "description": "Error: scope_required, test_recipient_not_allowed, email_not_verified, workspace_paused, account_frozen, platform_sending_paused",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_required": {
                    "$ref": "#/components/examples/scope_required"
                  },
                  "test_recipient_not_allowed": {
                    "$ref": "#/components/examples/test_recipient_not_allowed"
                  },
                  "email_not_verified": {
                    "$ref": "#/components/examples/email_not_verified"
                  },
                  "workspace_paused": {
                    "$ref": "#/components/examples/workspace_paused"
                  },
                  "account_frozen": {
                    "$ref": "#/components/examples/account_frozen"
                  },
                  "platform_sending_paused": {
                    "$ref": "#/components/examples/platform_sending_paused"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "scope_required",
              "test_recipient_not_allowed",
              "email_not_verified",
              "workspace_paused",
              "account_frozen",
              "platform_sending_paused"
            ]
          },
          "404": {
            "description": "Error: not_found",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "not_found": {
                    "$ref": "#/components/examples/not_found"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "not_found"
            ]
          },
          "409": {
            "description": "Error: idempotency_conflict, idempotency_in_progress",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "idempotency_conflict": {
                    "$ref": "#/components/examples/idempotency_conflict"
                  },
                  "idempotency_in_progress": {
                    "$ref": "#/components/examples/idempotency_in_progress"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "idempotency_conflict",
              "idempotency_in_progress"
            ]
          },
          "413": {
            "description": "Error: body_too_large",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "body_too_large": {
                    "$ref": "#/components/examples/body_too_large"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "body_too_large"
            ]
          },
          "429": {
            "description": "Error: rate_limited, test_limit_reached",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "$ref": "#/components/examples/rate_limited"
                  },
                  "test_limit_reached": {
                    "$ref": "#/components/examples/test_limit_reached"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "rate_limited",
              "test_limit_reached"
            ]
          },
          "500": {
            "description": "Error: internal_error",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "$ref": "#/components/examples/internal_error"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "internal_error"
            ]
          }
        },
        "x-tellnod-scopes": [
          "messages:write"
        ],
        "x-tellnod-scope-note": "type campaign needs sends:write instead of messages:write.",
        "x-tellnod-idempotent": true
      }
    },
    "/sends/{id}": {
      "get": {
        "operationId": "getSend",
        "tags": [
          "Sends"
        ],
        "summary": "Get a send",
        "description": "A test send or a campaign send, told apart by type.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The send's id. An id of another workspace is the same 404 as an unknown one.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/TellnodVersion"
          }
        ],
        "responses": {
          "200": {
            "description": "The send",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Tellnod-Version": {
                "$ref": "#/components/headers/Tellnod-Version"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Send"
                },
                "example": {
                  "object": "send",
                  "id": "a3c5e7f9-2b4d-4c6e-8f10-1a3b5c7d9e2f",
                  "type": "test",
                  "message_id": "6e2a9d47-1c3b-4f58-8a90-b7d4e2c1f365",
                  "to": "owner@ninefold.com",
                  "status": "queued",
                  "failure_code": null,
                  "created_at": "2026-11-10T08:20:00.000Z",
                  "sent_at": null
                }
              }
            }
          },
          "400": {
            "description": "Error: version_invalid",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "version_invalid": {
                    "$ref": "#/components/examples/version_invalid"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "version_invalid"
            ]
          },
          "401": {
            "description": "Error: api_key_missing, api_key_invalid, api_key_revoked, api_key_expired, api_key_inactive",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "api_key_missing": {
                    "$ref": "#/components/examples/api_key_missing"
                  },
                  "api_key_invalid": {
                    "$ref": "#/components/examples/api_key_invalid"
                  },
                  "api_key_revoked": {
                    "$ref": "#/components/examples/api_key_revoked"
                  },
                  "api_key_expired": {
                    "$ref": "#/components/examples/api_key_expired"
                  },
                  "api_key_inactive": {
                    "$ref": "#/components/examples/api_key_inactive"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "api_key_missing",
              "api_key_invalid",
              "api_key_revoked",
              "api_key_expired",
              "api_key_inactive"
            ]
          },
          "403": {
            "description": "Error: scope_required",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_required": {
                    "$ref": "#/components/examples/scope_required"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "scope_required"
            ]
          },
          "404": {
            "description": "Error: not_found",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "not_found": {
                    "$ref": "#/components/examples/not_found"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "not_found"
            ]
          },
          "429": {
            "description": "Error: rate_limited",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "$ref": "#/components/examples/rate_limited"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "description": "Error: internal_error",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "$ref": "#/components/examples/internal_error"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "internal_error"
            ]
          }
        },
        "x-tellnod-scopes": [
          "sends:read"
        ],
        "x-tellnod-idempotent": false
      }
    },
    "/sends/{id}/results": {
      "get": {
        "operationId": "getSendResults",
        "tags": [
          "Results"
        ],
        "summary": "Get a send's results",
        "description": "Delivered, opened (estimated), clicked, orders and revenue (estimated) of a campaign send that has started.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The send's id. An id of another workspace is the same 404 as an unknown one.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "$ref": "#/components/parameters/TellnodVersion"
          }
        ],
        "responses": {
          "200": {
            "description": "The results",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Tellnod-Version": {
                "$ref": "#/components/headers/Tellnod-Version"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendResults"
                },
                "example": {
                  "object": "send_results",
                  "send_id": "4d8b2f6a-9e1c-4a37-b5d0-c2e8f4a6b913",
                  "name": "Autumn edit",
                  "status": "sent",
                  "started_at": "2026-11-10T10:00:00.000Z",
                  "completed_at": "2026-11-10T10:04:00.000Z",
                  "days_since_send": 2,
                  "recipients": {
                    "total": 1790,
                    "sent": 1788,
                    "queued": 0,
                    "skipped": 2,
                    "failed": 0
                  },
                  "counts": {
                    "sent": 1788,
                    "delivered": 1776,
                    "opened": 812,
                    "clicked": 164,
                    "unsubscribed": 3,
                    "bounced": 12,
                    "complained": 0
                  },
                  "rates": {
                    "delivery": 0.993,
                    "open": 0.457,
                    "click": 0.092,
                    "bounce": 0.007
                  },
                  "opens": {
                    "tracked": true,
                    "people": 812,
                    "apple_privacy_only": 240,
                    "provider_unflagged": false
                  },
                  "links": [
                    {
                      "url": "https://ninefold.com/autumn",
                      "people": 151
                    }
                  ],
                  "revenue": {
                    "currency": "TWD",
                    "orders": 21,
                    "buyers": 19,
                    "amount": 62580
                  },
                  "revenue_status": "ok"
                }
              }
            }
          },
          "400": {
            "description": "Error: version_invalid, send_not_started",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "version_invalid": {
                    "$ref": "#/components/examples/version_invalid"
                  },
                  "send_not_started": {
                    "$ref": "#/components/examples/send_not_started"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "version_invalid",
              "send_not_started"
            ]
          },
          "401": {
            "description": "Error: api_key_missing, api_key_invalid, api_key_revoked, api_key_expired, api_key_inactive",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "api_key_missing": {
                    "$ref": "#/components/examples/api_key_missing"
                  },
                  "api_key_invalid": {
                    "$ref": "#/components/examples/api_key_invalid"
                  },
                  "api_key_revoked": {
                    "$ref": "#/components/examples/api_key_revoked"
                  },
                  "api_key_expired": {
                    "$ref": "#/components/examples/api_key_expired"
                  },
                  "api_key_inactive": {
                    "$ref": "#/components/examples/api_key_inactive"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "api_key_missing",
              "api_key_invalid",
              "api_key_revoked",
              "api_key_expired",
              "api_key_inactive"
            ]
          },
          "403": {
            "description": "Error: scope_required",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_required": {
                    "$ref": "#/components/examples/scope_required"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "scope_required"
            ]
          },
          "404": {
            "description": "Error: not_found",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "not_found": {
                    "$ref": "#/components/examples/not_found"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "not_found"
            ]
          },
          "429": {
            "description": "Error: rate_limited",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "$ref": "#/components/examples/rate_limited"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "description": "Error: internal_error",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "$ref": "#/components/examples/internal_error"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "internal_error"
            ]
          }
        },
        "x-tellnod-scopes": [
          "results:read"
        ],
        "x-tellnod-idempotent": false
      }
    },
    "/insights/money-map": {
      "get": {
        "operationId": "getMoneyMap",
        "tags": [
          "Insights"
        ],
        "summary": "Get the Money Map",
        "description": "Seven segments of the workspace's subscribed contacts (open carts, dormant VIPs, high value with no purchase in 90 days, due to repurchase, discount-only buyers, first-time buyers who never came back, new subscribers who never bought), each contact counted once, with estimated recoverable revenue from the store's own data: count × the lower bound of the store's own rate × the lower of median and mean order value, in one currency. Lapsed groups use the store's own win-back rate once 30 lapsed customers have come back, and until then the repeat-purchase rate's lower bound × 0.5, marked estimate_method conservative_fallback. Below 50 contacts who can receive email nothing is estimated (status list_too_small). Read only.",
        "parameters": [
          {
            "$ref": "#/components/parameters/TellnodVersion"
          }
        ],
        "responses": {
          "200": {
            "description": "The Money Map",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Tellnod-Version": {
                "$ref": "#/components/headers/Tellnod-Version"
              },
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimit-Limit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimit-Remaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimit-Reset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimit-Policy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MoneyMap"
                },
                "example": {
                  "object": "money_map",
                  "status": "ready",
                  "computed_at": "2026-11-11T02:00:00.000Z",
                  "min_contacts": 50,
                  "contacts_needed": null,
                  "list_health": {
                    "total": 4000,
                    "sendable": 3875,
                    "unsubscribed": 0,
                    "undeliverable": 0,
                    "no_email": 125
                  },
                  "currency": "TWD",
                  "estimated_total": 154081400,
                  "no_money_reason": null,
                  "pick": "one_and_done",
                  "segments": [
                    {
                      "id": "one_and_done",
                      "name": "First-time buyers who never came back",
                      "available": true,
                      "unavailable_reason": null,
                      "count": 998,
                      "also_in_earlier": 65,
                      "estimated_revenue": 90934800,
                      "rate": {
                        "basis": "repeat_purchase",
                        "successes": 1226,
                        "trials": 2468,
                        "observed": 0.4968,
                        "low": 0.4771
                      },
                      "estimate_method": null,
                      "no_estimate_reason": null
                    },
                    {
                      "id": "dormant_vip",
                      "name": "Dormant VIPs",
                      "available": true,
                      "unavailable_reason": null,
                      "count": 86,
                      "also_in_earlier": 9,
                      "estimated_revenue": 373800,
                      "rate": {
                        "basis": "winback",
                        "successes": 38,
                        "trials": 1221,
                        "observed": 0.0311,
                        "low": 0.0228
                      },
                      "estimate_method": "store_winback_rate",
                      "no_estimate_reason": null
                    }
                  ],
                  "inputs": {
                    "order_value": {
                      "currency": "TWD",
                      "orders": 1782,
                      "mean": 239397,
                      "median": 191000,
                      "low": 191000
                    },
                    "rates": {
                      "repeat_purchase": {
                        "basis": "repeat_purchase",
                        "successes": 1226,
                        "trials": 2468,
                        "observed": 0.4968,
                        "low": 0.4771
                      },
                      "cart_recovery": {
                        "basis": "cart_recovery",
                        "successes": 151,
                        "trials": 673,
                        "observed": 0.2244,
                        "low": 0.1945
                      },
                      "first_purchase": {
                        "basis": "first_purchase",
                        "successes": 2468,
                        "trials": 4000,
                        "observed": 0.617,
                        "low": 0.6018
                      }
                    },
                    "winback": {
                      "method": "store_winback_rate",
                      "lapsed": 1221,
                      "returned": 38,
                      "min_returned": 30,
                      "observed": {
                        "basis": "winback",
                        "successes": 38,
                        "trials": 1221,
                        "observed": 0.0311,
                        "low": 0.0228
                      }
                    },
                    "repurchase_cycle": {
                      "store_days": 28,
                      "store_intervals": 517,
                      "categories": [
                        {
                          "category": "socks",
                          "days": 16,
                          "intervals": 140
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Error: version_invalid",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "version_invalid": {
                    "$ref": "#/components/examples/version_invalid"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "version_invalid"
            ]
          },
          "401": {
            "description": "Error: api_key_missing, api_key_invalid, api_key_revoked, api_key_expired, api_key_inactive",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "WWW-Authenticate": {
                "$ref": "#/components/headers/WWW-Authenticate"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "api_key_missing": {
                    "$ref": "#/components/examples/api_key_missing"
                  },
                  "api_key_invalid": {
                    "$ref": "#/components/examples/api_key_invalid"
                  },
                  "api_key_revoked": {
                    "$ref": "#/components/examples/api_key_revoked"
                  },
                  "api_key_expired": {
                    "$ref": "#/components/examples/api_key_expired"
                  },
                  "api_key_inactive": {
                    "$ref": "#/components/examples/api_key_inactive"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "api_key_missing",
              "api_key_invalid",
              "api_key_revoked",
              "api_key_expired",
              "api_key_inactive"
            ]
          },
          "403": {
            "description": "Error: scope_required",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "scope_required": {
                    "$ref": "#/components/examples/scope_required"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "scope_required"
            ]
          },
          "429": {
            "description": "Error: rate_limited",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              },
              "Retry-After": {
                "$ref": "#/components/headers/Retry-After"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "rate_limited": {
                    "$ref": "#/components/examples/rate_limited"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "rate_limited"
            ]
          },
          "500": {
            "description": "Error: internal_error",
            "headers": {
              "Request-Id": {
                "$ref": "#/components/headers/Request-Id"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "internal_error": {
                    "$ref": "#/components/examples/internal_error"
                  }
                }
              }
            },
            "x-tellnod-error-codes": [
              "internal_error"
            ]
          }
        },
        "x-tellnod-scopes": [
          "results:read"
        ],
        "x-tellnod-idempotent": false
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "tn_live_… or tn_test_… (43 base62 characters after the prefix)",
        "description": "A workspace API key from the console's Developers tab: Authorization: Bearer tn_live_… (live) or tn_test_… (test mode). Each key carries scopes; an operation's x-tellnod-scopes lists what it needs.",
        "x-tellnod-key-prefixes": [
          "tn_live_",
          "tn_test_"
        ],
        "x-tellnod-scopes": [
          "contacts:read",
          "contacts:write",
          "segments:read",
          "segments:write",
          "events:write",
          "messages:read",
          "messages:write",
          "sends:read",
          "sends:write",
          "webhooks:read",
          "webhooks:write",
          "results:read"
        ]
      }
    },
    "schemas": {
      "CampaignSend": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "send"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "type": {
            "type": "string",
            "const": "campaign"
          },
          "status": {
            "type": "string",
            "enum": [
              "blocked",
              "pending",
              "dismissed",
              "expired",
              "scheduled",
              "cancelled",
              "sending",
              "sent"
            ]
          },
          "message_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "segment_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              {
                "type": "null"
              }
            ]
          },
          "channel": {
            "type": "string"
          },
          "recipient_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "excluded": {},
          "scheduled_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                "description": "ISO 8601 time (UTC)"
              },
              {
                "type": "null"
              }
            ]
          },
          "confirmed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                "description": "ISO 8601 time (UTC)"
              },
              {
                "type": "null"
              }
            ]
          },
          "cancelled_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                "description": "ISO 8601 time (UTC)"
              },
              {
                "type": "null"
              }
            ]
          },
          "stop_reason": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "user",
                  "frozen",
                  "deletion",
                  "operator"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Who stopped the send, set whenever status is cancelled after confirm (before or while sending): user (cancel_send), frozen (Tellnod cancelled what an account hold held), operator (Tellnod cancelled what a sending pause held), deletion (the workspace is scheduled for deletion). Null otherwise."
          },
          "completed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                "description": "ISO 8601 time (UTC)"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "object",
          "id",
          "type",
          "status",
          "message_id",
          "segment_id",
          "channel",
          "recipient_count",
          "excluded",
          "scheduled_at",
          "confirmed_at",
          "cancelled_at",
          "stop_reason",
          "completed_at"
        ],
        "additionalProperties": false
      },
      "Contact": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "contact"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "first_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone": {
            "type": [
              "string",
              "null"
            ]
          },
          "consent": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "granted",
                  "unknown",
                  "denied"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "consent_source": {
            "type": [
              "string",
              "null"
            ]
          },
          "consent_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                "description": "ISO 8601 time (UTC)"
              },
              {
                "type": "null"
              }
            ]
          },
          "subscription_status": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "subscribed",
                  "unsubscribed",
                  "bounced",
                  "complained"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "Read-only"
          },
          "paused": {
            "type": "boolean",
            "description": "Unsubscribed by the business; reversible in Tellnod"
          },
          "unsubscribed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                "description": "ISO 8601 time (UTC)"
              },
              {
                "type": "null"
              }
            ]
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "attributes": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
            "description": "ISO 8601 time (UTC)"
          }
        },
        "required": [
          "object",
          "id",
          "email",
          "first_name",
          "last_name",
          "phone",
          "consent",
          "consent_source",
          "consent_at",
          "subscription_status",
          "paused",
          "unsubscribed_at",
          "tags",
          "attributes",
          "created_at"
        ],
        "additionalProperties": false
      },
      "ContactBatchInput": {
        "type": "object",
        "properties": {
          "contacts": {
            "minItems": 1,
            "maxItems": 1000,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ContactInput"
            }
          }
        },
        "required": [
          "contacts"
        ],
        "additionalProperties": false
      },
      "ContactBatchResult": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "contact_batch"
          },
          "created": {
            "type": "integer"
          },
          "updated": {
            "type": "integer"
          },
          "skipped": {
            "type": "integer",
            "description": "Deleted people, kept only as do-not-email records"
          },
          "failed": {
            "type": "integer"
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer"
                },
                "outcome": {
                  "type": "string",
                  "enum": [
                    "created",
                    "updated",
                    "skipped_deleted",
                    "failed"
                  ]
                },
                "id": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "error": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "param": {
                          "type": "string",
                          "description": "For example contacts[3].email"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "param"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "index",
                "outcome",
                "id",
                "error"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "object",
          "created",
          "updated",
          "skipped",
          "failed",
          "results"
        ],
        "additionalProperties": false
      },
      "ContactInput": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
            "description": "Who the contact is; the upsert key"
          },
          "first_name": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "last_name": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "phone": {
            "description": "International format, for example +886912345678",
            "type": [
              "string",
              "null"
            ]
          },
          "consent": {
            "description": "Required for a new contact: granted when the person agreed to receive marketing email, otherwise denied. Recorded as the legal basis. An existing contact keeps their consent when it is left out.",
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "granted",
                  "denied"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "tags": {
            "description": "Added to the contact's tags (never removed). At most 50.",
            "anyOf": [
              {
                "maxItems": 50,
                "type": "array",
                "items": {
                  "type": "string",
                  "maxLength": 64
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "attributes": {
            "description": "Merged into the contact's attributes; null or an empty string leaves a field as it is. At most 50 fields.",
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 1000
                    },
                    {
                      "type": "number"
                    },
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "email"
        ],
        "additionalProperties": false,
        "description": "A contact, upserted by email. Subscription state (unsubscribed, paused, bounced) is read-only: unsubscribe through POST /contacts/{id}/unsubscribe."
      },
      "ContactList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Contact"
            }
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "description": "Pass as starting_after for the next page; null on the last page",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "next_cursor"
        ],
        "additionalProperties": false
      },
      "ContactUpdate": {
        "type": "object",
        "properties": {
          "first_name": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "last_name": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ]
          },
          "phone": {
            "description": "International format, for example +886912345678",
            "type": [
              "string",
              "null"
            ]
          },
          "consent": {
            "description": "Required for a new contact: granted when the person agreed to receive marketing email, otherwise denied. Recorded as the legal basis. An existing contact keeps their consent when it is left out.",
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "granted",
                  "denied"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "tags": {
            "description": "Added to the contact's tags (never removed). At most 50.",
            "anyOf": [
              {
                "maxItems": 50,
                "type": "array",
                "items": {
                  "type": "string",
                  "maxLength": 64
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "attributes": {
            "description": "Merged into the contact's attributes; null or an empty string leaves a field as it is. At most 50 fields.",
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "anyOf": [
                    {
                      "type": "string",
                      "maxLength": 1000
                    },
                    {
                      "type": "number"
                    },
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false,
        "description": "Given fields change; tags are added and attributes merged. email cannot change (400 field_read_only)."
      },
      "DeletedContact": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "contact"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "deleted": {
            "type": "boolean",
            "const": true
          },
          "outcome": {
            "type": "string",
            "enum": [
              "deleted",
              "anonymized",
              "already_removed"
            ],
            "description": "deleted: erased. anonymized: kept only as a do-not-email record (the person had unsubscribed, bounced or complained)."
          }
        },
        "required": [
          "object",
          "id",
          "deleted",
          "outcome"
        ],
        "additionalProperties": false
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "authentication_error",
                  "permission_error",
                  "invalid_request_error",
                  "idempotency_error",
                  "rate_limit_error",
                  "api_error"
                ],
                "description": "The family a client branches on (authentication, permission, ...)"
              },
              "code": {
                "type": "string",
                "description": "Stable and specific; listed per operation"
              },
              "message": {
                "type": "string",
                "description": "For people: what happened and what to do next"
              },
              "param": {
                "description": "The parameter or header at fault, if any",
                "type": [
                  "string",
                  "null"
                ]
              },
              "doc_url": {
                "type": "string",
                "format": "uri",
                "description": "This code in the error reference"
              },
              "request_id": {
                "type": "string",
                "pattern": "^req_[0-9a-f]{24}$",
                "description": "Same as the Request-Id header; quote it when asking for help"
              }
            },
            "required": [
              "type",
              "code",
              "message",
              "param",
              "doc_url",
              "request_id"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false
      },
      "Event": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "event"
          },
          "id": {
            "type": "string",
            "description": "Your id, or the order id for order events"
          },
          "type": {
            "type": "string",
            "enum": [
              "order.created",
              "order.cancelled",
              "product.viewed",
              "cart.updated",
              "checkout.started"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "recorded",
              "duplicate",
              "unmatched",
              "skipped_too_old"
            ]
          }
        },
        "required": [
          "object",
          "id",
          "type",
          "status"
        ],
        "additionalProperties": false
      },
      "EventBatchInput": {
        "type": "object",
        "properties": {
          "events": {
            "minItems": 1,
            "maxItems": 1000,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventInput"
            }
          }
        },
        "required": [
          "events"
        ],
        "additionalProperties": false
      },
      "EventBatchResult": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "event_batch"
          },
          "recorded": {
            "type": "integer"
          },
          "duplicates": {
            "type": "integer"
          },
          "unmatched": {
            "type": "integer"
          },
          "skipped": {
            "type": "integer"
          },
          "failed": {
            "type": "integer"
          },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer"
                },
                "id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "status": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "recorded",
                        "duplicate",
                        "unmatched",
                        "skipped_too_old"
                      ]
                    },
                    {
                      "type": "string",
                      "const": "failed"
                    }
                  ]
                },
                "error": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "param": {
                          "type": "string",
                          "description": "For example contacts[3].email"
                        }
                      },
                      "required": [
                        "code",
                        "message",
                        "param"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "index",
                "id",
                "status",
                "error"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "object",
          "recorded",
          "duplicates",
          "unmatched",
          "skipped",
          "failed",
          "results"
        ],
        "additionalProperties": false
      },
      "EventInput": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "order.created"
              },
              "id": {
                "description": "Your id for this event; a repeat with the same id is a duplicate",
                "type": "string",
                "pattern": "^[\\w.:-]{1,200}$"
              },
              "email": {
                "type": "string",
                "description": "The contact the event belongs to; unknown people are unmatched"
              },
              "occurred_at": {
                "description": "When it happened; now when left out",
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "data": {
                "type": "object",
                "properties": {
                  "order_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "number"
                      }
                    ]
                  },
                  "currency": {
                    "description": "ISO 4217, for example TWD",
                    "type": "string"
                  },
                  "status": {
                    "description": "paid, refunded, partially_refunded, cancelled",
                    "type": "string"
                  },
                  "refunded_amount": {
                    "type": [
                      "number",
                      "string"
                    ]
                  },
                  "items": {
                    "minItems": 1,
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "product_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "handle": {
                          "type": "string"
                        },
                        "product_id": {
                          "type": [
                            "string",
                            "number"
                          ]
                        },
                        "sku": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        },
                        "category": {
                          "type": "string"
                        },
                        "quantity": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "price": {
                          "description": "In the order's currency",
                          "type": [
                            "number",
                            "string"
                          ]
                        }
                      },
                      "additionalProperties": {},
                      "description": "A product: product_url, handle, product_id, sku or title names it"
                    }
                  }
                },
                "required": [
                  "order_id",
                  "items"
                ],
                "additionalProperties": {}
              }
            },
            "required": [
              "type",
              "email",
              "data"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "order.cancelled"
              },
              "id": {
                "description": "Your id for this event; a repeat with the same id is a duplicate",
                "type": "string",
                "pattern": "^[\\w.:-]{1,200}$"
              },
              "email": {
                "type": "string",
                "description": "The contact the event belongs to; unknown people are unmatched"
              },
              "occurred_at": {
                "description": "When it happened; now when left out",
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "data": {
                "type": "object",
                "properties": {
                  "order_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "number"
                      }
                    ]
                  },
                  "currency": {
                    "description": "ISO 4217, for example TWD",
                    "type": "string"
                  },
                  "status": {
                    "description": "paid, refunded, partially_refunded, cancelled",
                    "type": "string"
                  },
                  "refunded_amount": {
                    "type": [
                      "number",
                      "string"
                    ]
                  },
                  "items": {
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "product_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "handle": {
                          "type": "string"
                        },
                        "product_id": {
                          "type": [
                            "string",
                            "number"
                          ]
                        },
                        "sku": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        },
                        "category": {
                          "type": "string"
                        },
                        "quantity": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "price": {
                          "description": "In the order's currency",
                          "type": [
                            "number",
                            "string"
                          ]
                        }
                      },
                      "additionalProperties": {},
                      "description": "A product: product_url, handle, product_id, sku or title names it"
                    }
                  }
                },
                "required": [
                  "order_id"
                ],
                "additionalProperties": {}
              }
            },
            "required": [
              "type",
              "email",
              "data"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "product.viewed"
              },
              "id": {
                "description": "Your id for this event; a repeat with the same id is a duplicate",
                "type": "string",
                "pattern": "^[\\w.:-]{1,200}$"
              },
              "email": {
                "type": "string",
                "description": "The contact the event belongs to; unknown people are unmatched"
              },
              "occurred_at": {
                "description": "When it happened; now when left out",
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "data": {
                "description": "One product, or several in items",
                "type": "object",
                "properties": {
                  "product_url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "handle": {
                    "type": "string"
                  },
                  "product_id": {
                    "type": [
                      "string",
                      "number"
                    ]
                  },
                  "sku": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "category": {
                    "type": "string"
                  },
                  "quantity": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "price": {
                    "description": "In the order's currency",
                    "type": [
                      "number",
                      "string"
                    ]
                  },
                  "items": {
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "product_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "handle": {
                          "type": "string"
                        },
                        "product_id": {
                          "type": [
                            "string",
                            "number"
                          ]
                        },
                        "sku": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        },
                        "category": {
                          "type": "string"
                        },
                        "quantity": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "price": {
                          "description": "In the order's currency",
                          "type": [
                            "number",
                            "string"
                          ]
                        }
                      },
                      "additionalProperties": {},
                      "description": "A product: product_url, handle, product_id, sku or title names it"
                    }
                  }
                },
                "additionalProperties": {}
              }
            },
            "required": [
              "type",
              "email"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "cart.updated"
              },
              "id": {
                "description": "Your id for this event; a repeat with the same id is a duplicate",
                "type": "string",
                "pattern": "^[\\w.:-]{1,200}$"
              },
              "email": {
                "type": "string",
                "description": "The contact the event belongs to; unknown people are unmatched"
              },
              "occurred_at": {
                "description": "When it happened; now when left out",
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "data": {
                "description": "One product, or several in items",
                "type": "object",
                "properties": {
                  "product_url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "handle": {
                    "type": "string"
                  },
                  "product_id": {
                    "type": [
                      "string",
                      "number"
                    ]
                  },
                  "sku": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "category": {
                    "type": "string"
                  },
                  "quantity": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "price": {
                    "description": "In the order's currency",
                    "type": [
                      "number",
                      "string"
                    ]
                  },
                  "items": {
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "product_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "handle": {
                          "type": "string"
                        },
                        "product_id": {
                          "type": [
                            "string",
                            "number"
                          ]
                        },
                        "sku": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        },
                        "category": {
                          "type": "string"
                        },
                        "quantity": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "price": {
                          "description": "In the order's currency",
                          "type": [
                            "number",
                            "string"
                          ]
                        }
                      },
                      "additionalProperties": {},
                      "description": "A product: product_url, handle, product_id, sku or title names it"
                    }
                  }
                },
                "additionalProperties": {}
              }
            },
            "required": [
              "type",
              "email"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "checkout.started"
              },
              "id": {
                "description": "Your id for this event; a repeat with the same id is a duplicate",
                "type": "string",
                "pattern": "^[\\w.:-]{1,200}$"
              },
              "email": {
                "type": "string",
                "description": "The contact the event belongs to; unknown people are unmatched"
              },
              "occurred_at": {
                "description": "When it happened; now when left out",
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "data": {
                "description": "One product, or several in items",
                "type": "object",
                "properties": {
                  "product_url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "handle": {
                    "type": "string"
                  },
                  "product_id": {
                    "type": [
                      "string",
                      "number"
                    ]
                  },
                  "sku": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "category": {
                    "type": "string"
                  },
                  "quantity": {
                    "type": "integer",
                    "minimum": 1
                  },
                  "price": {
                    "description": "In the order's currency",
                    "type": [
                      "number",
                      "string"
                    ]
                  },
                  "items": {
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "product_url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "handle": {
                          "type": "string"
                        },
                        "product_id": {
                          "type": [
                            "string",
                            "number"
                          ]
                        },
                        "sku": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        },
                        "category": {
                          "type": "string"
                        },
                        "quantity": {
                          "type": "integer",
                          "minimum": 1
                        },
                        "price": {
                          "description": "In the order's currency",
                          "type": [
                            "number",
                            "string"
                          ]
                        }
                      },
                      "additionalProperties": {},
                      "description": "A product: product_url, handle, product_id, sku or title names it"
                    }
                  }
                },
                "additionalProperties": {}
              }
            },
            "required": [
              "type",
              "email"
            ],
            "additionalProperties": false
          }
        ],
        "description": "A store event. Orders count toward revenue attribution; product, cart and checkout events feed segments, product interest and journeys. custom.* events are refused for now (400 event_type_not_supported)."
      },
      "Message": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "message"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "archived"
            ]
          },
          "subject": {
            "type": [
              "string",
              "null"
            ]
          },
          "preheader": {
            "type": [
              "string",
              "null"
            ]
          },
          "html": {
            "type": [
              "string",
              "null"
            ]
          },
          "text": {
            "type": [
              "string",
              "null"
            ]
          },
          "layout": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "branded",
                  "plain"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "style": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "lookbook",
                  "minimal",
                  "editorial",
                  "bold"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "from_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "revision": {
            "description": "Pass as base_revision when you edit",
            "type": [
              "string",
              "null"
            ]
          },
          "scheduled_send": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "send_id": {
                    "type": "string",
                    "format": "uuid",
                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                  },
                  "scheduled_at": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                        "description": "ISO 8601 time (UTC)"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "send_id",
                  "scheduled_at"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "content_removed": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ],
            "description": "Unsafe parts Tellnod removed from your html, if any"
          }
        },
        "required": [
          "object",
          "id",
          "name",
          "status",
          "subject",
          "preheader",
          "html",
          "text",
          "layout",
          "style",
          "from_name",
          "revision",
          "scheduled_send",
          "content_removed"
        ],
        "additionalProperties": false
      },
      "MessageCreate": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "For you; recipients never see it"
          },
          "subject": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Subject line. Merge tags like {{first_name|there}} are allowed."
          },
          "preheader": {
            "description": "Inbox preview text shown after the subject",
            "type": "string",
            "maxLength": 200
          },
          "body_text": {
            "description": "Plain-text body; blank lines separate paragraphs; [label](https://…) makes a link within the text. Merge tags: {{first_name|there}}, {{attributes.city}}. Alone, Tellnod lays it out as the email; with html or blocks it is the plain-text version (derived automatically when omitted).",
            "type": "string",
            "minLength": 1,
            "maxLength": 20000
          },
          "cta": {
            "description": "Main button",
            "type": "object",
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "url": {
                "type": "string",
                "maxLength": 2048,
                "pattern": "^https:\\/\\/.*"
              }
            },
            "required": [
              "label",
              "url"
            ]
          },
          "html": {
            "description": "A complete HTML email you design: table layout, inline styles, <style> with media queries and Outlook conditional comments are all kept. Use https:// for every link and image. Tellnod removes only unsafe parts (scripts, iframes, forms, event attributes, javascript: and non-https URLs) and says what it removed. Keep it under 90 KB. Do not write a footer or unsubscribe link; Tellnod adds them.",
            "type": "string",
            "maxLength": 200000
          },
          "blocks": {
            "description": "Without html: content blocks (heading, text, image, button, offer, products, divider, spacer, hero, product_grid, review, logo_row, social_links, poll) that Tellnod lays out as a 600px email in the brand's colors, or as a plain letter with layout plain. hero: a large opening photo. product_grid: products side by side, also on phones (use fetch_products for the store's real ones). review: a customer's quote. logo_row: the logo with links. social_links: links at the end. poll: a question with 2–5 answer buttons (at most 3 per email, branded layout only); each recipient confirms one answer on the store's page and can change it, and the results card shows the votes.",
            "minItems": 1,
            "maxItems": 60,
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "heading"
                    },
                    "text": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 300
                    },
                    "eyebrow": {
                      "description": "Small uppercase line above the heading",
                      "type": "string",
                      "maxLength": 80
                    }
                  },
                  "required": [
                    "type",
                    "text"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "text"
                    },
                    "text": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 5000,
                      "description": "Plain text; blank lines separate paragraphs; [label](https://…) makes a link"
                    },
                    "align": {
                      "type": "string",
                      "enum": [
                        "left",
                        "center"
                      ]
                    }
                  },
                  "required": [
                    "type",
                    "text"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "image"
                    },
                    "src": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "^https:\\/\\/.*"
                    },
                    "alt": {
                      "type": "string",
                      "maxLength": 300,
                      "description": "What the image shows; empty only for decoration"
                    },
                    "width": {
                      "description": "Intrinsic width in px",
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 4000
                    },
                    "height": {
                      "description": "Intrinsic height in px",
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 4000
                    },
                    "href": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "^https:\\/\\/.*"
                    },
                    "fullWidth": {
                      "description": "Bleed to the edges of the 600px email",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "type",
                    "src",
                    "alt"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "button"
                    },
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 60
                    },
                    "url": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "^https:\\/\\/.*"
                    }
                  },
                  "required": [
                    "type",
                    "label",
                    "url"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "offer"
                    },
                    "value": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 60,
                      "description": "Headline value, for example 15% off"
                    },
                    "label": {
                      "type": "string",
                      "maxLength": 120
                    },
                    "code": {
                      "type": "string",
                      "maxLength": 40
                    }
                  },
                  "required": [
                    "type",
                    "value"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "products"
                    },
                    "items": {
                      "minItems": 1,
                      "maxItems": 12,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "title": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "subtitle": {
                            "type": "string",
                            "maxLength": 200
                          },
                          "imageUrl": {
                            "type": "string",
                            "maxLength": 2048,
                            "pattern": "^https:\\/\\/.*"
                          },
                          "price": {
                            "type": "string",
                            "maxLength": 40
                          },
                          "compareAtPrice": {
                            "type": "string",
                            "maxLength": 40
                          },
                          "url": {
                            "type": "string",
                            "maxLength": 2048,
                            "pattern": "^https:\\/\\/.*"
                          }
                        },
                        "required": [
                          "title"
                        ]
                      }
                    }
                  },
                  "required": [
                    "type",
                    "items"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "hero"
                    },
                    "src": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "^https:\\/\\/.*",
                      "description": "A large landscape photo; Tellnod fits it to 3:2 with a safe crop"
                    },
                    "alt": {
                      "type": "string",
                      "maxLength": 300,
                      "description": "What the image shows"
                    },
                    "width": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 4000
                    },
                    "height": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 4000
                    },
                    "href": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "^https:\\/\\/.*"
                    },
                    "eyebrow": {
                      "type": "string",
                      "maxLength": 80
                    },
                    "heading": {
                      "description": "Headline under the image",
                      "type": "string",
                      "maxLength": 300
                    },
                    "text": {
                      "type": "string",
                      "maxLength": 2000
                    },
                    "cta": {
                      "type": "object",
                      "properties": {
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 60
                        },
                        "url": {
                          "type": "string",
                          "maxLength": 2048,
                          "pattern": "^https:\\/\\/.*"
                        }
                      },
                      "required": [
                        "label",
                        "url"
                      ]
                    }
                  },
                  "required": [
                    "type",
                    "src",
                    "alt"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "product_grid"
                    },
                    "items": {
                      "minItems": 1,
                      "maxItems": 12,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "title": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "subtitle": {
                            "type": "string",
                            "maxLength": 200
                          },
                          "imageUrl": {
                            "type": "string",
                            "maxLength": 2048,
                            "pattern": "^https:\\/\\/.*"
                          },
                          "price": {
                            "type": "string",
                            "maxLength": 40
                          },
                          "compareAtPrice": {
                            "type": "string",
                            "maxLength": 40
                          },
                          "url": {
                            "type": "string",
                            "maxLength": 2048,
                            "pattern": "^https:\\/\\/.*"
                          }
                        },
                        "required": [
                          "title"
                        ]
                      },
                      "description": "Two columns on every screen; photos are fitted to 4:5 with a safe crop"
                    }
                  },
                  "required": [
                    "type",
                    "items"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "review"
                    },
                    "quote": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 600,
                      "description": "A real customer's words; never invent one"
                    },
                    "author": {
                      "type": "string",
                      "maxLength": 80
                    },
                    "detail": {
                      "description": "For example the product they bought",
                      "type": "string",
                      "maxLength": 120
                    },
                    "rating": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 5
                    }
                  },
                  "required": [
                    "type",
                    "quote"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "logo_row"
                    },
                    "links": {
                      "description": "Short text links beside the logo",
                      "maxItems": 4,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "label": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 40
                          },
                          "url": {
                            "type": "string",
                            "maxLength": 2048,
                            "pattern": "^https:\\/\\/.*"
                          }
                        },
                        "required": [
                          "label",
                          "url"
                        ]
                      }
                    }
                  },
                  "required": [
                    "type"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "social_links"
                    },
                    "links": {
                      "minItems": 1,
                      "maxItems": 6,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "label": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 40
                          },
                          "url": {
                            "type": "string",
                            "maxLength": 2048,
                            "pattern": "^https:\\/\\/.*"
                          }
                        },
                        "required": [
                          "label",
                          "url"
                        ]
                      },
                      "description": "Shown at the end of the email"
                    }
                  },
                  "required": [
                    "type",
                    "links"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "poll"
                    },
                    "question": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "options": {
                      "minItems": 2,
                      "maxItems": 5,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 40
                      },
                      "description": "2 to 5 short answers, each a button"
                    },
                    "thanks": {
                      "description": "Shown on the thank-you page after a vote",
                      "type": "string",
                      "maxLength": 200
                    }
                  },
                  "required": [
                    "type",
                    "question",
                    "options"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "divider"
                    }
                  },
                  "required": [
                    "type"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "spacer"
                    },
                    "size": {
                      "type": "integer",
                      "minimum": 4,
                      "maximum": 120
                    }
                  },
                  "required": [
                    "type"
                  ]
                }
              ]
            }
          },
          "layout": {
            "description": "How the email looks. \"branded\" (default): a campaign in the brand card with logo and colors. \"plain\": a simple personal letter, like one written in Gmail (system font, plain paragraphs, the button as a plain text link, a small footer, no logo, no badge). Choose \"plain\" whenever the user asks for a personal, one-to-one, plain, simple or text-like letter, or a note that should feel written by a person; plain letters also land more often in the main inbox than in Promotions.",
            "type": "string",
            "enum": [
              "branded",
              "plain"
            ]
          },
          "style": {
            "description": "Design style of a branded email laid out from blocks or body_text. \"lookbook\" (default for new drafts): photos first on white, black and white type and a square black button, whatever the brand colors; for most shop campaigns. The others apply the brand colors and logo. \"minimal\": clean, generous whitespace; for updates and notes. \"editorial\": a magazine feel with refined headings, a large first image and a signed-off footer; for launches, lookbooks, stories and welcomes. \"bold\": a promotion with a brand-color header, a big offer panel and a full-width button; for sales, Black Friday and restocks. Pick the one that fits what the user describes; it does not apply to html you write or to plain letters.",
            "type": "string",
            "enum": [
              "lookbook",
              "minimal",
              "editorial",
              "bold"
            ]
          },
          "from_name": {
            "type": "string",
            "maxLength": 200
          }
        },
        "required": [
          "name",
          "subject"
        ],
        "additionalProperties": false,
        "description": "An email draft: body_text alone, blocks, or html you designed"
      },
      "MessageList": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "list"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessageSummary"
            }
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "description": "Pass as starting_after for the next page; null on the last page",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "object",
          "data",
          "has_more",
          "next_cursor"
        ],
        "additionalProperties": false
      },
      "MessageRender": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "message_render"
          },
          "message_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "subject": {
            "type": "string"
          },
          "preheader": {
            "type": [
              "string",
              "null"
            ]
          },
          "from": {
            "type": "string",
            "description": "The From line recipients see"
          },
          "html": {
            "type": "string",
            "description": "The email as it will be sent, footer included"
          },
          "text": {
            "type": "string"
          },
          "preview_url": {
            "type": "string",
            "format": "uri"
          },
          "sample_contact_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "uses_shared_domain": {
            "type": "boolean"
          },
          "missing_address": {
            "type": "boolean",
            "description": "The workspace has no postal address for the footer"
          },
          "checks": {
            "type": "object",
            "properties": {
              "blocking": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "fix": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "fix"
                  ],
                  "additionalProperties": false
                },
                "description": "Must be fixed before a campaign can send"
              },
              "warnings": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "fix": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "fix"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "blocking",
              "warnings"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "object",
          "message_id",
          "subject",
          "preheader",
          "from",
          "html",
          "text",
          "preview_url",
          "sample_contact_id",
          "uses_shared_domain",
          "missing_address",
          "checks"
        ],
        "additionalProperties": false
      },
      "MessageRenderInput": {
        "type": "object",
        "properties": {
          "sample_contact_id": {
            "description": "Whose merge tags to fill in; a sample contact when left out",
            "type": "string",
            "maxLength": 64
          }
        },
        "additionalProperties": false
      },
      "MessageSummary": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "message"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "draft",
              "archived"
            ]
          },
          "subject": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
            "description": "ISO 8601 time (UTC)"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
            "description": "ISO 8601 time (UTC)"
          }
        },
        "required": [
          "object",
          "id",
          "name",
          "status",
          "subject",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "MessageUpdate": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "subject": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Subject line. Merge tags like {{first_name|there}} are allowed."
          },
          "preheader": {
            "description": "Inbox preview text shown after the subject",
            "type": "string",
            "maxLength": 200
          },
          "body_text": {
            "description": "Plain-text body; blank lines separate paragraphs; [label](https://…) makes a link within the text. Merge tags: {{first_name|there}}, {{attributes.city}}. Alone, Tellnod lays it out as the email; with html or blocks it is the plain-text version (derived automatically when omitted).",
            "type": "string",
            "minLength": 1,
            "maxLength": 20000
          },
          "cta": {
            "description": "Main button",
            "type": "object",
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "url": {
                "type": "string",
                "maxLength": 2048,
                "pattern": "^https:\\/\\/.*"
              }
            },
            "required": [
              "label",
              "url"
            ]
          },
          "html": {
            "description": "A complete HTML email you design: table layout, inline styles, <style> with media queries and Outlook conditional comments are all kept. Use https:// for every link and image. Tellnod removes only unsafe parts (scripts, iframes, forms, event attributes, javascript: and non-https URLs) and says what it removed. Keep it under 90 KB. Do not write a footer or unsubscribe link; Tellnod adds them.",
            "type": "string",
            "maxLength": 200000
          },
          "blocks": {
            "description": "Without html: content blocks (heading, text, image, button, offer, products, divider, spacer, hero, product_grid, review, logo_row, social_links, poll) that Tellnod lays out as a 600px email in the brand's colors, or as a plain letter with layout plain. hero: a large opening photo. product_grid: products side by side, also on phones (use fetch_products for the store's real ones). review: a customer's quote. logo_row: the logo with links. social_links: links at the end. poll: a question with 2–5 answer buttons (at most 3 per email, branded layout only); each recipient confirms one answer on the store's page and can change it, and the results card shows the votes.",
            "minItems": 1,
            "maxItems": 60,
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "heading"
                    },
                    "text": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 300
                    },
                    "eyebrow": {
                      "description": "Small uppercase line above the heading",
                      "type": "string",
                      "maxLength": 80
                    }
                  },
                  "required": [
                    "type",
                    "text"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "text"
                    },
                    "text": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 5000,
                      "description": "Plain text; blank lines separate paragraphs; [label](https://…) makes a link"
                    },
                    "align": {
                      "type": "string",
                      "enum": [
                        "left",
                        "center"
                      ]
                    }
                  },
                  "required": [
                    "type",
                    "text"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "image"
                    },
                    "src": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "^https:\\/\\/.*"
                    },
                    "alt": {
                      "type": "string",
                      "maxLength": 300,
                      "description": "What the image shows; empty only for decoration"
                    },
                    "width": {
                      "description": "Intrinsic width in px",
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 4000
                    },
                    "height": {
                      "description": "Intrinsic height in px",
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 4000
                    },
                    "href": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "^https:\\/\\/.*"
                    },
                    "fullWidth": {
                      "description": "Bleed to the edges of the 600px email",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "type",
                    "src",
                    "alt"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "button"
                    },
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 60
                    },
                    "url": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "^https:\\/\\/.*"
                    }
                  },
                  "required": [
                    "type",
                    "label",
                    "url"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "offer"
                    },
                    "value": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 60,
                      "description": "Headline value, for example 15% off"
                    },
                    "label": {
                      "type": "string",
                      "maxLength": 120
                    },
                    "code": {
                      "type": "string",
                      "maxLength": 40
                    }
                  },
                  "required": [
                    "type",
                    "value"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "products"
                    },
                    "items": {
                      "minItems": 1,
                      "maxItems": 12,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "title": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "subtitle": {
                            "type": "string",
                            "maxLength": 200
                          },
                          "imageUrl": {
                            "type": "string",
                            "maxLength": 2048,
                            "pattern": "^https:\\/\\/.*"
                          },
                          "price": {
                            "type": "string",
                            "maxLength": 40
                          },
                          "compareAtPrice": {
                            "type": "string",
                            "maxLength": 40
                          },
                          "url": {
                            "type": "string",
                            "maxLength": 2048,
                            "pattern": "^https:\\/\\/.*"
                          }
                        },
                        "required": [
                          "title"
                        ]
                      }
                    }
                  },
                  "required": [
                    "type",
                    "items"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "hero"
                    },
                    "src": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "^https:\\/\\/.*",
                      "description": "A large landscape photo; Tellnod fits it to 3:2 with a safe crop"
                    },
                    "alt": {
                      "type": "string",
                      "maxLength": 300,
                      "description": "What the image shows"
                    },
                    "width": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 4000
                    },
                    "height": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 4000
                    },
                    "href": {
                      "type": "string",
                      "maxLength": 2048,
                      "pattern": "^https:\\/\\/.*"
                    },
                    "eyebrow": {
                      "type": "string",
                      "maxLength": 80
                    },
                    "heading": {
                      "description": "Headline under the image",
                      "type": "string",
                      "maxLength": 300
                    },
                    "text": {
                      "type": "string",
                      "maxLength": 2000
                    },
                    "cta": {
                      "type": "object",
                      "properties": {
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 60
                        },
                        "url": {
                          "type": "string",
                          "maxLength": 2048,
                          "pattern": "^https:\\/\\/.*"
                        }
                      },
                      "required": [
                        "label",
                        "url"
                      ]
                    }
                  },
                  "required": [
                    "type",
                    "src",
                    "alt"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "product_grid"
                    },
                    "items": {
                      "minItems": 1,
                      "maxItems": 12,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "title": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "subtitle": {
                            "type": "string",
                            "maxLength": 200
                          },
                          "imageUrl": {
                            "type": "string",
                            "maxLength": 2048,
                            "pattern": "^https:\\/\\/.*"
                          },
                          "price": {
                            "type": "string",
                            "maxLength": 40
                          },
                          "compareAtPrice": {
                            "type": "string",
                            "maxLength": 40
                          },
                          "url": {
                            "type": "string",
                            "maxLength": 2048,
                            "pattern": "^https:\\/\\/.*"
                          }
                        },
                        "required": [
                          "title"
                        ]
                      },
                      "description": "Two columns on every screen; photos are fitted to 4:5 with a safe crop"
                    }
                  },
                  "required": [
                    "type",
                    "items"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "review"
                    },
                    "quote": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 600,
                      "description": "A real customer's words; never invent one"
                    },
                    "author": {
                      "type": "string",
                      "maxLength": 80
                    },
                    "detail": {
                      "description": "For example the product they bought",
                      "type": "string",
                      "maxLength": 120
                    },
                    "rating": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 5
                    }
                  },
                  "required": [
                    "type",
                    "quote"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "logo_row"
                    },
                    "links": {
                      "description": "Short text links beside the logo",
                      "maxItems": 4,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "label": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 40
                          },
                          "url": {
                            "type": "string",
                            "maxLength": 2048,
                            "pattern": "^https:\\/\\/.*"
                          }
                        },
                        "required": [
                          "label",
                          "url"
                        ]
                      }
                    }
                  },
                  "required": [
                    "type"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "social_links"
                    },
                    "links": {
                      "minItems": 1,
                      "maxItems": 6,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "label": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 40
                          },
                          "url": {
                            "type": "string",
                            "maxLength": 2048,
                            "pattern": "^https:\\/\\/.*"
                          }
                        },
                        "required": [
                          "label",
                          "url"
                        ]
                      },
                      "description": "Shown at the end of the email"
                    }
                  },
                  "required": [
                    "type",
                    "links"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "poll"
                    },
                    "question": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "options": {
                      "minItems": 2,
                      "maxItems": 5,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 40
                      },
                      "description": "2 to 5 short answers, each a button"
                    },
                    "thanks": {
                      "description": "Shown on the thank-you page after a vote",
                      "type": "string",
                      "maxLength": 200
                    }
                  },
                  "required": [
                    "type",
                    "question",
                    "options"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "divider"
                    }
                  },
                  "required": [
                    "type"
                  ]
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "spacer"
                    },
                    "size": {
                      "type": "integer",
                      "minimum": 4,
                      "maximum": 120
                    }
                  },
                  "required": [
                    "type"
                  ]
                }
              ]
            }
          },
          "layout": {
            "description": "How the email looks. \"branded\" (default): a campaign in the brand card with logo and colors. \"plain\": a simple personal letter, like one written in Gmail (system font, plain paragraphs, the button as a plain text link, a small footer, no logo, no badge). Choose \"plain\" whenever the user asks for a personal, one-to-one, plain, simple or text-like letter, or a note that should feel written by a person; plain letters also land more often in the main inbox than in Promotions.",
            "type": "string",
            "enum": [
              "branded",
              "plain"
            ]
          },
          "style": {
            "description": "Design style of a branded email laid out from blocks or body_text. \"lookbook\" (default for new drafts): photos first on white, black and white type and a square black button, whatever the brand colors; for most shop campaigns. The others apply the brand colors and logo. \"minimal\": clean, generous whitespace; for updates and notes. \"editorial\": a magazine feel with refined headings, a large first image and a signed-off footer; for launches, lookbooks, stories and welcomes. \"bold\": a promotion with a brand-color header, a big offer panel and a full-width button; for sales, Black Friday and restocks. Pick the one that fits what the user describes; it does not apply to html you write or to plain letters.",
            "type": "string",
            "enum": [
              "lookbook",
              "minimal",
              "editorial",
              "bold"
            ]
          },
          "from_name": {
            "type": "string",
            "maxLength": 200
          },
          "edits": {
            "minItems": 1,
            "maxItems": 60,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "ref": {
                  "type": "string",
                  "maxLength": 10,
                  "description": "The part's ref from the preview result, for example b1"
                },
                "text": {
                  "description": "New text of a heading or text part. With find: what replaces the found text",
                  "type": "string",
                  "maxLength": 5000
                },
                "find": {
                  "description": "Change only this exact text within the part",
                  "type": "string",
                  "maxLength": 1000
                },
                "label": {
                  "description": "New button text, or an offer's label (empty removes an offer's label)",
                  "type": "string",
                  "maxLength": 120
                },
                "url": {
                  "description": "New button address",
                  "type": "string",
                  "maxLength": 2048,
                  "pattern": "^https:\\/\\/.*"
                },
                "value": {
                  "description": "New value of an offer part",
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 60
                },
                "code": {
                  "description": "New code of an offer part (empty removes it)",
                  "type": "string",
                  "maxLength": 40
                }
              },
              "required": [
                "ref"
              ]
            }
          },
          "base_revision": {
            "description": "The revision you edited; a newer one is a 409 draft_edit_conflict",
            "type": "string",
            "maxLength": 64
          }
        },
        "additionalProperties": false,
        "description": "Given fields replace; the others stay. edits change one part without the rest."
      },
      "MoneyMap": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "money_map"
          },
          "status": {
            "type": "string",
            "enum": [
              "ready",
              "list_too_small"
            ],
            "description": "list_too_small: fewer than min_contacts can receive email; nothing is estimated"
          },
          "computed_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
            "description": "ISO 8601 time (UTC)"
          },
          "min_contacts": {
            "type": "integer"
          },
          "contacts_needed": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "list_health": {
            "type": "object",
            "properties": {
              "total": {
                "type": "integer"
              },
              "sendable": {
                "type": "integer"
              },
              "unsubscribed": {
                "type": "integer"
              },
              "undeliverable": {
                "type": "integer"
              },
              "no_email": {
                "type": "integer"
              }
            },
            "required": [
              "total",
              "sendable",
              "unsubscribed",
              "undeliverable",
              "no_email"
            ],
            "additionalProperties": {}
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "estimated_total": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Estimated recoverable revenue in minor units of currency, each contact once"
          },
          "no_money_reason": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "no_orders",
                  "no_priced_orders"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "pick": {
            "description": "The segment to start with",
            "type": [
              "string",
              "null"
            ]
          },
          "segments": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "enum": [
                    "open_cart",
                    "dormant_vip",
                    "high_value_lapsed",
                    "due_to_repurchase",
                    "discount_only",
                    "one_and_done",
                    "new_subscriber"
                  ]
                },
                "name": {
                  "type": "string"
                },
                "available": {
                  "type": "boolean"
                },
                "unavailable_reason": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "count": {
                  "type": "integer"
                },
                "also_in_earlier": {
                  "type": "integer"
                },
                "estimated_revenue": {
                  "anyOf": [
                    {
                      "type": "integer"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Estimated, in minor units: count × rate.low × order_value.low"
                },
                "rate": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "basis": {
                          "type": "string",
                          "enum": [
                            "repeat_purchase",
                            "cart_recovery",
                            "first_purchase",
                            "winback"
                          ]
                        },
                        "successes": {
                          "type": "integer"
                        },
                        "trials": {
                          "type": "integer"
                        },
                        "observed": {
                          "type": "number"
                        },
                        "low": {
                          "type": "number",
                          "description": "Lower bound of the 95% Wilson score interval (times factor when present): the rate used"
                        },
                        "factor": {
                          "description": "Conservative fallback only: the multiplier on the repeat-purchase rate's lower bound (0.5)",
                          "type": "number"
                        }
                      },
                      "required": [
                        "basis",
                        "successes",
                        "trials",
                        "observed",
                        "low"
                      ],
                      "additionalProperties": {}
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "estimate_method": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "store_winback_rate",
                        "conservative_fallback"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Lapsed groups (dormant_vip, high_value_lapsed) only: store_winback_rate is the store's own win-back rate; conservative_fallback is the repeat-purchase rate's lower bound × 0.5, used while fewer than 30 lapsed customers have come back. Null for the other groups"
                },
                "no_estimate_reason": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "name",
                "available",
                "unavailable_reason",
                "count",
                "also_in_earlier",
                "estimated_revenue",
                "rate",
                "estimate_method",
                "no_estimate_reason"
              ],
              "additionalProperties": {}
            }
          },
          "inputs": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "order_value": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "currency": {
                            "type": "string"
                          },
                          "orders": {
                            "type": "integer"
                          },
                          "mean": {
                            "type": "integer"
                          },
                          "median": {
                            "type": "integer"
                          },
                          "low": {
                            "type": "integer",
                            "description": "The lower of median and mean, used"
                          }
                        },
                        "required": [
                          "currency",
                          "orders",
                          "mean",
                          "median",
                          "low"
                        ],
                        "additionalProperties": {}
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "rates": {
                    "type": "object",
                    "properties": {
                      "repeat_purchase": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "basis": {
                                "type": "string",
                                "enum": [
                                  "repeat_purchase",
                                  "cart_recovery",
                                  "first_purchase",
                                  "winback"
                                ]
                              },
                              "successes": {
                                "type": "integer"
                              },
                              "trials": {
                                "type": "integer"
                              },
                              "observed": {
                                "type": "number"
                              },
                              "low": {
                                "type": "number",
                                "description": "Lower bound of the 95% Wilson score interval (times factor when present): the rate used"
                              },
                              "factor": {
                                "description": "Conservative fallback only: the multiplier on the repeat-purchase rate's lower bound (0.5)",
                                "type": "number"
                              }
                            },
                            "required": [
                              "basis",
                              "successes",
                              "trials",
                              "observed",
                              "low"
                            ],
                            "additionalProperties": {}
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "cart_recovery": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "basis": {
                                "type": "string",
                                "enum": [
                                  "repeat_purchase",
                                  "cart_recovery",
                                  "first_purchase",
                                  "winback"
                                ]
                              },
                              "successes": {
                                "type": "integer"
                              },
                              "trials": {
                                "type": "integer"
                              },
                              "observed": {
                                "type": "number"
                              },
                              "low": {
                                "type": "number",
                                "description": "Lower bound of the 95% Wilson score interval (times factor when present): the rate used"
                              },
                              "factor": {
                                "description": "Conservative fallback only: the multiplier on the repeat-purchase rate's lower bound (0.5)",
                                "type": "number"
                              }
                            },
                            "required": [
                              "basis",
                              "successes",
                              "trials",
                              "observed",
                              "low"
                            ],
                            "additionalProperties": {}
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "first_purchase": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "basis": {
                                "type": "string",
                                "enum": [
                                  "repeat_purchase",
                                  "cart_recovery",
                                  "first_purchase",
                                  "winback"
                                ]
                              },
                              "successes": {
                                "type": "integer"
                              },
                              "trials": {
                                "type": "integer"
                              },
                              "observed": {
                                "type": "number"
                              },
                              "low": {
                                "type": "number",
                                "description": "Lower bound of the 95% Wilson score interval (times factor when present): the rate used"
                              },
                              "factor": {
                                "description": "Conservative fallback only: the multiplier on the repeat-purchase rate's lower bound (0.5)",
                                "type": "number"
                              }
                            },
                            "required": [
                              "basis",
                              "successes",
                              "trials",
                              "observed",
                              "low"
                            ],
                            "additionalProperties": {}
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "repeat_purchase",
                      "cart_recovery",
                      "first_purchase"
                    ],
                    "additionalProperties": {}
                  },
                  "winback": {
                    "type": "object",
                    "properties": {
                      "method": {
                        "type": "string",
                        "enum": [
                          "store_winback_rate",
                          "conservative_fallback"
                        ]
                      },
                      "lapsed": {
                        "type": "integer",
                        "description": "Customers who went 90+ days without a purchase"
                      },
                      "returned": {
                        "type": "integer",
                        "description": "Of them, those who bought again afterwards"
                      },
                      "min_returned": {
                        "type": "integer",
                        "description": "returned needed before the store's own win-back rate is used"
                      },
                      "observed": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "basis": {
                                "type": "string",
                                "enum": [
                                  "repeat_purchase",
                                  "cart_recovery",
                                  "first_purchase",
                                  "winback"
                                ]
                              },
                              "successes": {
                                "type": "integer"
                              },
                              "trials": {
                                "type": "integer"
                              },
                              "observed": {
                                "type": "number"
                              },
                              "low": {
                                "type": "number",
                                "description": "Lower bound of the 95% Wilson score interval (times factor when present): the rate used"
                              },
                              "factor": {
                                "description": "Conservative fallback only: the multiplier on the repeat-purchase rate's lower bound (0.5)",
                                "type": "number"
                              }
                            },
                            "required": [
                              "basis",
                              "successes",
                              "trials",
                              "observed",
                              "low"
                            ],
                            "additionalProperties": {}
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "method",
                      "lapsed",
                      "returned",
                      "min_returned",
                      "observed"
                    ],
                    "additionalProperties": {},
                    "description": "How the lapsed groups were valued"
                  },
                  "repurchase_cycle": {
                    "type": "object",
                    "properties": {
                      "store_days": {
                        "anyOf": [
                          {
                            "type": "integer"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "store_intervals": {
                        "type": "integer"
                      },
                      "categories": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "category": {
                              "type": "string"
                            },
                            "days": {
                              "type": "integer"
                            },
                            "intervals": {
                              "type": "integer"
                            }
                          },
                          "required": [
                            "category",
                            "days",
                            "intervals"
                          ],
                          "additionalProperties": {}
                        }
                      }
                    },
                    "required": [
                      "store_days",
                      "store_intervals",
                      "categories"
                    ],
                    "additionalProperties": {}
                  }
                },
                "required": [
                  "order_value",
                  "rates",
                  "winback",
                  "repurchase_cycle"
                ],
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "object",
          "status",
          "computed_at",
          "min_contacts",
          "contacts_needed",
          "list_health",
          "currency",
          "estimated_total",
          "no_money_reason",
          "pick",
          "segments",
          "inputs"
        ],
        "additionalProperties": {},
        "description": "Where the store's recoverable revenue is (docs/59): seven segments from its own contacts and orders, each contact counted once, with conservative estimates. Every money number is an estimate. More fields may appear within a version."
      },
      "OpenApiDocument": {
        "type": "object",
        "properties": {
          "openapi": {
            "type": "string"
          },
          "info": {
            "type": "object",
            "properties": {},
            "additionalProperties": {}
          },
          "paths": {
            "type": "object",
            "properties": {},
            "additionalProperties": {}
          }
        },
        "required": [
          "openapi",
          "info",
          "paths"
        ],
        "additionalProperties": {}
      },
      "Send": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/TestSend"
          },
          {
            "$ref": "#/components/schemas/CampaignSend"
          }
        ]
      },
      "SendCreate": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "test",
              "campaign"
            ],
            "description": "test: one email to your own verified address. campaign is not available through the API yet (400 send_type_not_available): a person confirms campaigns in Tellnod."
          },
          "message_id": {
            "type": "string",
            "maxLength": 64
          },
          "sample_contact_id": {
            "type": "string",
            "maxLength": 64
          },
          "to": {
            "description": "Your own verified address; the key creator's when left out",
            "type": "string",
            "maxLength": 254
          }
        },
        "required": [
          "type",
          "message_id"
        ],
        "additionalProperties": false
      },
      "SendResults": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "send_results"
          },
          "send_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "blocked",
              "pending",
              "dismissed",
              "expired",
              "scheduled",
              "cancelled",
              "sending",
              "sent"
            ]
          },
          "started_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                "description": "ISO 8601 time (UTC)"
              },
              {
                "type": "null"
              }
            ]
          },
          "completed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                "description": "ISO 8601 time (UTC)"
              },
              {
                "type": "null"
              }
            ]
          },
          "days_since_send": {
            "type": "integer"
          },
          "recipients": {
            "type": "object",
            "properties": {
              "total": {
                "anyOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "sent": {
                "type": "integer"
              },
              "queued": {
                "type": "integer"
              },
              "skipped": {
                "type": "integer"
              },
              "failed": {
                "type": "integer"
              }
            },
            "required": [
              "total",
              "sent",
              "queued",
              "skipped",
              "failed"
            ],
            "additionalProperties": {}
          },
          "counts": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "integer"
            },
            "description": "Unique people: sent, delivered, opened (estimated; absent when opens are not tracked), clicked, unsubscribed, bounced, complained"
          },
          "rates": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": [
                "number",
                "null"
              ]
            }
          },
          "opens": {
            "type": "object",
            "properties": {
              "tracked": {
                "type": "boolean"
              }
            },
            "required": [
              "tracked"
            ],
            "additionalProperties": {}
          },
          "links": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "type": "string"
                },
                "people": {
                  "type": "integer"
                }
              },
              "required": [
                "url",
                "people"
              ],
              "additionalProperties": {}
            }
          },
          "revenue": {
            "anyOf": [
              {
                "type": "object",
                "properties": {},
                "additionalProperties": {}
              },
              {
                "type": "null"
              }
            ],
            "description": "Estimated; see revenue_status"
          },
          "revenue_status": {
            "type": "string"
          }
        },
        "required": [
          "object",
          "send_id",
          "name",
          "status",
          "started_at",
          "completed_at",
          "days_since_send",
          "recipients",
          "counts",
          "rates",
          "opens",
          "links",
          "revenue",
          "revenue_status"
        ],
        "additionalProperties": {},
        "description": "Delivery, engagement and estimated revenue of a send. More fields may appear within a version; clients must ignore the ones they do not know."
      },
      "TestSend": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "send"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "type": {
            "type": "string",
            "const": "test"
          },
          "message_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "to": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "sent",
              "failed",
              "uncertain",
              "expired"
            ]
          },
          "failure_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
            "description": "ISO 8601 time (UTC)"
          },
          "sent_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                "description": "ISO 8601 time (UTC)"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "object",
          "id",
          "type",
          "message_id",
          "to",
          "status",
          "failure_code",
          "created_at",
          "sent_at"
        ],
        "additionalProperties": false
      },
      "TestSendCreated": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "send"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "type": {
            "type": "string",
            "const": "test"
          },
          "message_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "to": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "sent",
              "failed",
              "uncertain",
              "expired"
            ]
          },
          "failure_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
            "description": "ISO 8601 time (UTC)"
          },
          "sent_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                "description": "ISO 8601 time (UTC)"
              },
              {
                "type": "null"
              }
            ]
          },
          "mode": {
            "type": "string",
            "enum": [
              "live",
              "test"
            ]
          },
          "from": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "delivery": {
            "type": "string",
            "enum": [
              "delivered",
              "queued",
              "delayed"
            ]
          },
          "simulated": {
            "type": "boolean",
            "description": "Delivered by the local mock, not a real provider"
          },
          "remaining_today": {
            "type": "integer",
            "description": "Tests left today (20 a day)"
          }
        },
        "required": [
          "object",
          "id",
          "type",
          "message_id",
          "to",
          "status",
          "failure_code",
          "created_at",
          "sent_at",
          "mode",
          "from",
          "subject",
          "delivery",
          "simulated",
          "remaining_today"
        ],
        "additionalProperties": false
      },
      "Usage": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "usage"
          },
          "workspace_id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "trial",
              "starter",
              "growth"
            ]
          },
          "emails": {
            "type": "object",
            "properties": {
              "sent_this_month": {
                "type": "integer"
              },
              "monthly_limit": {
                "type": "integer"
              },
              "send_pack_balance": {
                "type": "integer"
              }
            },
            "required": [
              "sent_this_month",
              "monthly_limit",
              "send_pack_balance"
            ],
            "additionalProperties": false
          },
          "contacts": {
            "type": "object",
            "properties": {
              "total": {
                "type": "integer"
              },
              "sendable": {
                "type": "integer"
              },
              "limit": {
                "type": "integer"
              }
            },
            "required": [
              "total",
              "sendable",
              "limit"
            ],
            "additionalProperties": false
          },
          "rate_limit": {
            "type": "object",
            "properties": {
              "requests_per_minute": {
                "type": "integer"
              }
            },
            "required": [
              "requests_per_minute"
            ],
            "additionalProperties": false
          },
          "api_key": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "name": {
                "type": "string"
              },
              "mode": {
                "type": "string",
                "enum": [
                  "live",
                  "test"
                ]
              },
              "scopes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "contacts:read",
                    "contacts:write",
                    "segments:read",
                    "segments:write",
                    "events:write",
                    "messages:read",
                    "messages:write",
                    "sends:read",
                    "sends:write",
                    "webhooks:read",
                    "webhooks:write",
                    "results:read"
                  ]
                }
              },
              "prefix": {
                "type": "string",
                "description": "tn_live_ or tn_test_ and the first 8 characters; never the key"
              }
            },
            "required": [
              "id",
              "name",
              "mode",
              "scopes",
              "prefix"
            ],
            "additionalProperties": false,
            "description": "The key that made the request"
          }
        },
        "required": [
          "object",
          "workspace_id",
          "plan",
          "emails",
          "contacts",
          "rate_limit",
          "api_key"
        ],
        "additionalProperties": false
      },
      "Workspace": {
        "type": "object",
        "properties": {
          "object": {
            "type": "string",
            "const": "workspace"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "name": {
            "type": "string"
          },
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "trial",
              "starter",
              "growth"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "paused"
            ]
          },
          "approved_for_sending": {
            "type": "boolean"
          },
          "frozen": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
            "description": "ISO 8601 time (UTC)"
          },
          "billing": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string"
                  },
                  "trial_ends_at": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                        "description": "ISO 8601 time (UTC)"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "restriction": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "trial_ended",
                          "grace_ended"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "Why Free limits apply although plan is stored as another: the trial ended, or a failed payment is past its 7-day grace. null when none applies. plan is already the plan whose limits apply."
                  },
                  "grace_ends_at": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                        "description": "ISO 8601 time (UTC)"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "description": "When the subscription is past due: the moment Free limits start unless it is paid (the failed payment plus 7 days). null otherwise."
                  }
                },
                "required": [
                  "status",
                  "trial_ends_at",
                  "restriction",
                  "grace_ends_at"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "limits": {
            "type": "object",
            "properties": {
              "contacts": {
                "type": "integer"
              },
              "emails_per_month": {
                "type": "integer"
              }
            },
            "required": [
              "contacts",
              "emails_per_month"
            ],
            "additionalProperties": false
          },
          "sending_domain": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "domain": {
                    "type": "string"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "pending",
                      "verified",
                      "failed"
                    ]
                  },
                  "spf": {
                    "type": "boolean"
                  },
                  "dkim": {
                    "type": "boolean"
                  },
                  "dmarc": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "domain",
                  "status",
                  "spf",
                  "dkim",
                  "dmarc"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "api_key": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "name": {
                "type": "string"
              },
              "mode": {
                "type": "string",
                "enum": [
                  "live",
                  "test"
                ]
              },
              "scopes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "contacts:read",
                    "contacts:write",
                    "segments:read",
                    "segments:write",
                    "events:write",
                    "messages:read",
                    "messages:write",
                    "sends:read",
                    "sends:write",
                    "webhooks:read",
                    "webhooks:write",
                    "results:read"
                  ]
                }
              },
              "prefix": {
                "type": "string",
                "description": "tn_live_ or tn_test_ and the first 8 characters; never the key"
              }
            },
            "required": [
              "id",
              "name",
              "mode",
              "scopes",
              "prefix"
            ],
            "additionalProperties": false,
            "description": "The key that made the request"
          }
        },
        "required": [
          "object",
          "id",
          "name",
          "plan",
          "status",
          "approved_for_sending",
          "frozen",
          "created_at",
          "billing",
          "limits",
          "sending_domain",
          "api_key"
        ],
        "additionalProperties": false
      }
    },
    "parameters": {
      "TellnodVersion": {
        "name": "Tellnod-Version",
        "in": "header",
        "required": false,
        "description": "Pins the API version (a date). Absent means the latest; an unknown date is a 400 version_invalid, never a silent fallback.",
        "schema": {
          "type": "string",
          "enum": [
            "2026-11-10"
          ],
          "default": "2026-11-10"
        }
      },
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "description": "Makes a write safe to retry for 24 hours: the same key, route and body get the first response again (Idempotent-Replayed: true); the same key with another route or body is a 409. Server errors are not stored.",
        "schema": {
          "type": "string",
          "pattern": "^[\\x21-\\x7e]{1,200}$",
          "maxLength": 200
        }
      },
      "Limit": {
        "name": "limit",
        "in": "query",
        "required": false,
        "description": "Page size, 1 to 100.",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 20
        }
      },
      "StartingAfter": {
        "name": "starting_after",
        "in": "query",
        "required": false,
        "description": "The next_cursor of the previous page.",
        "schema": {
          "type": "string",
          "pattern": "^[\\w-]{1,100}$"
        }
      }
    },
    "headers": {
      "Request-Id": {
        "description": "This request's id (req_ and 24 hex characters); also in every error body.",
        "schema": {
          "type": "string",
          "pattern": "^req_[0-9a-f]{24}$"
        }
      },
      "Tellnod-Version": {
        "description": "The API version that answered.",
        "schema": {
          "type": "string",
          "enum": [
            "2026-11-10"
          ]
        }
      },
      "RateLimit-Limit": {
        "description": "Requests this key may make per minute (by plan).",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimit-Remaining": {
        "description": "Requests left in the current minute.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimit-Reset": {
        "description": "Seconds until the window resets.",
        "schema": {
          "type": "integer"
        }
      },
      "RateLimit-Policy": {
        "description": "The limit and its window, for example 300;w=60.",
        "schema": {
          "type": "string"
        }
      },
      "Retry-After": {
        "description": "Seconds to wait before retrying.",
        "schema": {
          "type": "integer"
        }
      },
      "Idempotent-Replayed": {
        "description": "true when this is the stored response of an earlier request with the same Idempotency-Key.",
        "schema": {
          "type": "string",
          "enum": [
            "true"
          ]
        }
      },
      "WWW-Authenticate": {
        "description": "Bearer realm=\"tellnod\"",
        "schema": {
          "type": "string"
        }
      },
      "Cache-Control": {
        "description": "How long the response may be cached.",
        "schema": {
          "type": "string"
        }
      }
    },
    "examples": {
      "version_invalid": {
        "summary": "version_invalid",
        "value": {
          "error": {
            "type": "invalid_request_error",
            "code": "version_invalid",
            "message": "Unknown Tellnod-Version \"2026-13-01\". Known versions: 2026-11-10.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#version_invalid",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "api_key_missing": {
        "summary": "api_key_missing",
        "value": {
          "error": {
            "type": "authentication_error",
            "code": "api_key_missing",
            "message": "No API key. Send it as Authorization: Bearer tn_live_… or tn_test_….",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#api_key_missing",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "api_key_invalid": {
        "summary": "api_key_invalid",
        "value": {
          "error": {
            "type": "authentication_error",
            "code": "api_key_invalid",
            "message": "The API key is not valid. Check that it was copied whole.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#api_key_invalid",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "api_key_revoked": {
        "summary": "api_key_revoked",
        "value": {
          "error": {
            "type": "authentication_error",
            "code": "api_key_revoked",
            "message": "This API key was revoked. Create a new key in the console.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#api_key_revoked",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "api_key_expired": {
        "summary": "api_key_expired",
        "value": {
          "error": {
            "type": "authentication_error",
            "code": "api_key_expired",
            "message": "This API key has expired. Create a new key in the console.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#api_key_expired",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "api_key_inactive": {
        "summary": "api_key_inactive",
        "value": {
          "error": {
            "type": "authentication_error",
            "code": "api_key_inactive",
            "message": "This API key's creator is no longer a member of the workspace. Create a new key.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#api_key_inactive",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "scope_required": {
        "summary": "scope_required",
        "value": {
          "error": {
            "type": "permission_error",
            "code": "scope_required",
            "message": "This API key does not have the contacts:write scope.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#scope_required",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "rate_limited": {
        "summary": "rate_limited",
        "value": {
          "error": {
            "type": "rate_limit_error",
            "code": "rate_limited",
            "message": "This key made more than 300 requests this minute. Retry after 12 seconds.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#rate_limited",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "internal_error": {
        "summary": "internal_error",
        "value": {
          "error": {
            "type": "api_error",
            "code": "internal_error",
            "message": "Something went wrong on Tellnod's side. Nothing was changed; retry with the same Idempotency-Key.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#internal_error",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "invalid_json": {
        "summary": "invalid_json",
        "value": {
          "error": {
            "type": "invalid_request_error",
            "code": "invalid_json",
            "message": "The request body is not valid JSON.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#invalid_json",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "body_too_large": {
        "summary": "body_too_large",
        "value": {
          "error": {
            "type": "invalid_request_error",
            "code": "body_too_large",
            "message": "The request body is too large.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#body_too_large",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "parameter_invalid": {
        "summary": "parameter_invalid",
        "value": {
          "error": {
            "type": "invalid_request_error",
            "code": "parameter_invalid",
            "message": "consent must be granted or denied.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#parameter_invalid",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "parameter_unknown": {
        "summary": "parameter_unknown",
        "value": {
          "error": {
            "type": "invalid_request_error",
            "code": "parameter_unknown",
            "message": "Unknown field subscribed_at.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#parameter_unknown",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "parameter_missing": {
        "summary": "parameter_missing",
        "value": {
          "error": {
            "type": "invalid_request_error",
            "code": "parameter_missing",
            "message": "subject: Invalid input: expected string, received undefined",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#parameter_missing",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "idempotency_key_invalid": {
        "summary": "idempotency_key_invalid",
        "value": {
          "error": {
            "type": "invalid_request_error",
            "code": "idempotency_key_invalid",
            "message": "Idempotency-Key must be 1 to 200 visible ASCII characters.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#idempotency_key_invalid",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "idempotency_conflict": {
        "summary": "idempotency_conflict",
        "value": {
          "error": {
            "type": "idempotency_error",
            "code": "idempotency_conflict",
            "message": "This Idempotency-Key was used for another request. Use a new key for a new request.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#idempotency_conflict",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "idempotency_in_progress": {
        "summary": "idempotency_in_progress",
        "value": {
          "error": {
            "type": "idempotency_error",
            "code": "idempotency_in_progress",
            "message": "A request with this Idempotency-Key is still running. Retry in a moment.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#idempotency_in_progress",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "not_found": {
        "summary": "not_found",
        "value": {
          "error": {
            "type": "invalid_request_error",
            "code": "not_found",
            "message": "No such contact in this workspace.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#not_found",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "email_invalid": {
        "summary": "email_invalid",
        "value": {
          "error": {
            "type": "invalid_request_error",
            "code": "email_invalid",
            "message": "email must be a valid email address.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#email_invalid",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "phone_invalid": {
        "summary": "phone_invalid",
        "value": {
          "error": {
            "type": "invalid_request_error",
            "code": "phone_invalid",
            "message": "phone must be in international format, for example +886912345678.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#phone_invalid",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "consent_required": {
        "summary": "consent_required",
        "value": {
          "error": {
            "type": "invalid_request_error",
            "code": "consent_required",
            "message": "A new contact needs consent: granted when the person agreed to receive marketing email, otherwise denied. It is recorded as the legal basis.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#consent_required",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "field_read_only": {
        "summary": "field_read_only",
        "value": {
          "error": {
            "type": "invalid_request_error",
            "code": "field_read_only",
            "message": "email cannot change: it is who the contact is. Create a contact with the new address.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#field_read_only",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "contact_deleted": {
        "summary": "contact_deleted",
        "value": {
          "error": {
            "type": "invalid_request_error",
            "code": "contact_deleted",
            "message": "This person was deleted from the workspace and is kept only as a do-not-email record; it cannot be added again.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#contact_deleted",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "contact_has_no_email": {
        "summary": "contact_has_no_email",
        "value": {
          "error": {
            "type": "invalid_request_error",
            "code": "contact_has_no_email",
            "message": "This contact has no email address, so it cannot be updated through the API yet.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#contact_has_no_email",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "contact_limit_exceeded": {
        "summary": "contact_limit_exceeded",
        "value": {
          "error": {
            "type": "permission_error",
            "code": "contact_limit_exceeded",
            "message": "The plan's contact limit is reached. Upgrade the plan to add more contacts.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#contact_limit_exceeded",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "event_type_invalid": {
        "summary": "event_type_invalid",
        "value": {
          "error": {
            "type": "invalid_request_error",
            "code": "event_type_invalid",
            "message": "Unknown event type. Use one of: order.created, order.cancelled, product.viewed, cart.updated, checkout.started.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#event_type_invalid",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "event_type_not_supported": {
        "summary": "event_type_not_supported",
        "value": {
          "error": {
            "type": "invalid_request_error",
            "code": "event_type_not_supported",
            "message": "custom.* events are not stored yet; they arrive with journeys on API events (P1). Send order, cart, checkout or product events.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#event_type_not_supported",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "validation": {
        "summary": "validation",
        "value": {
          "error": {
            "type": "invalid_request_error",
            "code": "validation",
            "message": "Give the email a body: body_text, blocks or html.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#validation",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "draft_edit_conflict": {
        "summary": "draft_edit_conflict",
        "value": {
          "error": {
            "type": "invalid_request_error",
            "code": "draft_edit_conflict",
            "message": "This draft changed since base_revision. Get it again and repeat the edit.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#draft_edit_conflict",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "send_type_not_available": {
        "summary": "send_type_not_available",
        "value": {
          "error": {
            "type": "invalid_request_error",
            "code": "send_type_not_available",
            "message": "Campaign sends through the API are not available yet: prepare the send in Tellnod, where a person confirms it. Use type test to send yourself a test.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#send_type_not_available",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "test_recipient_not_allowed": {
        "summary": "test_recipient_not_allowed",
        "value": {
          "error": {
            "type": "permission_error",
            "code": "test_recipient_not_allowed",
            "message": "A tn_test_ key sends only to the workspace's own verified addresses. Nothing was sent.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#test_recipient_not_allowed",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "email_not_verified": {
        "summary": "email_not_verified",
        "value": {
          "error": {
            "type": "permission_error",
            "code": "email_not_verified",
            "message": "Your own email address is not verified yet, so a test cannot be sent to it.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#email_not_verified",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "test_limit_reached": {
        "summary": "test_limit_reached",
        "value": {
          "error": {
            "type": "rate_limit_error",
            "code": "test_limit_reached",
            "message": "Today's 20 test emails are used. Tests are available again tomorrow.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#test_limit_reached",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "workspace_paused": {
        "summary": "workspace_paused",
        "value": {
          "error": {
            "type": "permission_error",
            "code": "workspace_paused",
            "message": "Sending is paused for this workspace.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#workspace_paused",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "account_frozen": {
        "summary": "account_frozen",
        "value": {
          "error": {
            "type": "permission_error",
            "code": "account_frozen",
            "message": "Sending is stopped for this account while Tellnod reviews it.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#account_frozen",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "platform_sending_paused": {
        "summary": "platform_sending_paused",
        "value": {
          "error": {
            "type": "permission_error",
            "code": "platform_sending_paused",
            "message": "Tellnod paused all sending for a moment. Nothing was sent; try again later.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#platform_sending_paused",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      },
      "send_not_started": {
        "summary": "send_not_started",
        "value": {
          "error": {
            "type": "invalid_request_error",
            "code": "send_not_started",
            "message": "This send is scheduled, so it has no results yet. Results start once sending begins.",
            "param": null,
            "doc_url": "https://tellnod.com/docs/api/errors#send_not_started",
            "request_id": "req_5f0c2a9e1b7d4c3a8e6f0b21"
          }
        }
      }
    }
  }
}
