{
  "openapi": "3.1.0",
  "info": {
    "title": "Inaiy Public API",
    "version": "1.1.0",
    "description": "# Inaiy Public API\n\nProgrammatic access to the Inaiy WhatsApp platform for third-party integrations.\n\n## Authentication\nAll requests require the `x-tenant-id` header (your workspace), plus one of:\n- **API key** — send `x-api-key: wp_live_...` (or `Authorization: Bearer wp_live_...`). Full-access, scope-exempt.\n- **OAuth 2.0 access token** — send `Authorization: Bearer wp_at_...`. Scope-enforced per endpoint.\n\n## Rate limits\nRequests are rate limited per API key (falling back to client IP). Exceeding the limit returns `429` with a standard error envelope.\n\n## Response envelope\nSuccess: `{ \"success\": true, \"data\": ..., \"meta\": { \"apiVersion\": \"v1\" }, \"requestId\", \"timestamp\" }`.\nErrors: `{ \"success\": false, \"error\": { \"code\", \"message\", \"details\" }, \"requestId\", \"timestamp\", \"path\", \"method\" }`.",
    "contact": {
      "name": "PennaiAppz"
    },
    "x-api-version": "v1",
    "x-release-date": "2026-07-12"
  },
  "servers": [
    {
      "url": "https://api.inaiy.com",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "Public API - Contacts",
      "description": "Create, read, update, and delete contacts for the authenticated tenant."
    },
    {
      "name": "Public API - Conversations",
      "description": "List, read, and update conversations."
    },
    {
      "name": "Public API - Messages",
      "description": "List and read messages, and send new messages (queued for delivery)."
    },
    {
      "name": "Public API - Templates",
      "description": "Read approved WhatsApp message templates."
    },
    {
      "name": "Public API - Broadcasts",
      "description": "Create, manage, execute, and analyze broadcast campaigns."
    },
    {
      "name": "Public API - Catalog",
      "description": "Upsert commerce catalog products into Inaiy (source of truth before WhatsApp publish)."
    },
    {
      "name": "Public API - Media",
      "description": "Upload media for outbound messages and download pending uploads."
    },
    {
      "name": "Public API - Team",
      "description": "Read agents and teams so you can assign conversations."
    },
    {
      "name": "Public API - Analytics",
      "description": "Messaging, template, broadcast, inbox, commerce, drip, AI agent and API usage reports."
    },
    {
      "name": "OAuth 2.0",
      "description": "OAuth 2.0 authorization server endpoints (authorize, token, revoke, introspect, userinfo)."
    },
    {
      "name": "Webhooks",
      "description": "Outbound webhook events delivered to your subscribed endpoints."
    }
  ],
  "x-tagGroups": [
    {
      "name": "Public REST API",
      "tags": [
        "Public API - Contacts",
        "Public API - Conversations",
        "Public API - Messages",
        "Public API - Templates",
        "Public API - Media",
        "Public API - Broadcasts",
        "Public API - Catalog",
        "Public API - Team",
        "Public API - Analytics"
      ]
    },
    {
      "name": "Authorization",
      "tags": [
        "OAuth 2.0"
      ]
    },
    {
      "name": "Webhooks",
      "tags": [
        "Webhooks"
      ]
    }
  ],
  "components": {
    "securitySchemes": {
      "apiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "API key (wp_live_ / wp_test_). Full-access, scope-exempt. Also accepted as `Authorization: Bearer <key>`."
      },
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "Opaque",
        "description": "OAuth 2.0 access token (wp_at_...). Scope-enforced per endpoint."
      },
      "oauth2": {
        "type": "oauth2",
        "description": "OAuth 2.0 flows. Authorization Code (+PKCE) for user-facing apps; Client Credentials for server-to-server.",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "/oauth/authorize",
            "tokenUrl": "/oauth/token",
            "scopes": {
              "contacts.read": "View contacts and their details.",
              "contacts.write": "Create, update, and delete contacts.",
              "conversations.read": "View conversations and their metadata.",
              "conversations.write": "Update, assign, and modify conversations.",
              "messages.read": "View messages within conversations.",
              "messages.write": "Send messages on your behalf.",
              "media.read": "View and download uploaded media files.",
              "media.write": "Upload media files for messages and template headers.",
              "templates.read": "View approved message templates.",
              "broadcasts.read": "View broadcast campaigns and their status.",
              "broadcasts.write": "Create and manage broadcast campaigns.",
              "catalog.write": "Create and update commerce catalog products via the Public API.",
              "channels.read": "View connected WhatsApp, Instagram, and Messenger channels.",
              "team.read": "View agents and teams in the workspace.",
              "analytics.read": "View messaging, template, broadcast, inbox, commerce, drip, AI agent, Public API usage, and plan usage analytics.",
              "webhooks.read": "Reserved for the upcoming webhook management API; no Public API endpoint uses it yet.",
              "webhooks.write": "Reserved for the upcoming webhook management API; no Public API endpoint uses it yet."
            }
          },
          "clientCredentials": {
            "tokenUrl": "/oauth/token",
            "scopes": {
              "contacts.read": "View contacts and their details.",
              "contacts.write": "Create, update, and delete contacts.",
              "conversations.read": "View conversations and their metadata.",
              "conversations.write": "Update, assign, and modify conversations.",
              "messages.read": "View messages within conversations.",
              "messages.write": "Send messages on your behalf.",
              "media.read": "View and download uploaded media files.",
              "media.write": "Upload media files for messages and template headers.",
              "templates.read": "View approved message templates.",
              "broadcasts.read": "View broadcast campaigns and their status.",
              "broadcasts.write": "Create and manage broadcast campaigns.",
              "catalog.write": "Create and update commerce catalog products via the Public API.",
              "channels.read": "View connected WhatsApp, Instagram, and Messenger channels.",
              "team.read": "View agents and teams in the workspace.",
              "analytics.read": "View messaging, template, broadcast, inbox, commerce, drip, AI agent, Public API usage, and plan usage analytics.",
              "webhooks.read": "Reserved for the upcoming webhook management API; no Public API endpoint uses it yet.",
              "webhooks.write": "Reserved for the upcoming webhook management API; no Public API endpoint uses it yet."
            }
          }
        }
      }
    },
    "schemas": {},
    "responses": {
      "Error400": {
        "description": "Bad Request — The request was malformed or the tenant context headers are missing.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "additionalProperties": true,
              "properties": {
                "success": {
                  "type": "boolean",
                  "example": false
                },
                "error": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                },
                "requestId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "timestamp": {
                  "type": "string",
                  "format": "date-time"
                },
                "path": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "method": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            },
            "example": {
              "success": false,
              "error": {
                "code": "ACCOUNT_CONFIGURATION_ERROR",
                "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                "details": {}
              },
              "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
              "timestamp": "2026-07-12T09:30:00.000Z",
              "path": "/api/public/v1/contacts",
              "method": "POST"
            }
          }
        }
      },
      "Error401": {
        "description": "Unauthorized — The API key or OAuth access token is missing, malformed, or invalid.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "additionalProperties": true,
              "properties": {
                "success": {
                  "type": "boolean",
                  "example": false
                },
                "error": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                },
                "requestId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "timestamp": {
                  "type": "string",
                  "format": "date-time"
                },
                "path": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "method": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            },
            "example": {
              "success": false,
              "error": {
                "code": "API_KEY_INVALID",
                "message": "Invalid API key.",
                "details": {}
              },
              "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
              "timestamp": "2026-07-12T09:30:00.000Z",
              "path": "/api/public/v1/contacts",
              "method": "POST"
            }
          }
        }
      },
      "Error403": {
        "description": "Forbidden — The developer platform is disabled, the credential lacks the required scope, or the tenant does not match.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "additionalProperties": true,
              "properties": {
                "success": {
                  "type": "boolean",
                  "example": false
                },
                "error": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                },
                "requestId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "timestamp": {
                  "type": "string",
                  "format": "date-time"
                },
                "path": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "method": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            },
            "example": {
              "success": false,
              "error": {
                "code": "OAUTH_INSUFFICIENT_SCOPE",
                "message": "The access token does not have the required scope: contacts.write.",
                "details": {
                  "requiredScope": "contacts.write"
                }
              },
              "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
              "timestamp": "2026-07-12T09:30:00.000Z",
              "path": "/api/public/v1/contacts",
              "method": "POST"
            }
          }
        }
      },
      "Error404": {
        "description": "Not Found — The requested resource does not exist (or is not visible to this tenant).",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "additionalProperties": true,
              "properties": {
                "success": {
                  "type": "boolean",
                  "example": false
                },
                "error": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                },
                "requestId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "timestamp": {
                  "type": "string",
                  "format": "date-time"
                },
                "path": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "method": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            },
            "example": {
              "success": false,
              "error": {
                "code": "CONTACT_NOT_FOUND",
                "message": "Contact not found.",
                "details": {}
              },
              "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
              "timestamp": "2026-07-12T09:30:00.000Z",
              "path": "/api/public/v1/contacts",
              "method": "POST"
            }
          }
        }
      },
      "Error409": {
        "description": "Conflict — The request conflicts with the current state, e.g. a duplicate unique value.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "additionalProperties": true,
              "properties": {
                "success": {
                  "type": "boolean",
                  "example": false
                },
                "error": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                },
                "requestId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "timestamp": {
                  "type": "string",
                  "format": "date-time"
                },
                "path": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "method": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            },
            "example": {
              "success": false,
              "error": {
                "code": "DUPLICATE_PHONE",
                "message": "A contact with this phone number already exists.",
                "details": {
                  "existingContactId": "6650a1b2c3d4e5f6a7b8c9d0"
                }
              },
              "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
              "timestamp": "2026-07-12T09:30:00.000Z",
              "path": "/api/public/v1/contacts",
              "method": "POST"
            }
          }
        }
      },
      "Error422": {
        "description": "Unprocessable Entity — Validation failed for one or more fields.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "additionalProperties": true,
              "properties": {
                "success": {
                  "type": "boolean",
                  "example": false
                },
                "error": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                },
                "requestId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "timestamp": {
                  "type": "string",
                  "format": "date-time"
                },
                "path": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "method": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            },
            "example": {
              "success": false,
              "error": {
                "code": "VALIDATION_ERROR",
                "message": "Validation failed",
                "details": {
                  "issues": [
                    {
                      "path": [
                        "phone"
                      ],
                      "message": "Invalid phone number format"
                    }
                  ]
                }
              },
              "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
              "timestamp": "2026-07-12T09:30:00.000Z",
              "path": "/api/public/v1/contacts",
              "method": "POST"
            }
          }
        }
      },
      "Error429": {
        "description": "Too Many Requests — The rate limit for this API key (or IP) was exceeded.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "additionalProperties": true,
              "properties": {
                "success": {
                  "type": "boolean",
                  "example": false
                },
                "error": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                },
                "requestId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "timestamp": {
                  "type": "string",
                  "format": "date-time"
                },
                "path": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "method": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            },
            "example": {
              "success": false,
              "error": {
                "code": "RATE_LIMIT_EXCEEDED",
                "message": "Too many requests. Please retry later.",
                "details": {
                  "limit": 100,
                  "remainingMs": 4200
                }
              },
              "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
              "timestamp": "2026-07-12T09:30:00.000Z",
              "path": "/api/public/v1/contacts",
              "method": "POST"
            }
          }
        }
      },
      "Error500": {
        "description": "Internal Server Error — An unexpected error occurred on the server.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "additionalProperties": true,
              "properties": {
                "success": {
                  "type": "boolean",
                  "example": false
                },
                "error": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                },
                "requestId": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "timestamp": {
                  "type": "string",
                  "format": "date-time"
                },
                "path": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "method": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            },
            "example": {
              "success": false,
              "error": {
                "code": "INTERNAL_SERVER_ERROR",
                "message": "Internal server error",
                "details": {}
              },
              "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
              "timestamp": "2026-07-12T09:30:00.000Z",
              "path": "/api/public/v1/contacts",
              "method": "POST"
            }
          }
        }
      }
    }
  },
  "security": [
    {
      "apiKeyAuth": []
    },
    {
      "bearerAuth": []
    },
    {
      "oauth2": []
    }
  ],
  "paths": {
    "/api/public/v1/contacts": {
      "get": {
        "summary": "List contacts",
        "tags": [
          "Public API - Contacts"
        ],
        "description": "Returns a paginated, filterable, sortable list of contacts for the authenticated tenant.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1,
              "example": 1
            },
            "in": "query",
            "name": "page",
            "required": false
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "example": 25
            },
            "in": "query",
            "name": "limit",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "createdAt",
                "name",
                "phone",
                "email",
                "country",
                "updatedAt",
                "lastContactedAt",
                "source"
              ],
              "default": "createdAt"
            },
            "in": "query",
            "name": "sort",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "desc"
            },
            "in": "query",
            "name": "order",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "jane"
            },
            "in": "query",
            "name": "search",
            "required": false,
            "description": "Matches name, phone, or email."
          },
          {
            "schema": {
              "type": "string",
              "example": "vip,newsletter"
            },
            "in": "query",
            "name": "label",
            "required": false,
            "description": "Comma-separated label/tag filter."
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "deleted",
                "blocked",
                "merged"
              ],
              "default": "active"
            },
            "in": "query",
            "name": "status",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "US"
            },
            "in": "query",
            "name": "country",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "manual",
                "import",
                "api",
                "whatsapp",
                "web"
              ]
            },
            "in": "query",
            "name": "source",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "in": "query",
            "name": "createdAfter",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "in": "query",
            "name": "createdBefore",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "in": "query",
            "name": "updatedAfter",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "in": "query",
            "name": "updatedBefore",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "id,name,phone"
            },
            "in": "query",
            "name": "fields",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of contacts",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Paginated list of contacts",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true,
                        "properties": {
                          "id": {
                            "type": "string",
                            "example": "6650a1b2c3d4e5f6a7b8c9d0"
                          },
                          "name": {
                            "type": "string",
                            "example": "Jane Doe"
                          },
                          "phone": {
                            "type": "string",
                            "example": "+14155552671"
                          },
                          "email": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "jane@example.com"
                          },
                          "country": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "US"
                          },
                          "tags": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            },
                            "example": [
                              "vip",
                              "newsletter"
                            ]
                          },
                          "customFields": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "additionalProperties": true,
                              "properties": {
                                "fieldId": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "fieldName": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "type": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "value": {}
                              }
                            }
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "manual",
                              "import",
                              "api",
                              "whatsapp",
                              "web"
                            ],
                            "example": "api"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "active",
                              "deleted",
                              "blocked",
                              "merged"
                            ],
                            "example": "active"
                          },
                          "isFavorite": {
                            "type": "boolean",
                            "example": false
                          },
                          "isBlocked": {
                            "type": "boolean",
                            "example": false
                          },
                          "marketingOptIn": {
                            "type": "boolean",
                            "example": true
                          },
                          "marketingOptInAt": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "format": "date-time"
                          },
                          "lastContactedAt": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "format": "date-time"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "updatedAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "page": {
                          "type": "integer",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "example": 137
                        },
                        "totalPages": {
                          "type": "integer",
                          "example": 6
                        },
                        "hasNextPage": {
                          "type": "boolean",
                          "example": true
                        },
                        "hasPrevPage": {
                          "type": "boolean",
                          "example": false
                        },
                        "nextCursor": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": null
                        },
                        "prevCursor": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": null
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "example": {
                    "success": true,
                    "data": [
                      {
                        "id": "6650a1b2c3d4e5f6a7b8c9d0",
                        "name": "Jane Doe",
                        "phone": "+14155552671",
                        "email": "jane@example.com",
                        "country": "US",
                        "tags": [
                          "vip",
                          "newsletter"
                        ],
                        "customFields": [
                          {
                            "fieldId": "664f...",
                            "fieldName": "Company",
                            "type": "text",
                            "value": "Acme Inc"
                          }
                        ],
                        "source": "api",
                        "status": "active",
                        "isFavorite": false,
                        "isBlocked": false,
                        "marketingOptIn": true,
                        "marketingOptInAt": "2026-07-12T09:30:00.000Z",
                        "lastContactedAt": null,
                        "createdAt": "2026-07-12T09:30:00.000Z",
                        "updatedAt": "2026-07-12T09:30:00.000Z"
                      }
                    ],
                    "pagination": {
                      "page": 1,
                      "limit": 25,
                      "total": 137,
                      "totalPages": 6,
                      "hasNextPage": true,
                      "hasPrevPage": false,
                      "nextCursor": null,
                      "prevCursor": null
                    },
                    "meta": {
                      "apiVersion": "v1",
                      "sort": {
                        "field": "createdAt",
                        "direction": "desc"
                      }
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z"
                  }
                },
                "example": {
                  "success": true,
                  "data": [
                    {
                      "id": "6650a1b2c3d4e5f6a7b8c9d0",
                      "name": "Jane Doe",
                      "phone": "+14155552671",
                      "email": "jane@example.com",
                      "country": "US",
                      "tags": [
                        "vip",
                        "newsletter"
                      ],
                      "customFields": [
                        {
                          "fieldId": "664f...",
                          "fieldName": "Company",
                          "type": "text",
                          "value": "Acme Inc"
                        }
                      ],
                      "source": "api",
                      "status": "active",
                      "isFavorite": false,
                      "isBlocked": false,
                      "marketingOptIn": true,
                      "marketingOptInAt": "2026-07-12T09:30:00.000Z",
                      "lastContactedAt": null,
                      "createdAt": "2026-07-12T09:30:00.000Z",
                      "updatedAt": "2026-07-12T09:30:00.000Z"
                    }
                  ],
                  "pagination": {
                    "page": 1,
                    "limit": 25,
                    "total": 137,
                    "totalPages": 6,
                    "hasNextPage": true,
                    "hasPrevPage": false,
                    "nextCursor": null,
                    "prevCursor": null
                  },
                  "meta": {
                    "apiVersion": "v1",
                    "sort": {
                      "field": "createdAt",
                      "direction": "desc"
                    }
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "ACCOUNT_CONFIGURATION_ERROR",
                      "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "ACCOUNT_CONFIGURATION_ERROR",
                    "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "API_KEY_INVALID",
                      "message": "Invalid API key.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "API_KEY_INVALID",
                    "message": "Invalid API key.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — developer platform disabled, key expired/disabled, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden — developer platform disabled, key expired/disabled, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DEVELOPER_PLATFORM_DISABLED",
                      "message": "Developer platform is disabled for this organization.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DEVELOPER_PLATFORM_DISABLED",
                    "message": "Developer platform is disabled for this organization.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "VALIDATION_ERROR",
                      "message": "Validation failed",
                      "details": {
                        "issues": [
                          {
                            "path": [
                              "phone"
                            ],
                            "message": "Invalid phone number format"
                          }
                        ]
                      }
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "VALIDATION_ERROR",
                    "message": "Validation failed",
                    "details": {
                      "issues": [
                        {
                          "path": [
                            "phone"
                          ],
                          "message": "Invalid phone number format"
                        }
                      ]
                    }
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests — rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Too many requests. Please retry later.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RATE_LIMIT_EXCEEDED",
                    "message": "Too many requests. Please retry later.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "INTERNAL_SERVER_ERROR",
                      "message": "Internal server error",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "message": "Internal server error",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/contacts\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/contacts\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/contacts\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/contacts\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/contacts\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/contacts\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/contacts\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      },
      "post": {
        "summary": "Create a contact",
        "tags": [
          "Public API - Contacts"
        ],
        "description": "Create a new contact. Fails with 409 if a contact with the same phone already exists, and 404 if primaryTeamId or assignedAgentId is not in this workspace.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "phone"
                ],
                "additionalProperties": true,
                "properties": {
                  "name": {
                    "type": "string",
                    "example": "Jane Doe"
                  },
                  "phone": {
                    "type": "string",
                    "description": "E.164 format",
                    "example": "+14155552671"
                  },
                  "email": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "email",
                    "example": "jane@example.com"
                  },
                  "country": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "example": "US"
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "example": [
                      "vip"
                    ]
                  },
                  "customFields": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "manual",
                      "import",
                      "api",
                      "whatsapp",
                      "web"
                    ],
                    "example": "api"
                  },
                  "marketingOptIn": {
                    "type": "boolean",
                    "example": true
                  },
                  "primaryTeamId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Owning team id (24-char ObjectId). Must be a team in this workspace; null clears it.",
                    "example": "6650a1b2c3d4e5f6a7b8c9d4"
                  },
                  "assignedAgentId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Owning agent (user) id. Must be a member of this workspace; null clears it.",
                    "example": "6650a1b2c3d4e5f6a7b8c9d5"
                  }
                },
                "example": {
                  "name": "Jane Doe",
                  "phone": "+14155552671",
                  "email": "jane@example.com",
                  "country": "US",
                  "tags": [
                    "vip"
                  ],
                  "marketingOptIn": true
                }
              },
              "example": {
                "name": "Jane Doe",
                "phone": "+14155552671",
                "email": "jane@example.com",
                "country": "US",
                "tags": [
                  "vip"
                ],
                "marketingOptIn": true
              }
            }
          },
          "required": true
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "201": {
            "description": "Contact created",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Contact created",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "id": {
                          "type": "string",
                          "example": "6650a1b2c3d4e5f6a7b8c9d0"
                        },
                        "name": {
                          "type": "string",
                          "example": "Jane Doe"
                        },
                        "phone": {
                          "type": "string",
                          "example": "+14155552671"
                        },
                        "email": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "jane@example.com"
                        },
                        "country": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "US"
                        },
                        "tags": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "example": [
                            "vip",
                            "newsletter"
                          ]
                        },
                        "customFields": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": true,
                            "properties": {
                              "fieldId": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "fieldName": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "type": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "value": {}
                            }
                          }
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "manual",
                            "import",
                            "api",
                            "whatsapp",
                            "web"
                          ],
                          "example": "api"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "active",
                            "deleted",
                            "blocked",
                            "merged"
                          ],
                          "example": "active"
                        },
                        "isFavorite": {
                          "type": "boolean",
                          "example": false
                        },
                        "isBlocked": {
                          "type": "boolean",
                          "example": false
                        },
                        "marketingOptIn": {
                          "type": "boolean",
                          "example": true
                        },
                        "marketingOptInAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        },
                        "lastContactedAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "example": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11"
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "example": {
                    "success": true,
                    "data": {
                      "id": "6650a1b2c3d4e5f6a7b8c9d0",
                      "name": "Jane Doe",
                      "phone": "+14155552671",
                      "email": "jane@example.com",
                      "country": "US",
                      "tags": [
                        "vip",
                        "newsletter"
                      ],
                      "customFields": [
                        {
                          "fieldId": "664f...",
                          "fieldName": "Company",
                          "type": "text",
                          "value": "Acme Inc"
                        }
                      ],
                      "source": "api",
                      "status": "active",
                      "isFavorite": false,
                      "isBlocked": false,
                      "marketingOptIn": true,
                      "marketingOptInAt": "2026-07-12T09:30:00.000Z",
                      "lastContactedAt": null,
                      "createdAt": "2026-07-12T09:30:00.000Z",
                      "updatedAt": "2026-07-12T09:30:00.000Z"
                    },
                    "meta": {
                      "apiVersion": "v1"
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z"
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "6650a1b2c3d4e5f6a7b8c9d0",
                    "name": "Jane Doe",
                    "phone": "+14155552671",
                    "email": "jane@example.com",
                    "country": "US",
                    "tags": [
                      "vip",
                      "newsletter"
                    ],
                    "customFields": [
                      {
                        "fieldId": "664f...",
                        "fieldName": "Company",
                        "type": "text",
                        "value": "Acme Inc"
                      }
                    ],
                    "source": "api",
                    "status": "active",
                    "isFavorite": false,
                    "isBlocked": false,
                    "marketingOptIn": true,
                    "marketingOptInAt": "2026-07-12T09:30:00.000Z",
                    "lastContactedAt": null,
                    "createdAt": "2026-07-12T09:30:00.000Z",
                    "updatedAt": "2026-07-12T09:30:00.000Z"
                  },
                  "meta": {
                    "apiVersion": "v1"
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "ACCOUNT_CONFIGURATION_ERROR",
                      "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "ACCOUNT_CONFIGURATION_ERROR",
                    "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "API_KEY_INVALID",
                      "message": "Invalid API key.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "API_KEY_INVALID",
                    "message": "Invalid API key.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — developer platform disabled, key expired/disabled, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden — developer platform disabled, key expired/disabled, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DEVELOPER_PLATFORM_DISABLED",
                      "message": "Developer platform is disabled for this organization.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DEVELOPER_PLATFORM_DISABLED",
                    "message": "Developer platform is disabled for this organization.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "404": {
            "description": "Contact not found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Contact not found",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "CONTACT_NOT_FOUND",
                      "message": "Contact not found.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "CONTACT_NOT_FOUND",
                    "message": "Contact not found.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "409": {
            "description": "Duplicate contact (phone already exists)",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Duplicate contact (phone already exists)",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DUPLICATE_PHONE",
                      "message": "A contact with this phone number already exists.",
                      "details": {
                        "existingContactId": "6650a1b2c3d4e5f6a7b8c9d0"
                      }
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DUPLICATE_PHONE",
                    "message": "A contact with this phone number already exists.",
                    "details": {
                      "existingContactId": "6650a1b2c3d4e5f6a7b8c9d0"
                    }
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "VALIDATION_ERROR",
                      "message": "Validation failed",
                      "details": {
                        "issues": [
                          {
                            "path": [
                              "phone"
                            ],
                            "message": "Invalid phone number format"
                          }
                        ]
                      }
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "VALIDATION_ERROR",
                    "message": "Validation failed",
                    "details": {
                      "issues": [
                        {
                          "path": [
                            "phone"
                          ],
                          "message": "Invalid phone number format"
                        }
                      ]
                    }
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests — rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Too many requests. Please retry later.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RATE_LIMIT_EXCEEDED",
                    "message": "Too many requests. Please retry later.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "INTERNAL_SERVER_ERROR",
                      "message": "Internal server error",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "message": "Internal server error",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X POST \"https://api.inaiy.com/api/public/v1/contacts\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"name\":\"Jane Doe\",\"phone\":\"+14155552671\",\"email\":\"jane@example.com\",\"country\":\"US\",\"tags\":[\"vip\"],\"marketingOptIn\":true}'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/contacts\", {\n  method: \"POST\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n    \"Content-Type\": \"application/json\"\n  },\n  body: JSON.stringify({\n    \"name\": \"Jane Doe\",\n    \"phone\": \"+14155552671\",\n    \"email\": \"jane@example.com\",\n    \"country\": \"US\",\n    \"tags\": [\n      \"vip\"\n    ],\n    \"marketingOptIn\": true\n  })\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/contacts\", {\n    method: \"POST\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n      \"Content-Type\": \"application/json\"\n    },\n    body: JSON.stringify({\n      \"name\": \"Jane Doe\",\n      \"phone\": \"+14155552671\",\n      \"email\": \"jane@example.com\",\n      \"country\": \"US\",\n      \"tags\": [\n        \"vip\"\n      ],\n      \"marketingOptIn\": true\n    })\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\npayload = {\n  \"name\": \"Jane Doe\",\n  \"phone\": \"+14155552671\",\n  \"email\": \"jane@example.com\",\n  \"country\": \"US\",\n  \"tags\": [\n    \"vip\"\n  ],\n  \"marketingOptIn\": True\n}\nres = requests.post(\"https://api.inaiy.com/api/public/v1/contacts\", headers=headers, json=payload)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/contacts\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .header(\"Content-Type\", \"application/json\")\n    .method(\"POST\", HttpRequest.BodyPublishers.ofString(\"{\\\"name\\\":\\\"Jane Doe\\\",\\\"phone\\\":\\\"+14155552671\\\",\\\"email\\\":\\\"jane@example.com\\\",\\\"country\\\":\\\"US\\\",\\\"tags\\\":[\\\"vip\\\"],\\\"marketingOptIn\\\":true}\"))\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/contacts\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\",\n    \"Content-Type: application/json\"\n]);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, '{\"name\":\"Jane Doe\",\"phone\":\"+14155552671\",\"email\":\"jane@example.com\",\"country\":\"US\",\"tags\":[\"vip\"],\"marketingOptIn\":true}');\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"POST\"), \"https://api.inaiy.com/api/public/v1/contacts\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nrequest.Content = new StringContent(\"{\\\"name\\\":\\\"Jane Doe\\\",\\\"phone\\\":\\\"+14155552671\\\",\\\"email\\\":\\\"jane@example.com\\\",\\\"country\\\":\\\"US\\\",\\\"tags\\\":[\\\"vip\\\"],\\\"marketingOptIn\\\":true}\", System.Text.Encoding.UTF8, \"application/json\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/contacts/lookup": {
      "get": {
        "summary": "Look up a contact",
        "tags": [
          "Public API - Contacts"
        ],
        "description": "Find one contact by exactly one of `phone` (matched with or without the leading +), `igsid` (Instagram), or `psid` (Messenger). Returns 404 when no active contact matches.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "example": "+14155552671"
            },
            "in": "query",
            "name": "phone",
            "required": false,
            "description": "E.164 phone. URL-encode the + as %2B."
          },
          {
            "schema": {
              "type": "string",
              "example": "17841400000000000"
            },
            "in": "query",
            "name": "igsid",
            "required": false,
            "description": "Instagram scoped id."
          },
          {
            "schema": {
              "type": "string",
              "example": "24000000000000000"
            },
            "in": "query",
            "name": "psid",
            "required": false,
            "description": "Messenger Page-scoped id."
          },
          {
            "schema": {
              "type": "string",
              "example": "id,name,phone"
            },
            "in": "query",
            "name": "fields",
            "required": false,
            "description": "Comma-separated list of fields to return (sparse fieldset)."
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "The contact",
            "content": {
              "application/json": {
                "schema": {
                  "description": "The contact",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "id": {
                          "type": "string",
                          "example": "6650a1b2c3d4e5f6a7b8c9d0"
                        },
                        "name": {
                          "type": "string",
                          "example": "Jane Doe"
                        },
                        "phone": {
                          "type": "string",
                          "example": "+14155552671"
                        },
                        "email": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "jane@example.com"
                        },
                        "country": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "US"
                        },
                        "tags": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "example": [
                            "vip",
                            "newsletter"
                          ]
                        },
                        "customFields": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": true,
                            "properties": {
                              "fieldId": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "fieldName": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "type": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "value": {}
                            }
                          }
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "manual",
                            "import",
                            "api",
                            "whatsapp",
                            "web"
                          ],
                          "example": "api"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "active",
                            "deleted",
                            "blocked",
                            "merged"
                          ],
                          "example": "active"
                        },
                        "isFavorite": {
                          "type": "boolean",
                          "example": false
                        },
                        "isBlocked": {
                          "type": "boolean",
                          "example": false
                        },
                        "marketingOptIn": {
                          "type": "boolean",
                          "example": true
                        },
                        "marketingOptInAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        },
                        "lastContactedAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "example": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11"
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "example": {
                    "success": true,
                    "data": {
                      "id": "6650a1b2c3d4e5f6a7b8c9d0",
                      "name": "Jane Doe",
                      "phone": "+14155552671",
                      "email": "jane@example.com",
                      "country": "US",
                      "tags": [
                        "vip",
                        "newsletter"
                      ],
                      "customFields": [
                        {
                          "fieldId": "664f...",
                          "fieldName": "Company",
                          "type": "text",
                          "value": "Acme Inc"
                        }
                      ],
                      "source": "api",
                      "status": "active",
                      "isFavorite": false,
                      "isBlocked": false,
                      "marketingOptIn": true,
                      "marketingOptInAt": "2026-07-12T09:30:00.000Z",
                      "lastContactedAt": null,
                      "createdAt": "2026-07-12T09:30:00.000Z",
                      "updatedAt": "2026-07-12T09:30:00.000Z"
                    },
                    "meta": {
                      "apiVersion": "v1"
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z"
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "6650a1b2c3d4e5f6a7b8c9d0",
                    "name": "Jane Doe",
                    "phone": "+14155552671",
                    "email": "jane@example.com",
                    "country": "US",
                    "tags": [
                      "vip",
                      "newsletter"
                    ],
                    "customFields": [
                      {
                        "fieldId": "664f...",
                        "fieldName": "Company",
                        "type": "text",
                        "value": "Acme Inc"
                      }
                    ],
                    "source": "api",
                    "status": "active",
                    "isFavorite": false,
                    "isBlocked": false,
                    "marketingOptIn": true,
                    "marketingOptInAt": "2026-07-12T09:30:00.000Z",
                    "lastContactedAt": null,
                    "createdAt": "2026-07-12T09:30:00.000Z",
                    "updatedAt": "2026-07-12T09:30:00.000Z"
                  },
                  "meta": {
                    "apiVersion": "v1"
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "ACCOUNT_CONFIGURATION_ERROR",
                      "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "ACCOUNT_CONFIGURATION_ERROR",
                    "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "API_KEY_INVALID",
                      "message": "Invalid API key.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "API_KEY_INVALID",
                    "message": "Invalid API key.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — developer platform disabled, key expired/disabled, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden — developer platform disabled, key expired/disabled, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DEVELOPER_PLATFORM_DISABLED",
                      "message": "Developer platform is disabled for this organization.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DEVELOPER_PLATFORM_DISABLED",
                    "message": "Developer platform is disabled for this organization.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "404": {
            "description": "Contact not found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Contact not found",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "CONTACT_NOT_FOUND",
                      "message": "Contact not found.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "CONTACT_NOT_FOUND",
                    "message": "Contact not found.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "VALIDATION_ERROR",
                      "message": "Validation failed",
                      "details": {
                        "issues": [
                          {
                            "path": [
                              "phone"
                            ],
                            "message": "Invalid phone number format"
                          }
                        ]
                      }
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "VALIDATION_ERROR",
                    "message": "Validation failed",
                    "details": {
                      "issues": [
                        {
                          "path": [
                            "phone"
                          ],
                          "message": "Invalid phone number format"
                        }
                      ]
                    }
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests — rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Too many requests. Please retry later.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RATE_LIMIT_EXCEEDED",
                    "message": "Too many requests. Please retry later.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "INTERNAL_SERVER_ERROR",
                      "message": "Internal server error",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "message": "Internal server error",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/contacts/lookup\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/contacts/lookup\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/contacts/lookup\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/contacts/lookup\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/contacts/lookup\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/contacts/lookup\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/contacts/lookup\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/contacts/{id}": {
      "get": {
        "summary": "Get a contact by id",
        "tags": [
          "Public API - Contacts"
        ],
        "description": "Fetch a single contact by its public id.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "example": "id,name,phone"
            },
            "in": "query",
            "name": "fields",
            "required": false,
            "description": "Comma-separated list of fields to return (sparse fieldset)."
          },
          {
            "schema": {
              "type": "string",
              "example": "6650a1b2c3d4e5f6a7b8c9d0"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "24-char contact ObjectId"
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "The contact",
            "content": {
              "application/json": {
                "schema": {
                  "description": "The contact",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "id": {
                          "type": "string",
                          "example": "6650a1b2c3d4e5f6a7b8c9d0"
                        },
                        "name": {
                          "type": "string",
                          "example": "Jane Doe"
                        },
                        "phone": {
                          "type": "string",
                          "example": "+14155552671"
                        },
                        "email": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "jane@example.com"
                        },
                        "country": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "US"
                        },
                        "tags": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "example": [
                            "vip",
                            "newsletter"
                          ]
                        },
                        "customFields": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": true,
                            "properties": {
                              "fieldId": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "fieldName": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "type": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "value": {}
                            }
                          }
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "manual",
                            "import",
                            "api",
                            "whatsapp",
                            "web"
                          ],
                          "example": "api"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "active",
                            "deleted",
                            "blocked",
                            "merged"
                          ],
                          "example": "active"
                        },
                        "isFavorite": {
                          "type": "boolean",
                          "example": false
                        },
                        "isBlocked": {
                          "type": "boolean",
                          "example": false
                        },
                        "marketingOptIn": {
                          "type": "boolean",
                          "example": true
                        },
                        "marketingOptInAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        },
                        "lastContactedAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "example": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11"
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "example": {
                    "success": true,
                    "data": {
                      "id": "6650a1b2c3d4e5f6a7b8c9d0",
                      "name": "Jane Doe",
                      "phone": "+14155552671",
                      "email": "jane@example.com",
                      "country": "US",
                      "tags": [
                        "vip",
                        "newsletter"
                      ],
                      "customFields": [
                        {
                          "fieldId": "664f...",
                          "fieldName": "Company",
                          "type": "text",
                          "value": "Acme Inc"
                        }
                      ],
                      "source": "api",
                      "status": "active",
                      "isFavorite": false,
                      "isBlocked": false,
                      "marketingOptIn": true,
                      "marketingOptInAt": "2026-07-12T09:30:00.000Z",
                      "lastContactedAt": null,
                      "createdAt": "2026-07-12T09:30:00.000Z",
                      "updatedAt": "2026-07-12T09:30:00.000Z"
                    },
                    "meta": {
                      "apiVersion": "v1"
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z"
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "6650a1b2c3d4e5f6a7b8c9d0",
                    "name": "Jane Doe",
                    "phone": "+14155552671",
                    "email": "jane@example.com",
                    "country": "US",
                    "tags": [
                      "vip",
                      "newsletter"
                    ],
                    "customFields": [
                      {
                        "fieldId": "664f...",
                        "fieldName": "Company",
                        "type": "text",
                        "value": "Acme Inc"
                      }
                    ],
                    "source": "api",
                    "status": "active",
                    "isFavorite": false,
                    "isBlocked": false,
                    "marketingOptIn": true,
                    "marketingOptInAt": "2026-07-12T09:30:00.000Z",
                    "lastContactedAt": null,
                    "createdAt": "2026-07-12T09:30:00.000Z",
                    "updatedAt": "2026-07-12T09:30:00.000Z"
                  },
                  "meta": {
                    "apiVersion": "v1"
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "ACCOUNT_CONFIGURATION_ERROR",
                      "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "ACCOUNT_CONFIGURATION_ERROR",
                    "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "API_KEY_INVALID",
                      "message": "Invalid API key.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "API_KEY_INVALID",
                    "message": "Invalid API key.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — developer platform disabled, key expired/disabled, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden — developer platform disabled, key expired/disabled, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DEVELOPER_PLATFORM_DISABLED",
                      "message": "Developer platform is disabled for this organization.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DEVELOPER_PLATFORM_DISABLED",
                    "message": "Developer platform is disabled for this organization.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "404": {
            "description": "Contact not found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Contact not found",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "CONTACT_NOT_FOUND",
                      "message": "Contact not found.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "CONTACT_NOT_FOUND",
                    "message": "Contact not found.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests — rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Too many requests. Please retry later.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RATE_LIMIT_EXCEEDED",
                    "message": "Too many requests. Please retry later.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "INTERNAL_SERVER_ERROR",
                      "message": "Internal server error",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "message": "Internal server error",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/contacts/6650a1b2c3d4e5f6a7b8c9d0\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/contacts/6650a1b2c3d4e5f6a7b8c9d0\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/contacts/6650a1b2c3d4e5f6a7b8c9d0\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/contacts/6650a1b2c3d4e5f6a7b8c9d0\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/contacts/6650a1b2c3d4e5f6a7b8c9d0\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/contacts/6650a1b2c3d4e5f6a7b8c9d0\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/contacts/6650a1b2c3d4e5f6a7b8c9d0\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      },
      "patch": {
        "summary": "Update a contact",
        "tags": [
          "Public API - Contacts"
        ],
        "description": "Partially update a contact. Provide at least one field.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "minProperties": 1,
                "additionalProperties": true,
                "properties": {
                  "name": {
                    "type": "string",
                    "example": "Jane Doe"
                  },
                  "phone": {
                    "type": "string",
                    "description": "E.164 format",
                    "example": "+14155552671"
                  },
                  "email": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "email",
                    "example": "jane@example.com"
                  },
                  "country": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "example": "US"
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "example": [
                      "vip"
                    ]
                  },
                  "customFields": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "manual",
                      "import",
                      "api",
                      "whatsapp",
                      "web"
                    ],
                    "example": "api"
                  },
                  "marketingOptIn": {
                    "type": "boolean",
                    "example": true
                  },
                  "primaryTeamId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Owning team id (24-char ObjectId). Must be a team in this workspace; null clears it.",
                    "example": "6650a1b2c3d4e5f6a7b8c9d4"
                  },
                  "assignedAgentId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Owning agent (user) id. Must be a member of this workspace; null clears it.",
                    "example": "6650a1b2c3d4e5f6a7b8c9d5"
                  }
                },
                "example": {
                  "name": "Jane A. Doe",
                  "tags": [
                    "vip",
                    "priority"
                  ]
                }
              },
              "example": {
                "name": "Jane A. Doe",
                "tags": [
                  "vip",
                  "priority"
                ]
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "example": "6650a1b2c3d4e5f6a7b8c9d0"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "24-char contact ObjectId"
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "Contact updated",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Contact updated",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "id": {
                          "type": "string",
                          "example": "6650a1b2c3d4e5f6a7b8c9d0"
                        },
                        "name": {
                          "type": "string",
                          "example": "Jane Doe"
                        },
                        "phone": {
                          "type": "string",
                          "example": "+14155552671"
                        },
                        "email": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "jane@example.com"
                        },
                        "country": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "US"
                        },
                        "tags": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "example": [
                            "vip",
                            "newsletter"
                          ]
                        },
                        "customFields": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": true,
                            "properties": {
                              "fieldId": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "fieldName": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "type": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "value": {}
                            }
                          }
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "manual",
                            "import",
                            "api",
                            "whatsapp",
                            "web"
                          ],
                          "example": "api"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "active",
                            "deleted",
                            "blocked",
                            "merged"
                          ],
                          "example": "active"
                        },
                        "isFavorite": {
                          "type": "boolean",
                          "example": false
                        },
                        "isBlocked": {
                          "type": "boolean",
                          "example": false
                        },
                        "marketingOptIn": {
                          "type": "boolean",
                          "example": true
                        },
                        "marketingOptInAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        },
                        "lastContactedAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "example": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11"
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "example": {
                    "success": true,
                    "data": {
                      "id": "6650a1b2c3d4e5f6a7b8c9d0",
                      "name": "Jane Doe",
                      "phone": "+14155552671",
                      "email": "jane@example.com",
                      "country": "US",
                      "tags": [
                        "vip",
                        "newsletter"
                      ],
                      "customFields": [
                        {
                          "fieldId": "664f...",
                          "fieldName": "Company",
                          "type": "text",
                          "value": "Acme Inc"
                        }
                      ],
                      "source": "api",
                      "status": "active",
                      "isFavorite": false,
                      "isBlocked": false,
                      "marketingOptIn": true,
                      "marketingOptInAt": "2026-07-12T09:30:00.000Z",
                      "lastContactedAt": null,
                      "createdAt": "2026-07-12T09:30:00.000Z",
                      "updatedAt": "2026-07-12T09:30:00.000Z"
                    },
                    "meta": {
                      "apiVersion": "v1"
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z"
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "6650a1b2c3d4e5f6a7b8c9d0",
                    "name": "Jane Doe",
                    "phone": "+14155552671",
                    "email": "jane@example.com",
                    "country": "US",
                    "tags": [
                      "vip",
                      "newsletter"
                    ],
                    "customFields": [
                      {
                        "fieldId": "664f...",
                        "fieldName": "Company",
                        "type": "text",
                        "value": "Acme Inc"
                      }
                    ],
                    "source": "api",
                    "status": "active",
                    "isFavorite": false,
                    "isBlocked": false,
                    "marketingOptIn": true,
                    "marketingOptInAt": "2026-07-12T09:30:00.000Z",
                    "lastContactedAt": null,
                    "createdAt": "2026-07-12T09:30:00.000Z",
                    "updatedAt": "2026-07-12T09:30:00.000Z"
                  },
                  "meta": {
                    "apiVersion": "v1"
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "ACCOUNT_CONFIGURATION_ERROR",
                      "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "ACCOUNT_CONFIGURATION_ERROR",
                    "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "API_KEY_INVALID",
                      "message": "Invalid API key.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "API_KEY_INVALID",
                    "message": "Invalid API key.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — developer platform disabled, key expired/disabled, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden — developer platform disabled, key expired/disabled, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DEVELOPER_PLATFORM_DISABLED",
                      "message": "Developer platform is disabled for this organization.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DEVELOPER_PLATFORM_DISABLED",
                    "message": "Developer platform is disabled for this organization.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "404": {
            "description": "Contact not found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Contact not found",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "CONTACT_NOT_FOUND",
                      "message": "Contact not found.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "CONTACT_NOT_FOUND",
                    "message": "Contact not found.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "409": {
            "description": "Duplicate contact (phone already exists)",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Duplicate contact (phone already exists)",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DUPLICATE_PHONE",
                      "message": "A contact with this phone number already exists.",
                      "details": {
                        "existingContactId": "6650a1b2c3d4e5f6a7b8c9d0"
                      }
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DUPLICATE_PHONE",
                    "message": "A contact with this phone number already exists.",
                    "details": {
                      "existingContactId": "6650a1b2c3d4e5f6a7b8c9d0"
                    }
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "VALIDATION_ERROR",
                      "message": "Validation failed",
                      "details": {
                        "issues": [
                          {
                            "path": [
                              "phone"
                            ],
                            "message": "Invalid phone number format"
                          }
                        ]
                      }
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "VALIDATION_ERROR",
                    "message": "Validation failed",
                    "details": {
                      "issues": [
                        {
                          "path": [
                            "phone"
                          ],
                          "message": "Invalid phone number format"
                        }
                      ]
                    }
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests — rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Too many requests. Please retry later.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RATE_LIMIT_EXCEEDED",
                    "message": "Too many requests. Please retry later.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "INTERNAL_SERVER_ERROR",
                      "message": "Internal server error",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "message": "Internal server error",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X PATCH \"https://api.inaiy.com/api/public/v1/contacts/6650a1b2c3d4e5f6a7b8c9d0\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"name\":\"Jane A. Doe\",\"tags\":[\"vip\",\"priority\"]}'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/contacts/6650a1b2c3d4e5f6a7b8c9d0\", {\n  method: \"PATCH\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n    \"Content-Type\": \"application/json\"\n  },\n  body: JSON.stringify({\n    \"name\": \"Jane A. Doe\",\n    \"tags\": [\n      \"vip\",\n      \"priority\"\n    ]\n  })\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/contacts/6650a1b2c3d4e5f6a7b8c9d0\", {\n    method: \"PATCH\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n      \"Content-Type\": \"application/json\"\n    },\n    body: JSON.stringify({\n      \"name\": \"Jane A. Doe\",\n      \"tags\": [\n        \"vip\",\n        \"priority\"\n      ]\n    })\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\npayload = {\n  \"name\": \"Jane A. Doe\",\n  \"tags\": [\n    \"vip\",\n    \"priority\"\n  ]\n}\nres = requests.patch(\"https://api.inaiy.com/api/public/v1/contacts/6650a1b2c3d4e5f6a7b8c9d0\", headers=headers, json=payload)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/contacts/6650a1b2c3d4e5f6a7b8c9d0\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .header(\"Content-Type\", \"application/json\")\n    .method(\"PATCH\", HttpRequest.BodyPublishers.ofString(\"{\\\"name\\\":\\\"Jane A. Doe\\\",\\\"tags\\\":[\\\"vip\\\",\\\"priority\\\"]}\"))\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/contacts/6650a1b2c3d4e5f6a7b8c9d0\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\",\n    \"Content-Type: application/json\"\n]);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, '{\"name\":\"Jane A. Doe\",\"tags\":[\"vip\",\"priority\"]}');\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"PATCH\"), \"https://api.inaiy.com/api/public/v1/contacts/6650a1b2c3d4e5f6a7b8c9d0\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nrequest.Content = new StringContent(\"{\\\"name\\\":\\\"Jane A. Doe\\\",\\\"tags\\\":[\\\"vip\\\",\\\"priority\\\"]}\", System.Text.Encoding.UTF8, \"application/json\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      },
      "delete": {
        "summary": "Delete a contact",
        "tags": [
          "Public API - Contacts"
        ],
        "description": "Soft-delete a contact. Returns 204 No Content on success.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "example": "6650a1b2c3d4e5f6a7b8c9d0"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "24-char contact ObjectId"
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "204": {
            "description": "Contact deleted"
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "ACCOUNT_CONFIGURATION_ERROR",
                      "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "ACCOUNT_CONFIGURATION_ERROR",
                    "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "API_KEY_INVALID",
                      "message": "Invalid API key.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "API_KEY_INVALID",
                    "message": "Invalid API key.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — developer platform disabled, key expired/disabled, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden — developer platform disabled, key expired/disabled, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DEVELOPER_PLATFORM_DISABLED",
                      "message": "Developer platform is disabled for this organization.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DEVELOPER_PLATFORM_DISABLED",
                    "message": "Developer platform is disabled for this organization.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "404": {
            "description": "Contact not found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Contact not found",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "CONTACT_NOT_FOUND",
                      "message": "Contact not found.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "CONTACT_NOT_FOUND",
                    "message": "Contact not found.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests — rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Too many requests. Please retry later.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RATE_LIMIT_EXCEEDED",
                    "message": "Too many requests. Please retry later.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "INTERNAL_SERVER_ERROR",
                      "message": "Internal server error",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "message": "Internal server error",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X DELETE \"https://api.inaiy.com/api/public/v1/contacts/6650a1b2c3d4e5f6a7b8c9d0\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/contacts/6650a1b2c3d4e5f6a7b8c9d0\", {\n  method: \"DELETE\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/contacts/6650a1b2c3d4e5f6a7b8c9d0\", {\n    method: \"DELETE\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.delete(\"https://api.inaiy.com/api/public/v1/contacts/6650a1b2c3d4e5f6a7b8c9d0\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/contacts/6650a1b2c3d4e5f6a7b8c9d0\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"DELETE\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/contacts/6650a1b2c3d4e5f6a7b8c9d0\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"DELETE\"), \"https://api.inaiy.com/api/public/v1/contacts/6650a1b2c3d4e5f6a7b8c9d0\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/contacts/upsert": {
      "post": {
        "summary": "Create or update a contact by phone",
        "tags": [
          "Public API - Contacts"
        ],
        "description": "Matches an existing contact by `phone` (with or without the leading +). If found, only the fields you send are updated (tags and customFields replace the stored lists) and the response is 200. If not found, the contact is created (name defaults to the phone, source to `api`) and the response is 201. `meta.created` tells you which happened. Returns 404 if primaryTeamId or assignedAgentId is not in this workspace.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "phone"
                ],
                "additionalProperties": true,
                "properties": {
                  "name": {
                    "type": "string",
                    "example": "Jane Doe"
                  },
                  "phone": {
                    "type": "string",
                    "description": "E.164 format",
                    "example": "+14155552671"
                  },
                  "email": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "email",
                    "example": "jane@example.com"
                  },
                  "country": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "example": "US"
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "example": [
                      "vip"
                    ]
                  },
                  "customFields": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "manual",
                      "import",
                      "api",
                      "whatsapp",
                      "web"
                    ],
                    "example": "api"
                  },
                  "marketingOptIn": {
                    "type": "boolean",
                    "example": true
                  },
                  "primaryTeamId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Owning team id (24-char ObjectId). Must be a team in this workspace; null clears it.",
                    "example": "6650a1b2c3d4e5f6a7b8c9d4"
                  },
                  "assignedAgentId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Owning agent (user) id. Must be a member of this workspace; null clears it.",
                    "example": "6650a1b2c3d4e5f6a7b8c9d5"
                  }
                },
                "example": {
                  "phone": "+14155552671",
                  "name": "Jane Doe",
                  "tags": [
                    "vip"
                  ]
                }
              },
              "example": {
                "phone": "+14155552671",
                "name": "Jane Doe",
                "tags": [
                  "vip"
                ]
              }
            }
          },
          "required": true
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "Existing contact updated (meta.created = false)",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Existing contact updated (meta.created = false)",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "id": {
                          "type": "string",
                          "example": "6650a1b2c3d4e5f6a7b8c9d0"
                        },
                        "name": {
                          "type": "string",
                          "example": "Jane Doe"
                        },
                        "phone": {
                          "type": "string",
                          "example": "+14155552671"
                        },
                        "email": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "jane@example.com"
                        },
                        "country": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "US"
                        },
                        "tags": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "example": [
                            "vip",
                            "newsletter"
                          ]
                        },
                        "customFields": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": true,
                            "properties": {
                              "fieldId": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "fieldName": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "type": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "value": {}
                            }
                          }
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "manual",
                            "import",
                            "api",
                            "whatsapp",
                            "web"
                          ],
                          "example": "api"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "active",
                            "deleted",
                            "blocked",
                            "merged"
                          ],
                          "example": "active"
                        },
                        "isFavorite": {
                          "type": "boolean",
                          "example": false
                        },
                        "isBlocked": {
                          "type": "boolean",
                          "example": false
                        },
                        "marketingOptIn": {
                          "type": "boolean",
                          "example": true
                        },
                        "marketingOptInAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        },
                        "lastContactedAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "example": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11"
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "example": {
                    "success": true,
                    "data": {
                      "id": "6650a1b2c3d4e5f6a7b8c9d0",
                      "name": "Jane Doe",
                      "phone": "+14155552671",
                      "email": "jane@example.com",
                      "country": "US",
                      "tags": [
                        "vip",
                        "newsletter"
                      ],
                      "customFields": [
                        {
                          "fieldId": "664f...",
                          "fieldName": "Company",
                          "type": "text",
                          "value": "Acme Inc"
                        }
                      ],
                      "source": "api",
                      "status": "active",
                      "isFavorite": false,
                      "isBlocked": false,
                      "marketingOptIn": true,
                      "marketingOptInAt": "2026-07-12T09:30:00.000Z",
                      "lastContactedAt": null,
                      "createdAt": "2026-07-12T09:30:00.000Z",
                      "updatedAt": "2026-07-12T09:30:00.000Z"
                    },
                    "meta": {
                      "apiVersion": "v1"
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z"
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "6650a1b2c3d4e5f6a7b8c9d0",
                    "name": "Jane Doe",
                    "phone": "+14155552671",
                    "email": "jane@example.com",
                    "country": "US",
                    "tags": [
                      "vip",
                      "newsletter"
                    ],
                    "customFields": [
                      {
                        "fieldId": "664f...",
                        "fieldName": "Company",
                        "type": "text",
                        "value": "Acme Inc"
                      }
                    ],
                    "source": "api",
                    "status": "active",
                    "isFavorite": false,
                    "isBlocked": false,
                    "marketingOptIn": true,
                    "marketingOptInAt": "2026-07-12T09:30:00.000Z",
                    "lastContactedAt": null,
                    "createdAt": "2026-07-12T09:30:00.000Z",
                    "updatedAt": "2026-07-12T09:30:00.000Z"
                  },
                  "meta": {
                    "apiVersion": "v1"
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z"
                }
              }
            }
          },
          "201": {
            "description": "Contact created (meta.created = true)",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Contact created (meta.created = true)",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "id": {
                          "type": "string",
                          "example": "6650a1b2c3d4e5f6a7b8c9d0"
                        },
                        "name": {
                          "type": "string",
                          "example": "Jane Doe"
                        },
                        "phone": {
                          "type": "string",
                          "example": "+14155552671"
                        },
                        "email": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "jane@example.com"
                        },
                        "country": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "US"
                        },
                        "tags": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "example": [
                            "vip",
                            "newsletter"
                          ]
                        },
                        "customFields": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": true,
                            "properties": {
                              "fieldId": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "fieldName": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "type": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "value": {}
                            }
                          }
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "manual",
                            "import",
                            "api",
                            "whatsapp",
                            "web"
                          ],
                          "example": "api"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "active",
                            "deleted",
                            "blocked",
                            "merged"
                          ],
                          "example": "active"
                        },
                        "isFavorite": {
                          "type": "boolean",
                          "example": false
                        },
                        "isBlocked": {
                          "type": "boolean",
                          "example": false
                        },
                        "marketingOptIn": {
                          "type": "boolean",
                          "example": true
                        },
                        "marketingOptInAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        },
                        "lastContactedAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "example": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11"
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "example": {
                    "success": true,
                    "data": {
                      "id": "6650a1b2c3d4e5f6a7b8c9d0",
                      "name": "Jane Doe",
                      "phone": "+14155552671",
                      "email": "jane@example.com",
                      "country": "US",
                      "tags": [
                        "vip",
                        "newsletter"
                      ],
                      "customFields": [
                        {
                          "fieldId": "664f...",
                          "fieldName": "Company",
                          "type": "text",
                          "value": "Acme Inc"
                        }
                      ],
                      "source": "api",
                      "status": "active",
                      "isFavorite": false,
                      "isBlocked": false,
                      "marketingOptIn": true,
                      "marketingOptInAt": "2026-07-12T09:30:00.000Z",
                      "lastContactedAt": null,
                      "createdAt": "2026-07-12T09:30:00.000Z",
                      "updatedAt": "2026-07-12T09:30:00.000Z"
                    },
                    "meta": {
                      "apiVersion": "v1"
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z"
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "6650a1b2c3d4e5f6a7b8c9d0",
                    "name": "Jane Doe",
                    "phone": "+14155552671",
                    "email": "jane@example.com",
                    "country": "US",
                    "tags": [
                      "vip",
                      "newsletter"
                    ],
                    "customFields": [
                      {
                        "fieldId": "664f...",
                        "fieldName": "Company",
                        "type": "text",
                        "value": "Acme Inc"
                      }
                    ],
                    "source": "api",
                    "status": "active",
                    "isFavorite": false,
                    "isBlocked": false,
                    "marketingOptIn": true,
                    "marketingOptInAt": "2026-07-12T09:30:00.000Z",
                    "lastContactedAt": null,
                    "createdAt": "2026-07-12T09:30:00.000Z",
                    "updatedAt": "2026-07-12T09:30:00.000Z"
                  },
                  "meta": {
                    "apiVersion": "v1"
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "ACCOUNT_CONFIGURATION_ERROR",
                      "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "ACCOUNT_CONFIGURATION_ERROR",
                    "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "API_KEY_INVALID",
                      "message": "Invalid API key.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "API_KEY_INVALID",
                    "message": "Invalid API key.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — developer platform disabled, key expired/disabled, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden — developer platform disabled, key expired/disabled, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DEVELOPER_PLATFORM_DISABLED",
                      "message": "Developer platform is disabled for this organization.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DEVELOPER_PLATFORM_DISABLED",
                    "message": "Developer platform is disabled for this organization.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "404": {
            "description": "Contact not found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Contact not found",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "CONTACT_NOT_FOUND",
                      "message": "Contact not found.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "CONTACT_NOT_FOUND",
                    "message": "Contact not found.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "VALIDATION_ERROR",
                      "message": "Validation failed",
                      "details": {
                        "issues": [
                          {
                            "path": [
                              "phone"
                            ],
                            "message": "Invalid phone number format"
                          }
                        ]
                      }
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "VALIDATION_ERROR",
                    "message": "Validation failed",
                    "details": {
                      "issues": [
                        {
                          "path": [
                            "phone"
                          ],
                          "message": "Invalid phone number format"
                        }
                      ]
                    }
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests — rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Too many requests. Please retry later.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RATE_LIMIT_EXCEEDED",
                    "message": "Too many requests. Please retry later.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "INTERNAL_SERVER_ERROR",
                      "message": "Internal server error",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/contacts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "message": "Internal server error",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/contacts",
                  "method": "POST"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X POST \"https://api.inaiy.com/api/public/v1/contacts/upsert\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"phone\":\"+14155552671\",\"name\":\"Jane Doe\",\"tags\":[\"vip\"]}'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/contacts/upsert\", {\n  method: \"POST\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n    \"Content-Type\": \"application/json\"\n  },\n  body: JSON.stringify({\n    \"phone\": \"+14155552671\",\n    \"name\": \"Jane Doe\",\n    \"tags\": [\n      \"vip\"\n    ]\n  })\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/contacts/upsert\", {\n    method: \"POST\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n      \"Content-Type\": \"application/json\"\n    },\n    body: JSON.stringify({\n      \"phone\": \"+14155552671\",\n      \"name\": \"Jane Doe\",\n      \"tags\": [\n        \"vip\"\n      ]\n    })\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\npayload = {\n  \"phone\": \"+14155552671\",\n  \"name\": \"Jane Doe\",\n  \"tags\": [\n    \"vip\"\n  ]\n}\nres = requests.post(\"https://api.inaiy.com/api/public/v1/contacts/upsert\", headers=headers, json=payload)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/contacts/upsert\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .header(\"Content-Type\", \"application/json\")\n    .method(\"POST\", HttpRequest.BodyPublishers.ofString(\"{\\\"phone\\\":\\\"+14155552671\\\",\\\"name\\\":\\\"Jane Doe\\\",\\\"tags\\\":[\\\"vip\\\"]}\"))\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/contacts/upsert\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\",\n    \"Content-Type: application/json\"\n]);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, '{\"phone\":\"+14155552671\",\"name\":\"Jane Doe\",\"tags\":[\"vip\"]}');\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"POST\"), \"https://api.inaiy.com/api/public/v1/contacts/upsert\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nrequest.Content = new StringContent(\"{\\\"phone\\\":\\\"+14155552671\\\",\\\"name\\\":\\\"Jane Doe\\\",\\\"tags\\\":[\\\"vip\\\"]}\", System.Text.Encoding.UTF8, \"application/json\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/conversations": {
      "get": {
        "summary": "List conversations",
        "tags": [
          "Public API - Conversations"
        ],
        "description": "Returns a paginated, filterable, sortable list of conversations for the authenticated tenant.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1,
              "example": 1
            },
            "in": "query",
            "name": "page",
            "required": false
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "example": 25
            },
            "in": "query",
            "name": "limit",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "lastMessageAt",
                "createdAt",
                "updatedAt",
                "unreadCount",
                "priority",
                "status",
                "resolutionDueAt"
              ],
              "default": "lastMessageAt"
            },
            "in": "query",
            "name": "sort",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "desc"
            },
            "in": "query",
            "name": "order",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "pending",
                "resolved",
                "closed",
                "archived"
              ]
            },
            "in": "query",
            "name": "status",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "unassigned"
            },
            "in": "query",
            "name": "assignedTo",
            "required": false,
            "description": "Agent id, or 'unassigned'."
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "low",
                "medium",
                "high",
                "urgent"
              ]
            },
            "in": "query",
            "name": "priority",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "661fa1b2c3d4e5f6a7b8c9d0"
            },
            "in": "query",
            "name": "label",
            "required": false,
            "description": "Comma-separated label id filter."
          },
          {
            "schema": {
              "type": "string",
              "example": "663fa1b2c3d4e5f6a7b8c9d0"
            },
            "in": "query",
            "name": "channel",
            "required": false,
            "description": "Channel id filter."
          },
          {
            "schema": {
              "type": "string",
              "example": "jane"
            },
            "in": "query",
            "name": "search",
            "required": false,
            "description": "Matches contact name/phone, agent name, or label name."
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "in": "query",
            "name": "createdAfter",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "in": "query",
            "name": "createdBefore",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "in": "query",
            "name": "updatedAfter",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "in": "query",
            "name": "updatedBefore",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "id,status,priority"
            },
            "in": "query",
            "name": "fields",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of conversations",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Paginated list of conversations",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true,
                        "properties": {
                          "id": {
                            "type": "string",
                            "example": "6650a1b2c3d4e5f6a7b8c9d0"
                          },
                          "contactId": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "664fa1b2c3d4e5f6a7b8c9d0"
                          },
                          "channelId": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "663fa1b2c3d4e5f6a7b8c9d0"
                          },
                          "assignedAgentId": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "662fa1b2c3d4e5f6a7b8c9d0"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "open",
                              "pending",
                              "resolved",
                              "closed",
                              "archived"
                            ],
                            "example": "open"
                          },
                          "priority": {
                            "type": "string",
                            "enum": [
                              "low",
                              "medium",
                              "high",
                              "urgent"
                            ],
                            "example": "medium"
                          },
                          "isArchived": {
                            "type": "boolean",
                            "example": false
                          },
                          "labelIds": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            },
                            "example": [
                              "661fa1b2c3d4e5f6a7b8c9d0"
                            ]
                          },
                          "labels": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "additionalProperties": true,
                              "properties": {
                                "id": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "name": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                },
                                "color": {
                                  "type": [
                                    "null",
                                    "string"
                                  ]
                                }
                              }
                            }
                          },
                          "unreadCount": {
                            "type": "integer",
                            "example": 2
                          },
                          "lastMessagePreview": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "See you tomorrow!"
                          },
                          "lastMessageAt": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "format": "date-time"
                          },
                          "lastMessageDirection": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "inbound"
                          },
                          "isPinned": {
                            "type": "boolean",
                            "example": false
                          },
                          "isMuted": {
                            "type": "boolean",
                            "example": false
                          },
                          "isResolved": {
                            "type": "boolean",
                            "example": false
                          },
                          "startedAt": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "format": "date-time"
                          },
                          "resolvedAt": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "format": "date-time"
                          },
                          "closedAt": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "format": "date-time"
                          },
                          "source": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "whatsapp"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "updatedAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "contact": {
                            "type": "object",
                            "additionalProperties": true,
                            "properties": {
                              "id": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "name": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "phone": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "email": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              }
                            }
                          },
                          "channel": {
                            "type": "object",
                            "additionalProperties": true,
                            "properties": {
                              "id": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "name": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "type": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              }
                            }
                          },
                          "assignedAgent": {
                            "type": "object",
                            "additionalProperties": true,
                            "properties": {
                              "id": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "fullName": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "email": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              }
                            }
                          }
                        }
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "page": {
                          "type": "integer",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "example": 137
                        },
                        "totalPages": {
                          "type": "integer",
                          "example": 6
                        },
                        "hasNextPage": {
                          "type": "boolean",
                          "example": true
                        },
                        "hasPrevPage": {
                          "type": "boolean",
                          "example": false
                        },
                        "nextCursor": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": null
                        },
                        "prevCursor": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": null
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "example": {
                    "success": true,
                    "data": [
                      {
                        "id": "6650a1b2c3d4e5f6a7b8c9d0",
                        "contactId": "664fa1b2c3d4e5f6a7b8c9d0",
                        "channelId": "663fa1b2c3d4e5f6a7b8c9d0",
                        "assignedAgentId": "662fa1b2c3d4e5f6a7b8c9d0",
                        "status": "open",
                        "priority": "medium",
                        "isArchived": false,
                        "labelIds": [
                          "661fa1b2c3d4e5f6a7b8c9d0"
                        ],
                        "labels": [
                          {
                            "id": "661fa1b2c3d4e5f6a7b8c9d0",
                            "name": "VIP",
                            "color": "#6366f1"
                          }
                        ],
                        "unreadCount": 2,
                        "lastMessagePreview": "See you tomorrow!",
                        "lastMessageAt": "2026-07-12T09:30:00.000Z",
                        "lastMessageDirection": "inbound",
                        "isPinned": false,
                        "isMuted": false,
                        "isResolved": false,
                        "startedAt": "2026-07-10T08:00:00.000Z",
                        "resolvedAt": null,
                        "closedAt": null,
                        "source": "whatsapp",
                        "createdAt": "2026-07-10T08:00:00.000Z",
                        "updatedAt": "2026-07-12T09:30:00.000Z",
                        "contact": {
                          "id": "664fa1b2c3d4e5f6a7b8c9d0",
                          "name": "Jane Doe",
                          "phone": "+14155552671",
                          "email": "jane@example.com"
                        },
                        "channel": {
                          "id": "663fa1b2c3d4e5f6a7b8c9d0",
                          "name": "Main WhatsApp",
                          "type": "whatsapp"
                        },
                        "assignedAgent": {
                          "id": "662fa1b2c3d4e5f6a7b8c9d0",
                          "fullName": "Alex Agent",
                          "email": "alex@company.com"
                        }
                      }
                    ],
                    "pagination": {
                      "page": 1,
                      "limit": 25,
                      "total": 137,
                      "totalPages": 6,
                      "hasNextPage": true,
                      "hasPrevPage": false,
                      "nextCursor": null,
                      "prevCursor": null
                    },
                    "meta": {
                      "apiVersion": "v1",
                      "sort": {
                        "field": "lastMessageAt",
                        "order": "desc"
                      }
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z"
                  }
                },
                "example": {
                  "success": true,
                  "data": [
                    {
                      "id": "6650a1b2c3d4e5f6a7b8c9d0",
                      "contactId": "664fa1b2c3d4e5f6a7b8c9d0",
                      "channelId": "663fa1b2c3d4e5f6a7b8c9d0",
                      "assignedAgentId": "662fa1b2c3d4e5f6a7b8c9d0",
                      "status": "open",
                      "priority": "medium",
                      "isArchived": false,
                      "labelIds": [
                        "661fa1b2c3d4e5f6a7b8c9d0"
                      ],
                      "labels": [
                        {
                          "id": "661fa1b2c3d4e5f6a7b8c9d0",
                          "name": "VIP",
                          "color": "#6366f1"
                        }
                      ],
                      "unreadCount": 2,
                      "lastMessagePreview": "See you tomorrow!",
                      "lastMessageAt": "2026-07-12T09:30:00.000Z",
                      "lastMessageDirection": "inbound",
                      "isPinned": false,
                      "isMuted": false,
                      "isResolved": false,
                      "startedAt": "2026-07-10T08:00:00.000Z",
                      "resolvedAt": null,
                      "closedAt": null,
                      "source": "whatsapp",
                      "createdAt": "2026-07-10T08:00:00.000Z",
                      "updatedAt": "2026-07-12T09:30:00.000Z",
                      "contact": {
                        "id": "664fa1b2c3d4e5f6a7b8c9d0",
                        "name": "Jane Doe",
                        "phone": "+14155552671",
                        "email": "jane@example.com"
                      },
                      "channel": {
                        "id": "663fa1b2c3d4e5f6a7b8c9d0",
                        "name": "Main WhatsApp",
                        "type": "whatsapp"
                      },
                      "assignedAgent": {
                        "id": "662fa1b2c3d4e5f6a7b8c9d0",
                        "fullName": "Alex Agent",
                        "email": "alex@company.com"
                      }
                    }
                  ],
                  "pagination": {
                    "page": 1,
                    "limit": 25,
                    "total": 137,
                    "totalPages": 6,
                    "hasNextPage": true,
                    "hasPrevPage": false,
                    "nextCursor": null,
                    "prevCursor": null
                  },
                  "meta": {
                    "apiVersion": "v1",
                    "sort": {
                      "field": "lastMessageAt",
                      "order": "desc"
                    }
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "ACCOUNT_CONFIGURATION_ERROR",
                      "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                    "method": "PATCH"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "ACCOUNT_CONFIGURATION_ERROR",
                    "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                  "method": "PATCH"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "API_KEY_INVALID",
                      "message": "Invalid API key.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                    "method": "PATCH"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "API_KEY_INVALID",
                    "message": "Invalid API key.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                  "method": "PATCH"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — developer platform disabled, key expired/disabled, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden — developer platform disabled, key expired/disabled, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DEVELOPER_PLATFORM_DISABLED",
                      "message": "Developer platform is disabled for this organization.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                    "method": "PATCH"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DEVELOPER_PLATFORM_DISABLED",
                    "message": "Developer platform is disabled for this organization.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                  "method": "PATCH"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "VALIDATION_ERROR",
                      "message": "Validation failed",
                      "details": {
                        "issues": [
                          {
                            "path": [
                              "status"
                            ],
                            "message": "Invalid enum value."
                          }
                        ]
                      }
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                    "method": "PATCH"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "VALIDATION_ERROR",
                    "message": "Validation failed",
                    "details": {
                      "issues": [
                        {
                          "path": [
                            "status"
                          ],
                          "message": "Invalid enum value."
                        }
                      ]
                    }
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                  "method": "PATCH"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests — rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Too many requests. Please retry later.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                    "method": "PATCH"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RATE_LIMIT_EXCEEDED",
                    "message": "Too many requests. Please retry later.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                  "method": "PATCH"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "INTERNAL_SERVER_ERROR",
                      "message": "Internal server error",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                    "method": "PATCH"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "message": "Internal server error",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                  "method": "PATCH"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/conversations\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/conversations\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/conversations\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/conversations\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/conversations\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/conversations\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/conversations\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/conversations/{id}": {
      "get": {
        "summary": "Get a conversation by id",
        "tags": [
          "Public API - Conversations"
        ],
        "description": "Fetch a single conversation by its public id.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "example": "id,status,priority,assignedAgentId"
            },
            "in": "query",
            "name": "fields",
            "required": false,
            "description": "Comma-separated list of fields to return (sparse fieldset)."
          },
          {
            "schema": {
              "type": "string",
              "example": "6650a1b2c3d4e5f6a7b8c9d0"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "24-char conversation ObjectId"
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "The conversation",
            "content": {
              "application/json": {
                "schema": {
                  "description": "The conversation",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "id": {
                          "type": "string",
                          "example": "6650a1b2c3d4e5f6a7b8c9d0"
                        },
                        "contactId": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "664fa1b2c3d4e5f6a7b8c9d0"
                        },
                        "channelId": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "663fa1b2c3d4e5f6a7b8c9d0"
                        },
                        "assignedAgentId": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "662fa1b2c3d4e5f6a7b8c9d0"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "open",
                            "pending",
                            "resolved",
                            "closed",
                            "archived"
                          ],
                          "example": "open"
                        },
                        "priority": {
                          "type": "string",
                          "enum": [
                            "low",
                            "medium",
                            "high",
                            "urgent"
                          ],
                          "example": "medium"
                        },
                        "isArchived": {
                          "type": "boolean",
                          "example": false
                        },
                        "labelIds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "example": [
                            "661fa1b2c3d4e5f6a7b8c9d0"
                          ]
                        },
                        "labels": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": true,
                            "properties": {
                              "id": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "name": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "color": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              }
                            }
                          }
                        },
                        "unreadCount": {
                          "type": "integer",
                          "example": 2
                        },
                        "lastMessagePreview": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "See you tomorrow!"
                        },
                        "lastMessageAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        },
                        "lastMessageDirection": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "inbound"
                        },
                        "isPinned": {
                          "type": "boolean",
                          "example": false
                        },
                        "isMuted": {
                          "type": "boolean",
                          "example": false
                        },
                        "isResolved": {
                          "type": "boolean",
                          "example": false
                        },
                        "startedAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        },
                        "resolvedAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        },
                        "closedAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        },
                        "source": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "whatsapp"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "contact": {
                          "type": "object",
                          "additionalProperties": true,
                          "properties": {
                            "id": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "name": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "phone": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "email": {
                              "type": [
                                "null",
                                "string"
                              ]
                            }
                          }
                        },
                        "channel": {
                          "type": "object",
                          "additionalProperties": true,
                          "properties": {
                            "id": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "name": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "type": {
                              "type": [
                                "null",
                                "string"
                              ]
                            }
                          }
                        },
                        "assignedAgent": {
                          "type": "object",
                          "additionalProperties": true,
                          "properties": {
                            "id": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "fullName": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "email": {
                              "type": [
                                "null",
                                "string"
                              ]
                            }
                          }
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "example": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11"
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "example": {
                    "success": true,
                    "data": {
                      "id": "6650a1b2c3d4e5f6a7b8c9d0",
                      "contactId": "664fa1b2c3d4e5f6a7b8c9d0",
                      "channelId": "663fa1b2c3d4e5f6a7b8c9d0",
                      "assignedAgentId": "662fa1b2c3d4e5f6a7b8c9d0",
                      "status": "open",
                      "priority": "medium",
                      "isArchived": false,
                      "labelIds": [
                        "661fa1b2c3d4e5f6a7b8c9d0"
                      ],
                      "labels": [
                        {
                          "id": "661fa1b2c3d4e5f6a7b8c9d0",
                          "name": "VIP",
                          "color": "#6366f1"
                        }
                      ],
                      "unreadCount": 2,
                      "lastMessagePreview": "See you tomorrow!",
                      "lastMessageAt": "2026-07-12T09:30:00.000Z",
                      "lastMessageDirection": "inbound",
                      "isPinned": false,
                      "isMuted": false,
                      "isResolved": false,
                      "startedAt": "2026-07-10T08:00:00.000Z",
                      "resolvedAt": null,
                      "closedAt": null,
                      "source": "whatsapp",
                      "createdAt": "2026-07-10T08:00:00.000Z",
                      "updatedAt": "2026-07-12T09:30:00.000Z",
                      "contact": {
                        "id": "664fa1b2c3d4e5f6a7b8c9d0",
                        "name": "Jane Doe",
                        "phone": "+14155552671",
                        "email": "jane@example.com"
                      },
                      "channel": {
                        "id": "663fa1b2c3d4e5f6a7b8c9d0",
                        "name": "Main WhatsApp",
                        "type": "whatsapp"
                      },
                      "assignedAgent": {
                        "id": "662fa1b2c3d4e5f6a7b8c9d0",
                        "fullName": "Alex Agent",
                        "email": "alex@company.com"
                      }
                    },
                    "meta": {
                      "apiVersion": "v1"
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z"
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "6650a1b2c3d4e5f6a7b8c9d0",
                    "contactId": "664fa1b2c3d4e5f6a7b8c9d0",
                    "channelId": "663fa1b2c3d4e5f6a7b8c9d0",
                    "assignedAgentId": "662fa1b2c3d4e5f6a7b8c9d0",
                    "status": "open",
                    "priority": "medium",
                    "isArchived": false,
                    "labelIds": [
                      "661fa1b2c3d4e5f6a7b8c9d0"
                    ],
                    "labels": [
                      {
                        "id": "661fa1b2c3d4e5f6a7b8c9d0",
                        "name": "VIP",
                        "color": "#6366f1"
                      }
                    ],
                    "unreadCount": 2,
                    "lastMessagePreview": "See you tomorrow!",
                    "lastMessageAt": "2026-07-12T09:30:00.000Z",
                    "lastMessageDirection": "inbound",
                    "isPinned": false,
                    "isMuted": false,
                    "isResolved": false,
                    "startedAt": "2026-07-10T08:00:00.000Z",
                    "resolvedAt": null,
                    "closedAt": null,
                    "source": "whatsapp",
                    "createdAt": "2026-07-10T08:00:00.000Z",
                    "updatedAt": "2026-07-12T09:30:00.000Z",
                    "contact": {
                      "id": "664fa1b2c3d4e5f6a7b8c9d0",
                      "name": "Jane Doe",
                      "phone": "+14155552671",
                      "email": "jane@example.com"
                    },
                    "channel": {
                      "id": "663fa1b2c3d4e5f6a7b8c9d0",
                      "name": "Main WhatsApp",
                      "type": "whatsapp"
                    },
                    "assignedAgent": {
                      "id": "662fa1b2c3d4e5f6a7b8c9d0",
                      "fullName": "Alex Agent",
                      "email": "alex@company.com"
                    }
                  },
                  "meta": {
                    "apiVersion": "v1"
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "ACCOUNT_CONFIGURATION_ERROR",
                      "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                    "method": "PATCH"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "ACCOUNT_CONFIGURATION_ERROR",
                    "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                  "method": "PATCH"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "API_KEY_INVALID",
                      "message": "Invalid API key.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                    "method": "PATCH"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "API_KEY_INVALID",
                    "message": "Invalid API key.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                  "method": "PATCH"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — developer platform disabled, key expired/disabled, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden — developer platform disabled, key expired/disabled, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DEVELOPER_PLATFORM_DISABLED",
                      "message": "Developer platform is disabled for this organization.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                    "method": "PATCH"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DEVELOPER_PLATFORM_DISABLED",
                    "message": "Developer platform is disabled for this organization.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                  "method": "PATCH"
                }
              }
            }
          },
          "404": {
            "description": "Conversation not found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Conversation not found",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "CONVERSATION_NOT_FOUND",
                      "message": "Conversation not found.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                    "method": "PATCH"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "CONVERSATION_NOT_FOUND",
                    "message": "Conversation not found.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                  "method": "PATCH"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests — rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Too many requests. Please retry later.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                    "method": "PATCH"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RATE_LIMIT_EXCEEDED",
                    "message": "Too many requests. Please retry later.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                  "method": "PATCH"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "INTERNAL_SERVER_ERROR",
                      "message": "Internal server error",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                    "method": "PATCH"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "message": "Internal server error",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                  "method": "PATCH"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      },
      "patch": {
        "summary": "Update a conversation",
        "tags": [
          "Public API - Conversations"
        ],
        "description": "Consolidated update supporting assign/unassign agent, status change, archive, priority, and add/remove labels. Provide at least one field. Message sending is not supported.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "minProperties": 1,
                "additionalProperties": false,
                "description": "Consolidated update. Provide any combination of fields. `assignedAgentId: null` unassigns. Operations are applied sequentially and are NOT atomic — a later failure leaves earlier changes applied. Message sending is not supported.",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "open",
                      "pending",
                      "resolved",
                      "closed",
                      "archived"
                    ],
                    "example": "resolved"
                  },
                  "priority": {
                    "type": "string",
                    "enum": [
                      "low",
                      "medium",
                      "high",
                      "urgent"
                    ],
                    "example": "high"
                  },
                  "assignedAgentId": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "24-char agent ObjectId to assign, or null to unassign.",
                    "example": "662fa1b2c3d4e5f6a7b8c9d0"
                  },
                  "archived": {
                    "type": "boolean",
                    "example": false
                  },
                  "addLabels": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "example": [
                      "661fa1b2c3d4e5f6a7b8c9d0"
                    ]
                  },
                  "removeLabels": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "example": []
                  }
                },
                "example": {
                  "status": "resolved",
                  "priority": "high",
                  "assignedAgentId": "662fa1b2c3d4e5f6a7b8c9d0"
                }
              },
              "example": {
                "status": "resolved",
                "priority": "high",
                "assignedAgentId": "662fa1b2c3d4e5f6a7b8c9d0"
              }
            }
          },
          "description": "Consolidated update. Provide any combination of fields. `assignedAgentId: null` unassigns. Operations are applied sequentially and are NOT atomic — a later failure leaves earlier changes applied. Message sending is not supported."
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "example": "6650a1b2c3d4e5f6a7b8c9d0"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "24-char conversation ObjectId"
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "Conversation updated",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Conversation updated",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "id": {
                          "type": "string",
                          "example": "6650a1b2c3d4e5f6a7b8c9d0"
                        },
                        "contactId": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "664fa1b2c3d4e5f6a7b8c9d0"
                        },
                        "channelId": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "663fa1b2c3d4e5f6a7b8c9d0"
                        },
                        "assignedAgentId": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "662fa1b2c3d4e5f6a7b8c9d0"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "open",
                            "pending",
                            "resolved",
                            "closed",
                            "archived"
                          ],
                          "example": "open"
                        },
                        "priority": {
                          "type": "string",
                          "enum": [
                            "low",
                            "medium",
                            "high",
                            "urgent"
                          ],
                          "example": "medium"
                        },
                        "isArchived": {
                          "type": "boolean",
                          "example": false
                        },
                        "labelIds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "example": [
                            "661fa1b2c3d4e5f6a7b8c9d0"
                          ]
                        },
                        "labels": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": true,
                            "properties": {
                              "id": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "name": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "color": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              }
                            }
                          }
                        },
                        "unreadCount": {
                          "type": "integer",
                          "example": 2
                        },
                        "lastMessagePreview": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "See you tomorrow!"
                        },
                        "lastMessageAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        },
                        "lastMessageDirection": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "inbound"
                        },
                        "isPinned": {
                          "type": "boolean",
                          "example": false
                        },
                        "isMuted": {
                          "type": "boolean",
                          "example": false
                        },
                        "isResolved": {
                          "type": "boolean",
                          "example": false
                        },
                        "startedAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        },
                        "resolvedAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        },
                        "closedAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        },
                        "source": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "whatsapp"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "contact": {
                          "type": "object",
                          "additionalProperties": true,
                          "properties": {
                            "id": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "name": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "phone": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "email": {
                              "type": [
                                "null",
                                "string"
                              ]
                            }
                          }
                        },
                        "channel": {
                          "type": "object",
                          "additionalProperties": true,
                          "properties": {
                            "id": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "name": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "type": {
                              "type": [
                                "null",
                                "string"
                              ]
                            }
                          }
                        },
                        "assignedAgent": {
                          "type": "object",
                          "additionalProperties": true,
                          "properties": {
                            "id": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "fullName": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "email": {
                              "type": [
                                "null",
                                "string"
                              ]
                            }
                          }
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "example": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11"
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "example": {
                    "success": true,
                    "data": {
                      "id": "6650a1b2c3d4e5f6a7b8c9d0",
                      "contactId": "664fa1b2c3d4e5f6a7b8c9d0",
                      "channelId": "663fa1b2c3d4e5f6a7b8c9d0",
                      "assignedAgentId": "662fa1b2c3d4e5f6a7b8c9d0",
                      "status": "open",
                      "priority": "medium",
                      "isArchived": false,
                      "labelIds": [
                        "661fa1b2c3d4e5f6a7b8c9d0"
                      ],
                      "labels": [
                        {
                          "id": "661fa1b2c3d4e5f6a7b8c9d0",
                          "name": "VIP",
                          "color": "#6366f1"
                        }
                      ],
                      "unreadCount": 2,
                      "lastMessagePreview": "See you tomorrow!",
                      "lastMessageAt": "2026-07-12T09:30:00.000Z",
                      "lastMessageDirection": "inbound",
                      "isPinned": false,
                      "isMuted": false,
                      "isResolved": false,
                      "startedAt": "2026-07-10T08:00:00.000Z",
                      "resolvedAt": null,
                      "closedAt": null,
                      "source": "whatsapp",
                      "createdAt": "2026-07-10T08:00:00.000Z",
                      "updatedAt": "2026-07-12T09:30:00.000Z",
                      "contact": {
                        "id": "664fa1b2c3d4e5f6a7b8c9d0",
                        "name": "Jane Doe",
                        "phone": "+14155552671",
                        "email": "jane@example.com"
                      },
                      "channel": {
                        "id": "663fa1b2c3d4e5f6a7b8c9d0",
                        "name": "Main WhatsApp",
                        "type": "whatsapp"
                      },
                      "assignedAgent": {
                        "id": "662fa1b2c3d4e5f6a7b8c9d0",
                        "fullName": "Alex Agent",
                        "email": "alex@company.com"
                      }
                    },
                    "meta": {
                      "apiVersion": "v1"
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z"
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "6650a1b2c3d4e5f6a7b8c9d0",
                    "contactId": "664fa1b2c3d4e5f6a7b8c9d0",
                    "channelId": "663fa1b2c3d4e5f6a7b8c9d0",
                    "assignedAgentId": "662fa1b2c3d4e5f6a7b8c9d0",
                    "status": "open",
                    "priority": "medium",
                    "isArchived": false,
                    "labelIds": [
                      "661fa1b2c3d4e5f6a7b8c9d0"
                    ],
                    "labels": [
                      {
                        "id": "661fa1b2c3d4e5f6a7b8c9d0",
                        "name": "VIP",
                        "color": "#6366f1"
                      }
                    ],
                    "unreadCount": 2,
                    "lastMessagePreview": "See you tomorrow!",
                    "lastMessageAt": "2026-07-12T09:30:00.000Z",
                    "lastMessageDirection": "inbound",
                    "isPinned": false,
                    "isMuted": false,
                    "isResolved": false,
                    "startedAt": "2026-07-10T08:00:00.000Z",
                    "resolvedAt": null,
                    "closedAt": null,
                    "source": "whatsapp",
                    "createdAt": "2026-07-10T08:00:00.000Z",
                    "updatedAt": "2026-07-12T09:30:00.000Z",
                    "contact": {
                      "id": "664fa1b2c3d4e5f6a7b8c9d0",
                      "name": "Jane Doe",
                      "phone": "+14155552671",
                      "email": "jane@example.com"
                    },
                    "channel": {
                      "id": "663fa1b2c3d4e5f6a7b8c9d0",
                      "name": "Main WhatsApp",
                      "type": "whatsapp"
                    },
                    "assignedAgent": {
                      "id": "662fa1b2c3d4e5f6a7b8c9d0",
                      "fullName": "Alex Agent",
                      "email": "alex@company.com"
                    }
                  },
                  "meta": {
                    "apiVersion": "v1"
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "ACCOUNT_CONFIGURATION_ERROR",
                      "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                    "method": "PATCH"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "ACCOUNT_CONFIGURATION_ERROR",
                    "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                  "method": "PATCH"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "API_KEY_INVALID",
                      "message": "Invalid API key.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                    "method": "PATCH"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "API_KEY_INVALID",
                    "message": "Invalid API key.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                  "method": "PATCH"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — developer platform disabled, key expired/disabled, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden — developer platform disabled, key expired/disabled, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DEVELOPER_PLATFORM_DISABLED",
                      "message": "Developer platform is disabled for this organization.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                    "method": "PATCH"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DEVELOPER_PLATFORM_DISABLED",
                    "message": "Developer platform is disabled for this organization.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                  "method": "PATCH"
                }
              }
            }
          },
          "404": {
            "description": "Conversation not found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Conversation not found",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "CONVERSATION_NOT_FOUND",
                      "message": "Conversation not found.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                    "method": "PATCH"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "CONVERSATION_NOT_FOUND",
                    "message": "Conversation not found.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                  "method": "PATCH"
                }
              }
            }
          },
          "409": {
            "description": "Invalid status transition or conflicting update",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Invalid status transition or conflicting update",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "INVALID_STATUS_TRANSITION",
                      "message": "Cannot transition conversation from closed to pending.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                    "method": "PATCH"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "INVALID_STATUS_TRANSITION",
                    "message": "Cannot transition conversation from closed to pending.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                  "method": "PATCH"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "VALIDATION_ERROR",
                      "message": "Validation failed",
                      "details": {
                        "issues": [
                          {
                            "path": [
                              "status"
                            ],
                            "message": "Invalid enum value."
                          }
                        ]
                      }
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                    "method": "PATCH"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "VALIDATION_ERROR",
                    "message": "Validation failed",
                    "details": {
                      "issues": [
                        {
                          "path": [
                            "status"
                          ],
                          "message": "Invalid enum value."
                        }
                      ]
                    }
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                  "method": "PATCH"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests — rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Too many requests. Please retry later.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                    "method": "PATCH"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RATE_LIMIT_EXCEEDED",
                    "message": "Too many requests. Please retry later.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                  "method": "PATCH"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "INTERNAL_SERVER_ERROR",
                      "message": "Internal server error",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                    "method": "PATCH"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "message": "Internal server error",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0",
                  "method": "PATCH"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X PATCH \"https://api.inaiy.com/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"status\":\"resolved\",\"priority\":\"high\",\"assignedAgentId\":\"662fa1b2c3d4e5f6a7b8c9d0\"}'"
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0\", {\n  method: \"PATCH\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n    \"Content-Type\": \"application/json\"\n  },\n  body: JSON.stringify({\n    \"status\": \"resolved\",\n    \"priority\": \"high\",\n    \"assignedAgentId\": \"662fa1b2c3d4e5f6a7b8c9d0\"\n  })\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0\", {\n    method: \"PATCH\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n      \"Content-Type\": \"application/json\"\n    },\n    body: JSON.stringify({\n      \"status\": \"resolved\",\n      \"priority\": \"high\",\n      \"assignedAgentId\": \"662fa1b2c3d4e5f6a7b8c9d0\"\n    })\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\npayload = {\n  \"status\": \"resolved\",\n  \"priority\": \"high\",\n  \"assignedAgentId\": \"662fa1b2c3d4e5f6a7b8c9d0\"\n}\nres = requests.patch(\"https://api.inaiy.com/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0\", headers=headers, json=payload)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .header(\"Content-Type\", \"application/json\")\n    .method(\"PATCH\", HttpRequest.BodyPublishers.ofString(\"{\\\"status\\\":\\\"resolved\\\",\\\"priority\\\":\\\"high\\\",\\\"assignedAgentId\\\":\\\"662fa1b2c3d4e5f6a7b8c9d0\\\"}\"))\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\",\n    \"Content-Type: application/json\"\n]);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, '{\"status\":\"resolved\",\"priority\":\"high\",\"assignedAgentId\":\"662fa1b2c3d4e5f6a7b8c9d0\"}');\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"PATCH\"), \"https://api.inaiy.com/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nrequest.Content = new StringContent(\"{\\\"status\\\":\\\"resolved\\\",\\\"priority\\\":\\\"high\\\",\\\"assignedAgentId\\\":\\\"662fa1b2c3d4e5f6a7b8c9d0\\\"}\", System.Text.Encoding.UTF8, \"application/json\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/messages": {
      "get": {
        "summary": "List messages",
        "tags": [
          "Public API - Messages"
        ],
        "description": "Returns a paginated, filterable, sortable list of messages for the authenticated tenant.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1,
              "example": 1
            },
            "in": "query",
            "name": "page",
            "required": false
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "example": 25
            },
            "in": "query",
            "name": "limit",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "timestamp",
                "createdAt"
              ],
              "default": "timestamp"
            },
            "in": "query",
            "name": "sort",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "desc"
            },
            "in": "query",
            "name": "order",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "664fa1b2c3d4e5f6a7b8c9d0"
            },
            "in": "query",
            "name": "conversationId",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "663fa1b2c3d4e5f6a7b8c9d0"
            },
            "in": "query",
            "name": "contactId",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "queued",
                "processing",
                "received",
                "sent",
                "delivered",
                "read",
                "failed"
              ]
            },
            "in": "query",
            "name": "status",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "text"
            },
            "in": "query",
            "name": "type",
            "required": false,
            "description": "Message type (case-insensitive), e.g. text, image, template."
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "inbound",
                "outbound"
              ]
            },
            "in": "query",
            "name": "direction",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "in": "query",
            "name": "from",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "in": "query",
            "name": "to",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "id,body,status,timestamp"
            },
            "in": "query",
            "name": "fields",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of messages",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Paginated list of messages",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true,
                        "properties": {
                          "id": {
                            "type": "string",
                            "example": "6650a1b2c3d4e5f6a7b8c9d0"
                          },
                          "conversationId": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "664fa1b2c3d4e5f6a7b8c9d0"
                          },
                          "contactId": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "663fa1b2c3d4e5f6a7b8c9d0"
                          },
                          "channelId": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "662fa1b2c3d4e5f6a7b8c9d0"
                          },
                          "direction": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "enum": [
                              "inbound",
                              "outbound",
                              null
                            ],
                            "example": "outbound"
                          },
                          "type": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "TEXT"
                          },
                          "body": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "Hello from the Public API!"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "queued",
                              "sent",
                              "delivered",
                              "read",
                              "failed"
                            ],
                            "example": "queued"
                          },
                          "failureReason": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": null
                          },
                          "timestamp": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "format": "date-time"
                          },
                          "replyContext": {
                            "type": [
                              "null",
                              "object"
                            ],
                            "additionalProperties": true,
                            "properties": {
                              "messageId": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "preview": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "from": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              }
                            }
                          },
                          "media": {
                            "type": [
                              "null",
                              "object"
                            ],
                            "additionalProperties": true,
                            "properties": {
                              "type": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "mimeType": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "filename": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "caption": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "size": {
                                "type": [
                                  "null",
                                  "number"
                                ]
                              },
                              "downloadStatus": {
                                "type": [
                                  "null",
                                  "string"
                                ],
                                "description": "ready (file stored, use downloadUrl), pending (inbound file still downloading), failed, or unavailable (e.g. sent by URL).",
                                "example": "ready"
                              },
                              "downloadUrl": {
                                "type": [
                                  "null",
                                  "string"
                                ],
                                "description": "Public API path to download the file (same auth headers). Null until the file is stored.",
                                "example": "/api/public/v1/messages/6650a1b2c3d4e5f6a7b8c9d0/media"
                              }
                            }
                          },
                          "reply": {
                            "type": [
                              "null",
                              "object"
                            ],
                            "additionalProperties": true,
                            "description": "Inbound only: the option a customer picked on an interactive button or list message.",
                            "properties": {
                              "type": {
                                "type": [
                                  "null",
                                  "string"
                                ],
                                "enum": [
                                  "button_reply",
                                  "list_reply",
                                  null
                                ],
                                "example": "button_reply"
                              },
                              "id": {
                                "type": [
                                  "null",
                                  "string"
                                ],
                                "description": "The id you set on the button / row.",
                                "example": "confirm_order"
                              },
                              "title": {
                                "type": [
                                  "null",
                                  "string"
                                ],
                                "example": "Confirm"
                              },
                              "description": {
                                "type": [
                                  "null",
                                  "string"
                                ],
                                "example": null
                              }
                            }
                          },
                          "reaction": {
                            "type": [
                              "null",
                              "object"
                            ],
                            "additionalProperties": true
                          },
                          "template": {
                            "type": [
                              "null",
                              "object"
                            ],
                            "additionalProperties": true,
                            "properties": {
                              "name": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "language": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "category": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "parameters": {}
                            }
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "updatedAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "page": {
                          "type": "integer",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "example": 87
                        },
                        "totalPages": {
                          "type": "integer",
                          "example": 4
                        },
                        "hasNextPage": {
                          "type": "boolean",
                          "example": true
                        },
                        "hasPrevPage": {
                          "type": "boolean",
                          "example": false
                        },
                        "nextCursor": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": null
                        },
                        "prevCursor": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": null
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "example": {
                    "success": true,
                    "data": [
                      {
                        "id": "6650a1b2c3d4e5f6a7b8c9d0",
                        "conversationId": "664fa1b2c3d4e5f6a7b8c9d0",
                        "contactId": "663fa1b2c3d4e5f6a7b8c9d0",
                        "channelId": "662fa1b2c3d4e5f6a7b8c9d0",
                        "direction": "outbound",
                        "type": "TEXT",
                        "body": "Hello from the Public API!",
                        "status": "delivered",
                        "failureReason": null,
                        "timestamp": "2026-07-12T09:30:00.000Z",
                        "replyContext": null,
                        "media": null,
                        "reaction": null,
                        "template": null,
                        "createdAt": "2026-07-12T09:30:00.000Z",
                        "updatedAt": "2026-07-12T09:31:00.000Z"
                      }
                    ],
                    "pagination": {
                      "page": 1,
                      "limit": 25,
                      "total": 87,
                      "totalPages": 4,
                      "hasNextPage": true,
                      "hasPrevPage": false,
                      "nextCursor": null,
                      "prevCursor": null
                    },
                    "meta": {
                      "apiVersion": "v1",
                      "sort": {
                        "field": "timestamp",
                        "order": "desc"
                      }
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z"
                  }
                },
                "example": {
                  "success": true,
                  "data": [
                    {
                      "id": "6650a1b2c3d4e5f6a7b8c9d0",
                      "conversationId": "664fa1b2c3d4e5f6a7b8c9d0",
                      "contactId": "663fa1b2c3d4e5f6a7b8c9d0",
                      "channelId": "662fa1b2c3d4e5f6a7b8c9d0",
                      "direction": "outbound",
                      "type": "TEXT",
                      "body": "Hello from the Public API!",
                      "status": "delivered",
                      "failureReason": null,
                      "timestamp": "2026-07-12T09:30:00.000Z",
                      "replyContext": null,
                      "media": null,
                      "reaction": null,
                      "template": null,
                      "createdAt": "2026-07-12T09:30:00.000Z",
                      "updatedAt": "2026-07-12T09:31:00.000Z"
                    }
                  ],
                  "pagination": {
                    "page": 1,
                    "limit": 25,
                    "total": 87,
                    "totalPages": 4,
                    "hasNextPage": true,
                    "hasPrevPage": false,
                    "nextCursor": null,
                    "prevCursor": null
                  },
                  "meta": {
                    "apiVersion": "v1",
                    "sort": {
                      "field": "timestamp",
                      "order": "desc"
                    }
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "ACCOUNT_CONFIGURATION_ERROR",
                      "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "ACCOUNT_CONFIGURATION_ERROR",
                    "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "API_KEY_INVALID",
                      "message": "Invalid API key.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "API_KEY_INVALID",
                    "message": "Invalid API key.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DEVELOPER_PLATFORM_DISABLED",
                      "message": "Developer platform is disabled for this organization.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DEVELOPER_PLATFORM_DISABLED",
                    "message": "Developer platform is disabled for this organization.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed (invalid body, unapproved template, missing variables, unsupported type)",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed (invalid body, unapproved template, missing variables, unsupported type)",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "VALIDATION_ERROR",
                      "message": "Validation failed",
                      "details": {
                        "issues": [
                          {
                            "path": [
                              "text"
                            ],
                            "message": "text is required"
                          }
                        ]
                      }
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "VALIDATION_ERROR",
                    "message": "Validation failed",
                    "details": {
                      "issues": [
                        {
                          "path": [
                            "text"
                          ],
                          "message": "text is required"
                        }
                      ]
                    }
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests - rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests - rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Too many requests. Please retry later.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RATE_LIMIT_EXCEEDED",
                    "message": "Too many requests. Please retry later.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "INTERNAL_SERVER_ERROR",
                      "message": "Internal server error",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "message": "Internal server error",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/messages\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/messages\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/messages\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/messages\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/messages\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/messages\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/messages\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      },
      "post": {
        "summary": "Send a message (queued)",
        "tags": [
          "Public API - Messages"
        ],
        "description": "Queues a text, media, interactive, or template message for asynchronous delivery via the messaging engine. Returns 202 Accepted with the queued message id. Message sending is never synchronous.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "type",
                  "channelId"
                ],
                "additionalProperties": true,
                "description": "Send a text or template message. Provide contactId, phone (WhatsApp), igsid (Instagram), or psid (Messenger). Instagram channels accept type=text only; identity is IGSID, not phone. Contacts are not created from IGSID. Messenger (Facebook Page) channels accept type=text only (max 2000 chars); identity is PSID or contactId, the person must have messaged that Page, and sends follow the 24-hour window (API sends never use the Human Agent tag). Contacts are not created from PSID. When phone is used and createContactIfMissing is true, a WhatsApp contact is created if missing. The conversation is auto-resolved from contactId + channelId when conversationId is omitted. The message is enqueued (never sent synchronously) and the endpoint returns 202 Accepted. Media types take an upload storageKey (POST /media/upload) or a public https media.url that Meta downloads. type=interactive sends WhatsApp reply buttons, a list, or a CTA URL button inside the 24-hour session window. Reaction is not yet supported.",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "text",
                      "image",
                      "video",
                      "audio",
                      "document",
                      "template",
                      "reaction",
                      "interactive"
                    ],
                    "example": "text"
                  },
                  "channelId": {
                    "type": "string",
                    "description": "Channel to send from. Copy it from Settings → Developer → Channels in the inaiy app.",
                    "example": "662fa1b2c3d4e5f6a7b8c9d0"
                  },
                  "contactId": {
                    "type": "string",
                    "description": "Existing contact id. Required unless phone, igsid, or psid is provided.",
                    "example": "663fa1b2c3d4e5f6a7b8c9d0"
                  },
                  "phone": {
                    "type": "string",
                    "description": "E.164 phone (e.g. +919123577452). WhatsApp only. Used when contactId is omitted.",
                    "example": "+919123577452"
                  },
                  "igsid": {
                    "type": "string",
                    "description": "Numeric Instagram scoped user id. Instagram only. The contact must already exist.",
                    "example": "2334130017412363"
                  },
                  "psid": {
                    "type": "string",
                    "description": "Numeric Page-scoped id of a Messenger contact. Messenger only. The contact must already exist and have messaged this Page.",
                    "example": "7012345678901234"
                  },
                  "contactName": {
                    "type": "string",
                    "description": "Optional display name when createContactIfMissing creates a contact.",
                    "example": "Jane Doe"
                  },
                  "createContactIfMissing": {
                    "type": "boolean",
                    "default": false,
                    "description": "When true and phone is provided, create the contact if it does not exist.",
                    "example": true
                  },
                  "conversationId": {
                    "type": "string",
                    "description": "Optional; auto-resolved when omitted.",
                    "example": "664fa1b2c3d4e5f6a7b8c9d0"
                  },
                  "text": {
                    "type": "string",
                    "description": "Required for type=text (max 4096 chars).",
                    "example": "Hello from the Public API!"
                  },
                  "media": {
                    "type": "object",
                    "description": "Required for image/video/audio/document. Provide storageKey or url.",
                    "properties": {
                      "storageKey": {
                        "type": "string",
                        "description": "Media upload storageKey from POST /media/upload."
                      },
                      "url": {
                        "type": "string",
                        "description": "Public https URL of the file (max 2000 chars). Meta downloads it at send time. `link` is accepted as an alias.",
                        "example": "https://example.com/files/invoice.pdf"
                      },
                      "filename": {
                        "type": "string",
                        "description": "Document filename shown to the customer (max 255).",
                        "example": "invoice.pdf"
                      },
                      "caption": {
                        "type": "string",
                        "description": "Caption for image, video, and document (max 1024). Ignored for audio."
                      }
                    }
                  },
                  "interactive": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Required for type=interactive. WhatsApp Cloud API `interactive` object; interactive.type is button, list, or cta_url. button: action.buttons (1-3) of { type: \"reply\", reply: { id, title<=20 } }. list: action.button (<=20) and action.sections (1-10) of { title, rows: [{ id, title<=24, description<=72 }] }. cta_url: action.name \"cta_url\" and action.parameters { display_text<=20, url }. body.text (<=1024) is required; header (text, or image/video/document by link) and footer.text (<=60) are optional. The customer's pick arrives as an inbound message with `reply.id`.",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "button",
                          "list",
                          "cta_url"
                        ]
                      },
                      "header": {
                        "type": "object",
                        "additionalProperties": true
                      },
                      "body": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          }
                        }
                      },
                      "footer": {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          }
                        }
                      },
                      "action": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  },
                  "replyToMessageId": {
                    "type": "string",
                    "description": "Message id to reply to (text/media/interactive only)."
                  },
                  "emoji": {
                    "type": "string",
                    "description": "Reserved for type=reaction. Reactions are not supported yet and return 422."
                  },
                  "targetMessageId": {
                    "type": "string",
                    "description": "Reserved for type=reaction (the message being reacted to). Reactions are not supported yet and return 422."
                  },
                  "metadata": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Arbitrary external metadata (text/media only)."
                  },
                  "template": {
                    "type": "object",
                    "description": "Required for type=template.",
                    "properties": {
                      "name": {
                        "type": "string",
                        "example": "order_update"
                      },
                      "language": {
                        "type": "string",
                        "example": "en_US"
                      },
                      "parameters": {
                        "type": "object",
                        "description": "Send-time parameters. Shape depends on the template type (standard, authentication, carousel, limited_time_offer).",
                        "properties": {
                          "body": {
                            "description": "Positional array or named object of body variables."
                          },
                          "header": {
                            "type": "object",
                            "additionalProperties": true,
                            "description": "Header variables: { text } for text headers, { storageKey } / { link } / { id } for media headers."
                          },
                          "buttons": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "index": {
                                  "type": "integer"
                                },
                                "text": {
                                  "type": "string",
                                  "description": "Dynamic URL button suffix."
                                },
                                "couponCode": {
                                  "type": "string",
                                  "description": "Copy-code / coupon button value."
                                },
                                "payload": {
                                  "type": "string",
                                  "description": "Dynamic quick-reply payload."
                                },
                                "flowToken": {
                                  "type": "string",
                                  "description": "Flow button token."
                                }
                              }
                            }
                          },
                          "code": {
                            "type": "string",
                            "description": "One-time code for authentication templates."
                          },
                          "cards": {
                            "type": "array",
                            "description": "Per-card parameters for carousel templates.",
                            "items": {
                              "type": "object",
                              "properties": {
                                "cardIndex": {
                                  "type": "integer"
                                },
                                "header": {
                                  "type": "object",
                                  "additionalProperties": true
                                },
                                "body": {
                                  "description": "Positional array or named object of card body variables."
                                },
                                "buttons": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "additionalProperties": true
                                  }
                                }
                              }
                            }
                          },
                          "limitedTimeOffer": {
                            "type": "object",
                            "properties": {
                              "expirationTimeMs": {
                                "type": "integer",
                                "description": "Offer expiration timestamp in ms."
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              "examples": {
                "example1": {
                  "value": {
                    "type": "text",
                    "channelId": "662fa1b2c3d4e5f6a7b8c9d0",
                    "contactId": "663fa1b2c3d4e5f6a7b8c9d0",
                    "text": "Hello from the Public API!"
                  }
                },
                "example2": {
                  "value": {
                    "type": "text",
                    "channelId": "6aa906b679e6eec18d485da2",
                    "igsid": "2334130017412363",
                    "text": "Hello from the Instagram Public API!"
                  }
                },
                "example3": {
                  "value": {
                    "type": "text",
                    "channelId": "6ab906b679e6eec18d485db3",
                    "psid": "7012345678901234",
                    "text": "Hello from the Messenger Public API!"
                  }
                },
                "example4": {
                  "value": {
                    "type": "template",
                    "channelId": "662fa1b2c3d4e5f6a7b8c9d0",
                    "phone": "+919123577452",
                    "createContactIfMissing": true,
                    "contactName": "OTP User",
                    "template": {
                      "name": "hello_world",
                      "language": "en_US"
                    }
                  }
                },
                "example5": {
                  "value": {
                    "type": "template",
                    "channelId": "662fa1b2c3d4e5f6a7b8c9d0",
                    "contactId": "663fa1b2c3d4e5f6a7b8c9d0",
                    "template": {
                      "name": "order_update",
                      "language": "en_US",
                      "parameters": {
                        "body": [
                          "Jane",
                          "shipped"
                        ]
                      }
                    }
                  }
                },
                "example6": {
                  "value": {
                    "type": "document",
                    "channelId": "662fa1b2c3d4e5f6a7b8c9d0",
                    "contactId": "663fa1b2c3d4e5f6a7b8c9d0",
                    "media": {
                      "url": "https://example.com/files/invoice.pdf",
                      "filename": "invoice.pdf",
                      "caption": "Your invoice"
                    }
                  }
                },
                "example7": {
                  "value": {
                    "type": "interactive",
                    "channelId": "662fa1b2c3d4e5f6a7b8c9d0",
                    "contactId": "663fa1b2c3d4e5f6a7b8c9d0",
                    "interactive": {
                      "type": "button",
                      "body": {
                        "text": "Confirm your order #1042?"
                      },
                      "action": {
                        "buttons": [
                          {
                            "type": "reply",
                            "reply": {
                              "id": "confirm_order",
                              "title": "Confirm"
                            }
                          },
                          {
                            "type": "reply",
                            "reply": {
                              "id": "cancel_order",
                              "title": "Cancel"
                            }
                          }
                        ]
                      }
                    }
                  }
                },
                "example8": {
                  "value": {
                    "type": "interactive",
                    "channelId": "662fa1b2c3d4e5f6a7b8c9d0",
                    "contactId": "663fa1b2c3d4e5f6a7b8c9d0",
                    "interactive": {
                      "type": "list",
                      "body": {
                        "text": "Pick a delivery slot"
                      },
                      "action": {
                        "button": "Choose slot",
                        "sections": [
                          {
                            "title": "Tomorrow",
                            "rows": [
                              {
                                "id": "slot_am",
                                "title": "9am - 12pm"
                              },
                              {
                                "id": "slot_pm",
                                "title": "2pm - 6pm"
                              }
                            ]
                          }
                        ]
                      }
                    }
                  }
                },
                "example9": {
                  "value": {
                    "type": "interactive",
                    "channelId": "662fa1b2c3d4e5f6a7b8c9d0",
                    "contactId": "663fa1b2c3d4e5f6a7b8c9d0",
                    "interactive": {
                      "type": "cta_url",
                      "body": {
                        "text": "Track your shipment"
                      },
                      "action": {
                        "name": "cta_url",
                        "parameters": {
                          "display_text": "Track",
                          "url": "https://example.com/track/1042"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "required": true,
          "description": "Send a text or template message. Provide contactId, phone (WhatsApp), igsid (Instagram), or psid (Messenger). Instagram channels accept type=text only; identity is IGSID, not phone. Contacts are not created from IGSID. Messenger (Facebook Page) channels accept type=text only (max 2000 chars); identity is PSID or contactId, the person must have messaged that Page, and sends follow the 24-hour window (API sends never use the Human Agent tag). Contacts are not created from PSID. When phone is used and createContactIfMissing is true, a WhatsApp contact is created if missing. The conversation is auto-resolved from contactId + channelId when conversationId is omitted. The message is enqueued (never sent synchronously) and the endpoint returns 202 Accepted. Media types take an upload storageKey (POST /media/upload) or a public https media.url that Meta downloads. type=interactive sends WhatsApp reply buttons, a list, or a CTA URL button inside the 24-hour session window. Reaction is not yet supported."
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "202": {
            "description": "Message accepted and queued",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Message accepted and queued",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "id": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "6650a1b2c3d4e5f6a7b8c9d0"
                        },
                        "status": {
                          "type": "string",
                          "example": "queued"
                        },
                        "conversationId": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "664fa1b2c3d4e5f6a7b8c9d0"
                        },
                        "type": {
                          "type": "string",
                          "example": "text"
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "example": {
                    "success": true,
                    "data": {
                      "id": "6650a1b2c3d4e5f6a7b8c9d0",
                      "status": "queued",
                      "conversationId": "664fa1b2c3d4e5f6a7b8c9d0",
                      "type": "text"
                    },
                    "meta": {
                      "apiVersion": "v1",
                      "queued": true
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z"
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "6650a1b2c3d4e5f6a7b8c9d0",
                    "status": "queued",
                    "conversationId": "664fa1b2c3d4e5f6a7b8c9d0",
                    "type": "text"
                  },
                  "meta": {
                    "apiVersion": "v1",
                    "queued": true
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "ACCOUNT_CONFIGURATION_ERROR",
                      "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "ACCOUNT_CONFIGURATION_ERROR",
                    "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "API_KEY_INVALID",
                      "message": "Invalid API key.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "API_KEY_INVALID",
                    "message": "Invalid API key.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DEVELOPER_PLATFORM_DISABLED",
                      "message": "Developer platform is disabled for this organization.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DEVELOPER_PLATFORM_DISABLED",
                    "message": "Developer platform is disabled for this organization.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          },
          "404": {
            "description": "Message, conversation, contact, or template not found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Message, conversation, contact, or template not found",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "MESSAGE_NOT_FOUND",
                      "message": "Message not found.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "MESSAGE_NOT_FOUND",
                    "message": "Message not found.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          },
          "409": {
            "description": "Conflicting state (e.g. conversation not sendable)",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Conflicting state (e.g. conversation not sendable)",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "CONVERSATION_NOT_SENDABLE",
                      "message": "Conversation is not in a sendable state.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "CONVERSATION_NOT_SENDABLE",
                    "message": "Conversation is not in a sendable state.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed (invalid body, unapproved template, missing variables, unsupported type)",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed (invalid body, unapproved template, missing variables, unsupported type)",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "VALIDATION_ERROR",
                      "message": "Validation failed",
                      "details": {
                        "issues": [
                          {
                            "path": [
                              "text"
                            ],
                            "message": "text is required"
                          }
                        ]
                      }
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "VALIDATION_ERROR",
                    "message": "Validation failed",
                    "details": {
                      "issues": [
                        {
                          "path": [
                            "text"
                          ],
                          "message": "text is required"
                        }
                      ]
                    }
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests - rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests - rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Too many requests. Please retry later.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RATE_LIMIT_EXCEEDED",
                    "message": "Too many requests. Please retry later.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "INTERNAL_SERVER_ERROR",
                      "message": "Internal server error",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "message": "Internal server error",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X POST \"https://api.inaiy.com/api/public/v1/messages\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/messages\", {\n  method: \"POST\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/messages\", {\n    method: \"POST\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.post(\"https://api.inaiy.com/api/public/v1/messages\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/messages\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"POST\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/messages\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"POST\"), \"https://api.inaiy.com/api/public/v1/messages\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/messages/{id}": {
      "get": {
        "summary": "Get a message by id",
        "tags": [
          "Public API - Messages"
        ],
        "description": "Fetch a single message by its public id.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "example": "id,body,status,timestamp"
            },
            "in": "query",
            "name": "fields",
            "required": false,
            "description": "Comma-separated list of fields to return (sparse fieldset)."
          },
          {
            "schema": {
              "type": "string",
              "example": "6650a1b2c3d4e5f6a7b8c9d0"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "24-char message ObjectId"
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "The message",
            "content": {
              "application/json": {
                "schema": {
                  "description": "The message",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "id": {
                          "type": "string",
                          "example": "6650a1b2c3d4e5f6a7b8c9d0"
                        },
                        "conversationId": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "664fa1b2c3d4e5f6a7b8c9d0"
                        },
                        "contactId": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "663fa1b2c3d4e5f6a7b8c9d0"
                        },
                        "channelId": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "662fa1b2c3d4e5f6a7b8c9d0"
                        },
                        "direction": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "enum": [
                            "inbound",
                            "outbound",
                            null
                          ],
                          "example": "outbound"
                        },
                        "type": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "TEXT"
                        },
                        "body": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "Hello from the Public API!"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "queued",
                            "sent",
                            "delivered",
                            "read",
                            "failed"
                          ],
                          "example": "queued"
                        },
                        "failureReason": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": null
                        },
                        "timestamp": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        },
                        "replyContext": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true,
                          "properties": {
                            "messageId": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "preview": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "from": {
                              "type": [
                                "null",
                                "string"
                              ]
                            }
                          }
                        },
                        "media": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true,
                          "properties": {
                            "type": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "mimeType": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "filename": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "caption": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "size": {
                              "type": [
                                "null",
                                "number"
                              ]
                            },
                            "downloadStatus": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "description": "ready (file stored, use downloadUrl), pending (inbound file still downloading), failed, or unavailable (e.g. sent by URL).",
                              "example": "ready"
                            },
                            "downloadUrl": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "description": "Public API path to download the file (same auth headers). Null until the file is stored.",
                              "example": "/api/public/v1/messages/6650a1b2c3d4e5f6a7b8c9d0/media"
                            }
                          }
                        },
                        "reply": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true,
                          "description": "Inbound only: the option a customer picked on an interactive button or list message.",
                          "properties": {
                            "type": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "enum": [
                                "button_reply",
                                "list_reply",
                                null
                              ],
                              "example": "button_reply"
                            },
                            "id": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "description": "The id you set on the button / row.",
                              "example": "confirm_order"
                            },
                            "title": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "example": "Confirm"
                            },
                            "description": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "example": null
                            }
                          }
                        },
                        "reaction": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "template": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true,
                          "properties": {
                            "name": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "language": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "category": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "parameters": {}
                          }
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "example": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11"
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "example": {
                    "success": true,
                    "data": {
                      "id": "6650a1b2c3d4e5f6a7b8c9d0",
                      "conversationId": "664fa1b2c3d4e5f6a7b8c9d0",
                      "contactId": "663fa1b2c3d4e5f6a7b8c9d0",
                      "channelId": "662fa1b2c3d4e5f6a7b8c9d0",
                      "direction": "outbound",
                      "type": "TEXT",
                      "body": "Hello from the Public API!",
                      "status": "delivered",
                      "failureReason": null,
                      "timestamp": "2026-07-12T09:30:00.000Z",
                      "replyContext": null,
                      "media": null,
                      "reaction": null,
                      "template": null,
                      "createdAt": "2026-07-12T09:30:00.000Z",
                      "updatedAt": "2026-07-12T09:31:00.000Z"
                    },
                    "meta": {
                      "apiVersion": "v1"
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z"
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "6650a1b2c3d4e5f6a7b8c9d0",
                    "conversationId": "664fa1b2c3d4e5f6a7b8c9d0",
                    "contactId": "663fa1b2c3d4e5f6a7b8c9d0",
                    "channelId": "662fa1b2c3d4e5f6a7b8c9d0",
                    "direction": "outbound",
                    "type": "TEXT",
                    "body": "Hello from the Public API!",
                    "status": "delivered",
                    "failureReason": null,
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "replyContext": null,
                    "media": null,
                    "reaction": null,
                    "template": null,
                    "createdAt": "2026-07-12T09:30:00.000Z",
                    "updatedAt": "2026-07-12T09:31:00.000Z"
                  },
                  "meta": {
                    "apiVersion": "v1"
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "ACCOUNT_CONFIGURATION_ERROR",
                      "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "ACCOUNT_CONFIGURATION_ERROR",
                    "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "API_KEY_INVALID",
                      "message": "Invalid API key.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "API_KEY_INVALID",
                    "message": "Invalid API key.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DEVELOPER_PLATFORM_DISABLED",
                      "message": "Developer platform is disabled for this organization.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DEVELOPER_PLATFORM_DISABLED",
                    "message": "Developer platform is disabled for this organization.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          },
          "404": {
            "description": "Message, conversation, contact, or template not found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Message, conversation, contact, or template not found",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "MESSAGE_NOT_FOUND",
                      "message": "Message not found.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "MESSAGE_NOT_FOUND",
                    "message": "Message not found.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests - rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests - rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Too many requests. Please retry later.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RATE_LIMIT_EXCEEDED",
                    "message": "Too many requests. Please retry later.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "INTERNAL_SERVER_ERROR",
                      "message": "Internal server error",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "message": "Internal server error",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/messages/6650a1b2c3d4e5f6a7b8c9d0\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/messages/6650a1b2c3d4e5f6a7b8c9d0\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/messages/6650a1b2c3d4e5f6a7b8c9d0\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/messages/6650a1b2c3d4e5f6a7b8c9d0\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/messages/6650a1b2c3d4e5f6a7b8c9d0\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/messages/6650a1b2c3d4e5f6a7b8c9d0\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/messages/6650a1b2c3d4e5f6a7b8c9d0\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/messages/{id}/media": {
      "get": {
        "summary": "Download message media",
        "tags": [
          "Public API - Messages"
        ],
        "description": "Streams the file of an inbound or outbound media message (image, video, audio, document, sticker). Check `media.downloadStatus` on the message first: 409 MEDIA_NOT_READY means the inbound file is still downloading; 404 MEDIA_NOT_FOUND means the message has no stored file (e.g. media sent by URL). Pass inline=1 to get Content-Disposition: inline.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "inline",
            "required": false,
            "description": "Set to 1/true for inline Content-Disposition."
          },
          {
            "schema": {
              "type": "string",
              "example": "6650a1b2c3d4e5f6a7b8c9d0"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "24-char message ObjectId"
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "Binary file stream with Content-Type set to the media MIME type.",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Binary file stream with Content-Type set to the media MIME type.",
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "ACCOUNT_CONFIGURATION_ERROR",
                      "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "ACCOUNT_CONFIGURATION_ERROR",
                    "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "API_KEY_INVALID",
                      "message": "Invalid API key.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "API_KEY_INVALID",
                    "message": "Invalid API key.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DEVELOPER_PLATFORM_DISABLED",
                      "message": "Developer platform is disabled for this organization.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DEVELOPER_PLATFORM_DISABLED",
                    "message": "Developer platform is disabled for this organization.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          },
          "404": {
            "description": "Message, conversation, contact, or template not found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Message, conversation, contact, or template not found",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "MESSAGE_NOT_FOUND",
                      "message": "Message not found.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "MESSAGE_NOT_FOUND",
                    "message": "Message not found.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          },
          "409": {
            "description": "Conflicting state (e.g. conversation not sendable)",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Conflicting state (e.g. conversation not sendable)",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "CONVERSATION_NOT_SENDABLE",
                      "message": "Conversation is not in a sendable state.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "CONVERSATION_NOT_SENDABLE",
                    "message": "Conversation is not in a sendable state.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests - rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests - rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Too many requests. Please retry later.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RATE_LIMIT_EXCEEDED",
                    "message": "Too many requests. Please retry later.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "INTERNAL_SERVER_ERROR",
                      "message": "Internal server error",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "message": "Internal server error",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/messages/6650a1b2c3d4e5f6a7b8c9d0/media\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/messages/6650a1b2c3d4e5f6a7b8c9d0/media\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/messages/6650a1b2c3d4e5f6a7b8c9d0/media\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/messages/6650a1b2c3d4e5f6a7b8c9d0/media\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/messages/6650a1b2c3d4e5f6a7b8c9d0/media\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/messages/6650a1b2c3d4e5f6a7b8c9d0/media\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/messages/6650a1b2c3d4e5f6a7b8c9d0/media\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/conversations/{conversationId}/messages": {
      "get": {
        "summary": "List messages in a conversation",
        "tags": [
          "Public API - Messages"
        ],
        "description": "Returns a paginated, filterable list of messages within a specific conversation.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1,
              "example": 1
            },
            "in": "query",
            "name": "page",
            "required": false
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "example": 25
            },
            "in": "query",
            "name": "limit",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "timestamp",
                "createdAt"
              ],
              "default": "timestamp"
            },
            "in": "query",
            "name": "sort",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "desc"
            },
            "in": "query",
            "name": "order",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "664fa1b2c3d4e5f6a7b8c9d0"
            },
            "in": "query",
            "name": "conversationId",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "663fa1b2c3d4e5f6a7b8c9d0"
            },
            "in": "query",
            "name": "contactId",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "queued",
                "processing",
                "received",
                "sent",
                "delivered",
                "read",
                "failed"
              ]
            },
            "in": "query",
            "name": "status",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "text"
            },
            "in": "query",
            "name": "type",
            "required": false,
            "description": "Message type (case-insensitive), e.g. text, image, template."
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "inbound",
                "outbound"
              ]
            },
            "in": "query",
            "name": "direction",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "in": "query",
            "name": "from",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "in": "query",
            "name": "to",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "id,body,status,timestamp"
            },
            "in": "query",
            "name": "fields",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "664fa1b2c3d4e5f6a7b8c9d0"
            },
            "in": "path",
            "name": "conversationId",
            "required": true,
            "description": "24-char conversation ObjectId"
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of messages",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Paginated list of messages",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true,
                        "properties": {
                          "id": {
                            "type": "string",
                            "example": "6650a1b2c3d4e5f6a7b8c9d0"
                          },
                          "conversationId": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "664fa1b2c3d4e5f6a7b8c9d0"
                          },
                          "contactId": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "663fa1b2c3d4e5f6a7b8c9d0"
                          },
                          "channelId": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "662fa1b2c3d4e5f6a7b8c9d0"
                          },
                          "direction": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "enum": [
                              "inbound",
                              "outbound",
                              null
                            ],
                            "example": "outbound"
                          },
                          "type": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "TEXT"
                          },
                          "body": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "Hello from the Public API!"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "queued",
                              "sent",
                              "delivered",
                              "read",
                              "failed"
                            ],
                            "example": "queued"
                          },
                          "failureReason": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": null
                          },
                          "timestamp": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "format": "date-time"
                          },
                          "replyContext": {
                            "type": [
                              "null",
                              "object"
                            ],
                            "additionalProperties": true,
                            "properties": {
                              "messageId": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "preview": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "from": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              }
                            }
                          },
                          "media": {
                            "type": [
                              "null",
                              "object"
                            ],
                            "additionalProperties": true,
                            "properties": {
                              "type": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "mimeType": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "filename": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "caption": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "size": {
                                "type": [
                                  "null",
                                  "number"
                                ]
                              },
                              "downloadStatus": {
                                "type": [
                                  "null",
                                  "string"
                                ],
                                "description": "ready (file stored, use downloadUrl), pending (inbound file still downloading), failed, or unavailable (e.g. sent by URL).",
                                "example": "ready"
                              },
                              "downloadUrl": {
                                "type": [
                                  "null",
                                  "string"
                                ],
                                "description": "Public API path to download the file (same auth headers). Null until the file is stored.",
                                "example": "/api/public/v1/messages/6650a1b2c3d4e5f6a7b8c9d0/media"
                              }
                            }
                          },
                          "reply": {
                            "type": [
                              "null",
                              "object"
                            ],
                            "additionalProperties": true,
                            "description": "Inbound only: the option a customer picked on an interactive button or list message.",
                            "properties": {
                              "type": {
                                "type": [
                                  "null",
                                  "string"
                                ],
                                "enum": [
                                  "button_reply",
                                  "list_reply",
                                  null
                                ],
                                "example": "button_reply"
                              },
                              "id": {
                                "type": [
                                  "null",
                                  "string"
                                ],
                                "description": "The id you set on the button / row.",
                                "example": "confirm_order"
                              },
                              "title": {
                                "type": [
                                  "null",
                                  "string"
                                ],
                                "example": "Confirm"
                              },
                              "description": {
                                "type": [
                                  "null",
                                  "string"
                                ],
                                "example": null
                              }
                            }
                          },
                          "reaction": {
                            "type": [
                              "null",
                              "object"
                            ],
                            "additionalProperties": true
                          },
                          "template": {
                            "type": [
                              "null",
                              "object"
                            ],
                            "additionalProperties": true,
                            "properties": {
                              "name": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "language": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "category": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "parameters": {}
                            }
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "updatedAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "page": {
                          "type": "integer",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "example": 87
                        },
                        "totalPages": {
                          "type": "integer",
                          "example": 4
                        },
                        "hasNextPage": {
                          "type": "boolean",
                          "example": true
                        },
                        "hasPrevPage": {
                          "type": "boolean",
                          "example": false
                        },
                        "nextCursor": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": null
                        },
                        "prevCursor": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": null
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "example": {
                    "success": true,
                    "data": [
                      {
                        "id": "6650a1b2c3d4e5f6a7b8c9d0",
                        "conversationId": "664fa1b2c3d4e5f6a7b8c9d0",
                        "contactId": "663fa1b2c3d4e5f6a7b8c9d0",
                        "channelId": "662fa1b2c3d4e5f6a7b8c9d0",
                        "direction": "outbound",
                        "type": "TEXT",
                        "body": "Hello from the Public API!",
                        "status": "delivered",
                        "failureReason": null,
                        "timestamp": "2026-07-12T09:30:00.000Z",
                        "replyContext": null,
                        "media": null,
                        "reaction": null,
                        "template": null,
                        "createdAt": "2026-07-12T09:30:00.000Z",
                        "updatedAt": "2026-07-12T09:31:00.000Z"
                      }
                    ],
                    "pagination": {
                      "page": 1,
                      "limit": 25,
                      "total": 87,
                      "totalPages": 4,
                      "hasNextPage": true,
                      "hasPrevPage": false,
                      "nextCursor": null,
                      "prevCursor": null
                    },
                    "meta": {
                      "apiVersion": "v1",
                      "sort": {
                        "field": "timestamp",
                        "order": "desc"
                      }
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z"
                  }
                },
                "example": {
                  "success": true,
                  "data": [
                    {
                      "id": "6650a1b2c3d4e5f6a7b8c9d0",
                      "conversationId": "664fa1b2c3d4e5f6a7b8c9d0",
                      "contactId": "663fa1b2c3d4e5f6a7b8c9d0",
                      "channelId": "662fa1b2c3d4e5f6a7b8c9d0",
                      "direction": "outbound",
                      "type": "TEXT",
                      "body": "Hello from the Public API!",
                      "status": "delivered",
                      "failureReason": null,
                      "timestamp": "2026-07-12T09:30:00.000Z",
                      "replyContext": null,
                      "media": null,
                      "reaction": null,
                      "template": null,
                      "createdAt": "2026-07-12T09:30:00.000Z",
                      "updatedAt": "2026-07-12T09:31:00.000Z"
                    }
                  ],
                  "pagination": {
                    "page": 1,
                    "limit": 25,
                    "total": 87,
                    "totalPages": 4,
                    "hasNextPage": true,
                    "hasPrevPage": false,
                    "nextCursor": null,
                    "prevCursor": null
                  },
                  "meta": {
                    "apiVersion": "v1",
                    "sort": {
                      "field": "timestamp",
                      "order": "desc"
                    }
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "ACCOUNT_CONFIGURATION_ERROR",
                      "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "ACCOUNT_CONFIGURATION_ERROR",
                    "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "API_KEY_INVALID",
                      "message": "Invalid API key.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "API_KEY_INVALID",
                    "message": "Invalid API key.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DEVELOPER_PLATFORM_DISABLED",
                      "message": "Developer platform is disabled for this organization.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DEVELOPER_PLATFORM_DISABLED",
                    "message": "Developer platform is disabled for this organization.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          },
          "404": {
            "description": "Message, conversation, contact, or template not found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Message, conversation, contact, or template not found",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "MESSAGE_NOT_FOUND",
                      "message": "Message not found.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "MESSAGE_NOT_FOUND",
                    "message": "Message not found.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests - rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests - rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Too many requests. Please retry later.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RATE_LIMIT_EXCEEDED",
                    "message": "Too many requests. Please retry later.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "INTERNAL_SERVER_ERROR",
                      "message": "Internal server error",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/messages",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "message": "Internal server error",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/messages",
                  "method": "POST"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0/messages\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0/messages\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0/messages\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0/messages\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0/messages\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0/messages\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/conversations/6650a1b2c3d4e5f6a7b8c9d0/messages\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/media/upload": {
      "post": {
        "summary": "Upload media",
        "tags": [
          "Public API - Media"
        ],
        "description": "Upload a file for outbound messaging or template headers. Send multipart/form-data with a `file` field. Use the returned `storageKey` in message/template sends.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "id": {
                          "type": "string",
                          "example": "01HXYZ..."
                        },
                        "storageKey": {
                          "type": "string",
                          "description": "Use this as parameters.header.storageKey (templates) or media.storageKey (media messages).",
                          "example": "tenants/.../pending/.../file.pdf"
                        },
                        "mimeType": {
                          "type": "string",
                          "example": "application/pdf"
                        },
                        "filename": {
                          "type": "string",
                          "example": "invoice.pdf"
                        },
                        "size": {
                          "type": "integer",
                          "example": 245760
                        },
                        "messageType": {
                          "type": "string",
                          "enum": [
                            "IMAGE",
                            "VIDEO",
                            "AUDIO",
                            "DOCUMENT"
                          ],
                          "example": "DOCUMENT"
                        },
                        "previewUrl": {
                          "type": "string",
                          "example": "/api/public/v1/media/pending/01HXYZ/download?inline=1"
                        },
                        "createdAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X POST \"https://api.inaiy.com/api/public/v1/media/upload\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/media/upload\", {\n  method: \"POST\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/media/upload\", {\n    method: \"POST\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.post(\"https://api.inaiy.com/api/public/v1/media/upload\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/media/upload\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"POST\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/media/upload\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"POST\"), \"https://api.inaiy.com/api/public/v1/media/upload\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/media/pending/{uploadId}": {
      "get": {
        "summary": "Get pending media metadata",
        "tags": [
          "Public API - Media"
        ],
        "description": "Fetch metadata for a previously uploaded pending media file.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "uploadId",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "id": {
                          "type": "string",
                          "example": "01HXYZ..."
                        },
                        "storageKey": {
                          "type": "string",
                          "description": "Use this as parameters.header.storageKey (templates) or media.storageKey (media messages).",
                          "example": "tenants/.../pending/.../file.pdf"
                        },
                        "mimeType": {
                          "type": "string",
                          "example": "application/pdf"
                        },
                        "filename": {
                          "type": "string",
                          "example": "invoice.pdf"
                        },
                        "size": {
                          "type": "integer",
                          "example": 245760
                        },
                        "messageType": {
                          "type": "string",
                          "enum": [
                            "IMAGE",
                            "VIDEO",
                            "AUDIO",
                            "DOCUMENT"
                          ],
                          "example": "DOCUMENT"
                        },
                        "previewUrl": {
                          "type": "string",
                          "example": "/api/public/v1/media/pending/01HXYZ/download?inline=1"
                        },
                        "createdAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/media/pending/6650a1b2c3d4e5f6a7b8c9d0\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/media/pending/6650a1b2c3d4e5f6a7b8c9d0\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/media/pending/6650a1b2c3d4e5f6a7b8c9d0\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/media/pending/6650a1b2c3d4e5f6a7b8c9d0\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/media/pending/6650a1b2c3d4e5f6a7b8c9d0\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/media/pending/6650a1b2c3d4e5f6a7b8c9d0\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/media/pending/6650a1b2c3d4e5f6a7b8c9d0\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/media/pending/{uploadId}/download": {
      "get": {
        "summary": "Download / preview pending media",
        "tags": [
          "Public API - Media"
        ],
        "description": "Stream a pending upload. Pass `inline=1` for browser preview.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "inline",
            "required": false,
            "description": "Set to 1/true for inline Content-Disposition"
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "uploadId",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "Binary file stream",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Binary file stream",
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": "string"
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/media/pending/6650a1b2c3d4e5f6a7b8c9d0/download\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/media/pending/6650a1b2c3d4e5f6a7b8c9d0/download\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/media/pending/6650a1b2c3d4e5f6a7b8c9d0/download\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/media/pending/6650a1b2c3d4e5f6a7b8c9d0/download\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/media/pending/6650a1b2c3d4e5f6a7b8c9d0/download\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/media/pending/6650a1b2c3d4e5f6a7b8c9d0/download\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/media/pending/6650a1b2c3d4e5f6a7b8c9d0/download\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/templates": {
      "get": {
        "summary": "List templates",
        "tags": [
          "Public API - Templates"
        ],
        "description": "Returns a paginated, filterable, sortable list of WhatsApp templates for the authenticated tenant. DRAFT templates are never returned.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1,
              "example": 1
            },
            "in": "query",
            "name": "page",
            "required": false
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "example": 25
            },
            "in": "query",
            "name": "limit",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "name",
                "status",
                "category",
                "language",
                "lastSyncedAt",
                "updatedAt",
                "createdAt"
              ],
              "default": "updatedAt"
            },
            "in": "query",
            "name": "sort",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "desc"
            },
            "in": "query",
            "name": "order",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "MARKETING",
                "UTILITY",
                "AUTHENTICATION"
              ],
              "example": "UTILITY"
            },
            "in": "query",
            "name": "category",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "en_US"
            },
            "in": "query",
            "name": "language",
            "required": false,
            "description": "Language code, e.g. \"en\" or \"en_US\"."
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "APPROVED",
                "PENDING",
                "REJECTED",
                "PAUSED",
                "DISABLED",
                "IN_APPEAL",
                "DELETED"
              ],
              "example": "APPROVED"
            },
            "in": "query",
            "name": "status",
            "required": false,
            "description": "Approval status (DRAFT is never exposed)."
          },
          {
            "schema": {
              "type": "string",
              "example": "order"
            },
            "in": "query",
            "name": "search",
            "required": false,
            "description": "Case-insensitive template name search."
          },
          {
            "schema": {
              "type": "string",
              "example": "662fa1b2c3d4e5f6a7b8c9d0"
            },
            "in": "query",
            "name": "channelId",
            "required": false,
            "description": "Channel id from Settings → Developer → Channels, to narrow by channel."
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "in": "query",
            "name": "createdAfter",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "in": "query",
            "name": "createdBefore",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "in": "query",
            "name": "updatedAfter",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "in": "query",
            "name": "updatedBefore",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "id,name,category,language,status"
            },
            "in": "query",
            "name": "fields",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of templates",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Paginated list of templates",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true,
                        "properties": {
                          "id": {
                            "type": "string",
                            "example": "6650a1b2c3d4e5f6a7b8c9d0"
                          },
                          "name": {
                            "type": "string",
                            "example": "order_update"
                          },
                          "category": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "enum": [
                              "MARKETING",
                              "UTILITY",
                              "AUTHENTICATION",
                              null
                            ],
                            "example": "UTILITY"
                          },
                          "language": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "en_US"
                          },
                          "status": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "enum": [
                              "APPROVED",
                              "PENDING",
                              "REJECTED",
                              "PAUSED",
                              "DISABLED",
                              "IN_APPEAL",
                              "DELETED",
                              null
                            ],
                            "example": "APPROVED"
                          },
                          "templateType": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "STANDARD"
                          },
                          "parameterFormat": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "POSITIONAL"
                          },
                          "headerType": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "TEXT"
                          },
                          "hasButtons": {
                            "type": "boolean",
                            "example": true
                          },
                          "components": {
                            "type": [
                              "null",
                              "object"
                            ],
                            "additionalProperties": true,
                            "properties": {
                              "header": {
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "additionalProperties": true,
                                "properties": {
                                  "format": {
                                    "type": [
                                      "null",
                                      "string"
                                    ],
                                    "example": "TEXT"
                                  },
                                  "text": {
                                    "type": [
                                      "null",
                                      "string"
                                    ],
                                    "example": "Order {{1}} update"
                                  },
                                  "filename": {
                                    "type": [
                                      "null",
                                      "string"
                                    ],
                                    "example": null
                                  },
                                  "mimeType": {
                                    "type": [
                                      "null",
                                      "string"
                                    ],
                                    "example": null
                                  }
                                }
                              },
                              "body": {
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "additionalProperties": true,
                                "properties": {
                                  "text": {
                                    "type": [
                                      "null",
                                      "string"
                                    ],
                                    "example": "Hi {{1}}, your order is {{2}}."
                                  }
                                }
                              },
                              "footer": {
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "additionalProperties": true,
                                "properties": {
                                  "text": {
                                    "type": [
                                      "null",
                                      "string"
                                    ],
                                    "example": "Reply STOP to unsubscribe"
                                  }
                                }
                              },
                              "buttons": {
                                "type": [
                                  "null",
                                  "array"
                                ],
                                "items": {
                                  "type": "object",
                                  "additionalProperties": true,
                                  "properties": {
                                    "type": {
                                      "type": [
                                        "null",
                                        "string"
                                      ],
                                      "example": "URL"
                                    },
                                    "text": {
                                      "type": [
                                        "null",
                                        "string"
                                      ],
                                      "example": "Track order"
                                    },
                                    "url": {
                                      "type": [
                                        "null",
                                        "string"
                                      ],
                                      "example": "https://example.com/track/{{1}}"
                                    },
                                    "phoneNumber": {
                                      "type": [
                                        "null",
                                        "string"
                                      ],
                                      "example": null
                                    }
                                  }
                                }
                              },
                              "carousel": {
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "additionalProperties": true
                              }
                            }
                          },
                          "examples": {
                            "type": [
                              "null",
                              "object",
                              "array"
                            ]
                          },
                          "variables": {
                            "type": [
                              "null",
                              "object"
                            ],
                            "additionalProperties": true
                          },
                          "qualityScore": {
                            "type": [
                              "null",
                              "object"
                            ],
                            "additionalProperties": true,
                            "properties": {
                              "score": {
                                "type": [
                                  "null",
                                  "string",
                                  "number"
                                ],
                                "example": "GREEN"
                              },
                              "date": {
                                "type": [
                                  "null",
                                  "string"
                                ],
                                "format": "date-time"
                              }
                            }
                          },
                          "rejectionReason": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": null
                          },
                          "createdAt": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "format": "date-time"
                          },
                          "updatedAt": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "page": {
                          "type": "integer",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "example": 42
                        },
                        "totalPages": {
                          "type": "integer",
                          "example": 2
                        },
                        "hasNextPage": {
                          "type": "boolean",
                          "example": true
                        },
                        "hasPrevPage": {
                          "type": "boolean",
                          "example": false
                        },
                        "nextCursor": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": null
                        },
                        "prevCursor": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": null
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "example": {
                    "success": true,
                    "data": [
                      {
                        "id": "6650a1b2c3d4e5f6a7b8c9d0",
                        "name": "order_update",
                        "category": "UTILITY",
                        "language": "en_US",
                        "status": "APPROVED",
                        "templateType": "STANDARD",
                        "parameterFormat": "POSITIONAL",
                        "headerType": "TEXT",
                        "hasButtons": true,
                        "components": {
                          "header": {
                            "format": "TEXT",
                            "text": "Order {{1}} update",
                            "filename": null,
                            "mimeType": null
                          },
                          "body": {
                            "text": "Hi {{1}}, your order is {{2}}."
                          },
                          "footer": {
                            "text": "Reply STOP to unsubscribe"
                          },
                          "buttons": [
                            {
                              "type": "URL",
                              "text": "Track order",
                              "url": "https://example.com/track/{{1}}",
                              "phoneNumber": null
                            }
                          ],
                          "carousel": null
                        },
                        "examples": null,
                        "variables": {
                          "parameterFormat": "POSITIONAL",
                          "body": [
                            "1",
                            "2"
                          ],
                          "header": {
                            "type": "text",
                            "keys": [
                              "1"
                            ]
                          },
                          "buttons": [
                            {
                              "index": 0,
                              "type": "URL",
                              "keys": [
                                "1"
                              ]
                            }
                          ]
                        },
                        "qualityScore": {
                          "score": "GREEN",
                          "date": "2026-07-10T09:30:00.000Z"
                        },
                        "rejectionReason": null,
                        "createdAt": "2026-07-01T09:30:00.000Z",
                        "updatedAt": "2026-07-10T09:31:00.000Z"
                      }
                    ],
                    "pagination": {
                      "page": 1,
                      "limit": 25,
                      "total": 42,
                      "totalPages": 2,
                      "hasNextPage": true,
                      "hasPrevPage": false,
                      "nextCursor": null,
                      "prevCursor": null
                    },
                    "meta": {
                      "apiVersion": "v1",
                      "sort": {
                        "field": "createdAt",
                        "order": "desc"
                      }
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z"
                  }
                },
                "example": {
                  "success": true,
                  "data": [
                    {
                      "id": "6650a1b2c3d4e5f6a7b8c9d0",
                      "name": "order_update",
                      "category": "UTILITY",
                      "language": "en_US",
                      "status": "APPROVED",
                      "templateType": "STANDARD",
                      "parameterFormat": "POSITIONAL",
                      "headerType": "TEXT",
                      "hasButtons": true,
                      "components": {
                        "header": {
                          "format": "TEXT",
                          "text": "Order {{1}} update",
                          "filename": null,
                          "mimeType": null
                        },
                        "body": {
                          "text": "Hi {{1}}, your order is {{2}}."
                        },
                        "footer": {
                          "text": "Reply STOP to unsubscribe"
                        },
                        "buttons": [
                          {
                            "type": "URL",
                            "text": "Track order",
                            "url": "https://example.com/track/{{1}}",
                            "phoneNumber": null
                          }
                        ],
                        "carousel": null
                      },
                      "examples": null,
                      "variables": {
                        "parameterFormat": "POSITIONAL",
                        "body": [
                          "1",
                          "2"
                        ],
                        "header": {
                          "type": "text",
                          "keys": [
                            "1"
                          ]
                        },
                        "buttons": [
                          {
                            "index": 0,
                            "type": "URL",
                            "keys": [
                              "1"
                            ]
                          }
                        ]
                      },
                      "qualityScore": {
                        "score": "GREEN",
                        "date": "2026-07-10T09:30:00.000Z"
                      },
                      "rejectionReason": null,
                      "createdAt": "2026-07-01T09:30:00.000Z",
                      "updatedAt": "2026-07-10T09:31:00.000Z"
                    }
                  ],
                  "pagination": {
                    "page": 1,
                    "limit": 25,
                    "total": 42,
                    "totalPages": 2,
                    "hasNextPage": true,
                    "hasPrevPage": false,
                    "nextCursor": null,
                    "prevCursor": null
                  },
                  "meta": {
                    "apiVersion": "v1",
                    "sort": {
                      "field": "createdAt",
                      "order": "desc"
                    }
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "ACCOUNT_CONFIGURATION_ERROR",
                      "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/templates",
                    "method": "GET"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "ACCOUNT_CONFIGURATION_ERROR",
                    "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/templates",
                  "method": "GET"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "API_KEY_INVALID",
                      "message": "Invalid API key.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/templates",
                    "method": "GET"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "API_KEY_INVALID",
                    "message": "Invalid API key.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/templates",
                  "method": "GET"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DEVELOPER_PLATFORM_DISABLED",
                      "message": "Developer platform is disabled for this organization.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/templates",
                    "method": "GET"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DEVELOPER_PLATFORM_DISABLED",
                    "message": "Developer platform is disabled for this organization.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/templates",
                  "method": "GET"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed (invalid filters, sort, status, language, or date range)",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed (invalid filters, sort, status, language, or date range)",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "VALIDATION_ERROR",
                      "message": "Validation failed",
                      "details": {
                        "issues": [
                          {
                            "path": [
                              "status"
                            ],
                            "message": "Invalid enum value"
                          }
                        ]
                      }
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/templates",
                    "method": "GET"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "VALIDATION_ERROR",
                    "message": "Validation failed",
                    "details": {
                      "issues": [
                        {
                          "path": [
                            "status"
                          ],
                          "message": "Invalid enum value"
                        }
                      ]
                    }
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/templates",
                  "method": "GET"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests - rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests - rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Too many requests. Please retry later.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/templates",
                    "method": "GET"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RATE_LIMIT_EXCEEDED",
                    "message": "Too many requests. Please retry later.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/templates",
                  "method": "GET"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "INTERNAL_SERVER_ERROR",
                      "message": "Internal server error",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/templates",
                    "method": "GET"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "message": "Internal server error",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/templates",
                  "method": "GET"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/templates\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/templates\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/templates\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/templates\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/templates\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/templates\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/templates\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/templates/{idOrName}": {
      "get": {
        "summary": "Get template(s) by id or name",
        "tags": [
          "Public API - Templates"
        ],
        "description": "When the path value is a 24-char ObjectId, returns the single matching template (a local DRAFT is treated as 404). Otherwise the value is treated as an exact template name and a LIST of all matching templates (all languages, or narrowed by ?language=) is returned.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "example": "en_US"
            },
            "in": "query",
            "name": "language",
            "required": false,
            "description": "Narrow by language when looking up by name (ignored for id lookups)."
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1,
              "example": 1
            },
            "in": "query",
            "name": "page",
            "required": false
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "example": 25
            },
            "in": "query",
            "name": "limit",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "id,name,language,status"
            },
            "in": "query",
            "name": "fields",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "order_update"
            },
            "in": "path",
            "name": "idOrName",
            "required": true,
            "description": "Either a 24-char template ObjectId (returns a single template) or a template name (returns a list of all matching templates across languages)."
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "A single template (id lookup) or a list of templates (name lookup)",
            "content": {
              "application/json": {
                "schema": {
                  "description": "A single template (id lookup) or a list of templates (name lookup)",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "id": {
                          "type": "string",
                          "example": "6650a1b2c3d4e5f6a7b8c9d0"
                        },
                        "name": {
                          "type": "string",
                          "example": "order_update"
                        },
                        "category": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "enum": [
                            "MARKETING",
                            "UTILITY",
                            "AUTHENTICATION",
                            null
                          ],
                          "example": "UTILITY"
                        },
                        "language": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "en_US"
                        },
                        "status": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "enum": [
                            "APPROVED",
                            "PENDING",
                            "REJECTED",
                            "PAUSED",
                            "DISABLED",
                            "IN_APPEAL",
                            "DELETED",
                            null
                          ],
                          "example": "APPROVED"
                        },
                        "templateType": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "STANDARD"
                        },
                        "parameterFormat": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "POSITIONAL"
                        },
                        "headerType": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "TEXT"
                        },
                        "hasButtons": {
                          "type": "boolean",
                          "example": true
                        },
                        "components": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true,
                          "properties": {
                            "header": {
                              "type": [
                                "null",
                                "object"
                              ],
                              "additionalProperties": true,
                              "properties": {
                                "format": {
                                  "type": [
                                    "null",
                                    "string"
                                  ],
                                  "example": "TEXT"
                                },
                                "text": {
                                  "type": [
                                    "null",
                                    "string"
                                  ],
                                  "example": "Order {{1}} update"
                                },
                                "filename": {
                                  "type": [
                                    "null",
                                    "string"
                                  ],
                                  "example": null
                                },
                                "mimeType": {
                                  "type": [
                                    "null",
                                    "string"
                                  ],
                                  "example": null
                                }
                              }
                            },
                            "body": {
                              "type": [
                                "null",
                                "object"
                              ],
                              "additionalProperties": true,
                              "properties": {
                                "text": {
                                  "type": [
                                    "null",
                                    "string"
                                  ],
                                  "example": "Hi {{1}}, your order is {{2}}."
                                }
                              }
                            },
                            "footer": {
                              "type": [
                                "null",
                                "object"
                              ],
                              "additionalProperties": true,
                              "properties": {
                                "text": {
                                  "type": [
                                    "null",
                                    "string"
                                  ],
                                  "example": "Reply STOP to unsubscribe"
                                }
                              }
                            },
                            "buttons": {
                              "type": [
                                "null",
                                "array"
                              ],
                              "items": {
                                "type": "object",
                                "additionalProperties": true,
                                "properties": {
                                  "type": {
                                    "type": [
                                      "null",
                                      "string"
                                    ],
                                    "example": "URL"
                                  },
                                  "text": {
                                    "type": [
                                      "null",
                                      "string"
                                    ],
                                    "example": "Track order"
                                  },
                                  "url": {
                                    "type": [
                                      "null",
                                      "string"
                                    ],
                                    "example": "https://example.com/track/{{1}}"
                                  },
                                  "phoneNumber": {
                                    "type": [
                                      "null",
                                      "string"
                                    ],
                                    "example": null
                                  }
                                }
                              }
                            },
                            "carousel": {
                              "type": [
                                "null",
                                "object"
                              ],
                              "additionalProperties": true
                            }
                          }
                        },
                        "examples": {
                          "type": [
                            "null",
                            "object",
                            "array"
                          ]
                        },
                        "variables": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "qualityScore": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true,
                          "properties": {
                            "score": {
                              "type": [
                                "null",
                                "string",
                                "number"
                              ],
                              "example": "GREEN"
                            },
                            "date": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "format": "date-time"
                            }
                          }
                        },
                        "rejectionReason": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": null
                        },
                        "createdAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "example": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11"
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "example": {
                    "success": true,
                    "data": {
                      "id": "6650a1b2c3d4e5f6a7b8c9d0",
                      "name": "order_update",
                      "category": "UTILITY",
                      "language": "en_US",
                      "status": "APPROVED",
                      "templateType": "STANDARD",
                      "parameterFormat": "POSITIONAL",
                      "headerType": "TEXT",
                      "hasButtons": true,
                      "components": {
                        "header": {
                          "format": "TEXT",
                          "text": "Order {{1}} update",
                          "filename": null,
                          "mimeType": null
                        },
                        "body": {
                          "text": "Hi {{1}}, your order is {{2}}."
                        },
                        "footer": {
                          "text": "Reply STOP to unsubscribe"
                        },
                        "buttons": [
                          {
                            "type": "URL",
                            "text": "Track order",
                            "url": "https://example.com/track/{{1}}",
                            "phoneNumber": null
                          }
                        ],
                        "carousel": null
                      },
                      "examples": null,
                      "variables": {
                        "parameterFormat": "POSITIONAL",
                        "body": [
                          "1",
                          "2"
                        ],
                        "header": {
                          "type": "text",
                          "keys": [
                            "1"
                          ]
                        },
                        "buttons": [
                          {
                            "index": 0,
                            "type": "URL",
                            "keys": [
                              "1"
                            ]
                          }
                        ]
                      },
                      "qualityScore": {
                        "score": "GREEN",
                        "date": "2026-07-10T09:30:00.000Z"
                      },
                      "rejectionReason": null,
                      "createdAt": "2026-07-01T09:30:00.000Z",
                      "updatedAt": "2026-07-10T09:31:00.000Z"
                    },
                    "meta": {
                      "apiVersion": "v1"
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z"
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "6650a1b2c3d4e5f6a7b8c9d0",
                    "name": "order_update",
                    "category": "UTILITY",
                    "language": "en_US",
                    "status": "APPROVED",
                    "templateType": "STANDARD",
                    "parameterFormat": "POSITIONAL",
                    "headerType": "TEXT",
                    "hasButtons": true,
                    "components": {
                      "header": {
                        "format": "TEXT",
                        "text": "Order {{1}} update",
                        "filename": null,
                        "mimeType": null
                      },
                      "body": {
                        "text": "Hi {{1}}, your order is {{2}}."
                      },
                      "footer": {
                        "text": "Reply STOP to unsubscribe"
                      },
                      "buttons": [
                        {
                          "type": "URL",
                          "text": "Track order",
                          "url": "https://example.com/track/{{1}}",
                          "phoneNumber": null
                        }
                      ],
                      "carousel": null
                    },
                    "examples": null,
                    "variables": {
                      "parameterFormat": "POSITIONAL",
                      "body": [
                        "1",
                        "2"
                      ],
                      "header": {
                        "type": "text",
                        "keys": [
                          "1"
                        ]
                      },
                      "buttons": [
                        {
                          "index": 0,
                          "type": "URL",
                          "keys": [
                            "1"
                          ]
                        }
                      ]
                    },
                    "qualityScore": {
                      "score": "GREEN",
                      "date": "2026-07-10T09:30:00.000Z"
                    },
                    "rejectionReason": null,
                    "createdAt": "2026-07-01T09:30:00.000Z",
                    "updatedAt": "2026-07-10T09:31:00.000Z"
                  },
                  "meta": {
                    "apiVersion": "v1"
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "ACCOUNT_CONFIGURATION_ERROR",
                      "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/templates",
                    "method": "GET"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "ACCOUNT_CONFIGURATION_ERROR",
                    "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/templates",
                  "method": "GET"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "API_KEY_INVALID",
                      "message": "Invalid API key.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/templates",
                    "method": "GET"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "API_KEY_INVALID",
                    "message": "Invalid API key.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/templates",
                  "method": "GET"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DEVELOPER_PLATFORM_DISABLED",
                      "message": "Developer platform is disabled for this organization.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/templates",
                    "method": "GET"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DEVELOPER_PLATFORM_DISABLED",
                    "message": "Developer platform is disabled for this organization.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/templates",
                  "method": "GET"
                }
              }
            }
          },
          "404": {
            "description": "Template not found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Template not found",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "TEMPLATE_NOT_FOUND",
                      "message": "Template not found.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/templates",
                    "method": "GET"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "TEMPLATE_NOT_FOUND",
                    "message": "Template not found.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/templates",
                  "method": "GET"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed (invalid filters, sort, status, language, or date range)",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed (invalid filters, sort, status, language, or date range)",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "VALIDATION_ERROR",
                      "message": "Validation failed",
                      "details": {
                        "issues": [
                          {
                            "path": [
                              "status"
                            ],
                            "message": "Invalid enum value"
                          }
                        ]
                      }
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/templates",
                    "method": "GET"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "VALIDATION_ERROR",
                    "message": "Validation failed",
                    "details": {
                      "issues": [
                        {
                          "path": [
                            "status"
                          ],
                          "message": "Invalid enum value"
                        }
                      ]
                    }
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/templates",
                  "method": "GET"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests - rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests - rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Too many requests. Please retry later.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/templates",
                    "method": "GET"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RATE_LIMIT_EXCEEDED",
                    "message": "Too many requests. Please retry later.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/templates",
                  "method": "GET"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "INTERNAL_SERVER_ERROR",
                      "message": "Internal server error",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "path": "/api/public/v1/templates",
                    "method": "GET"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "message": "Internal server error",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:30:00.000Z",
                  "path": "/api/public/v1/templates",
                  "method": "GET"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/templates/6650a1b2c3d4e5f6a7b8c9d0\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/templates/6650a1b2c3d4e5f6a7b8c9d0\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/templates/6650a1b2c3d4e5f6a7b8c9d0\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/templates/6650a1b2c3d4e5f6a7b8c9d0\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/templates/6650a1b2c3d4e5f6a7b8c9d0\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/templates/6650a1b2c3d4e5f6a7b8c9d0\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/templates/6650a1b2c3d4e5f6a7b8c9d0\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/broadcasts": {
      "get": {
        "summary": "List broadcasts",
        "tags": [
          "Public API - Broadcasts"
        ],
        "description": "Returns a paginated, filterable, sortable list of broadcasts for the authenticated tenant.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1,
              "example": 1
            },
            "in": "query",
            "name": "page",
            "required": false
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25,
              "example": 25
            },
            "in": "query",
            "name": "limit",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "name",
                "status",
                "createdAt",
                "updatedAt"
              ],
              "default": "updatedAt"
            },
            "in": "query",
            "name": "sort",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "desc"
            },
            "in": "query",
            "name": "order",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "DRAFT",
                "SCHEDULED",
                "RUNNING",
                "PAUSED",
                "COMPLETED",
                "CANCELLED",
                "FAILED"
              ],
              "example": "DRAFT"
            },
            "in": "query",
            "name": "status",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "promo"
            },
            "in": "query",
            "name": "search",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "662fa1b2c3d4e5f6a7b8c9d0"
            },
            "in": "query",
            "name": "channelId",
            "required": false,
            "description": "WhatsApp channel to send from. Copy it from Settings → Developer → Channels in the inaiy app."
          },
          {
            "schema": {
              "type": "string",
              "example": "6650a1b2c3d4e5f6a7b8c9d1"
            },
            "in": "query",
            "name": "templateId",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "key_01H..."
            },
            "in": "query",
            "name": "createdBy",
            "required": false
          },
          {
            "schema": {
              "type": "boolean",
              "example": false
            },
            "in": "query",
            "name": "isArchived",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "in": "query",
            "name": "createdAfter",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "in": "query",
            "name": "createdBefore",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "id,name,status,stats"
            },
            "in": "query",
            "name": "fields",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of broadcasts",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Paginated list of broadcasts",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true,
                        "properties": {
                          "id": {
                            "type": "string",
                            "example": "6650a1b2c3d4e5f6a7b8c9d0"
                          },
                          "name": {
                            "type": "string",
                            "example": "July promo blast"
                          },
                          "description": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "Summer sale announcement"
                          },
                          "status": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "enum": [
                              "DRAFT",
                              "SCHEDULED",
                              "RUNNING",
                              "PAUSED",
                              "COMPLETED",
                              "CANCELLED",
                              "FAILED",
                              null
                            ],
                            "example": "DRAFT"
                          },
                          "templateId": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "6650a1b2c3d4e5f6a7b8c9d1"
                          },
                          "composition": {
                            "type": [
                              "null",
                              "object"
                            ],
                            "additionalProperties": true,
                            "properties": {
                              "templateId": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "parameters": {
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "additionalProperties": true
                              }
                            }
                          },
                          "audience": {
                            "type": [
                              "null",
                              "object"
                            ],
                            "additionalProperties": true,
                            "properties": {
                              "type": {
                                "type": [
                                  "null",
                                  "string"
                                ],
                                "enum": [
                                  "MANUAL",
                                  "ALL",
                                  "SEGMENT",
                                  null
                                ],
                                "example": "MANUAL"
                              },
                              "selection": {
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "additionalProperties": true,
                                "properties": {
                                  "contactIds": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "includeTags": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "excludeContactIds": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "excludeTags": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  }
                                }
                              },
                              "counts": {
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "additionalProperties": true
                              },
                              "validation": {
                                "type": [
                                  "null",
                                  "object"
                                ],
                                "additionalProperties": true
                              }
                            }
                          },
                          "schedule": {
                            "type": [
                              "null",
                              "object"
                            ],
                            "additionalProperties": true
                          },
                          "stats": {
                            "type": [
                              "null",
                              "object"
                            ],
                            "additionalProperties": true
                          },
                          "progress": {
                            "type": [
                              "null",
                              "object"
                            ],
                            "additionalProperties": true
                          },
                          "execution": {
                            "type": [
                              "null",
                              "object"
                            ],
                            "additionalProperties": true,
                            "properties": {
                              "executionId": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "status": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "mode": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "startedAt": {
                                "type": [
                                  "null",
                                  "string"
                                ],
                                "format": "date-time"
                              },
                              "completedAt": {
                                "type": [
                                  "null",
                                  "string"
                                ],
                                "format": "date-time"
                              },
                              "cancelledAt": {
                                "type": [
                                  "null",
                                  "string"
                                ],
                                "format": "date-time"
                              },
                              "failureReason": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              }
                            }
                          },
                          "monitoring": {
                            "type": [
                              "null",
                              "object"
                            ],
                            "additionalProperties": true
                          },
                          "isArchived": {
                            "type": "boolean",
                            "example": false
                          },
                          "createdAt": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "format": "date-time"
                          },
                          "updatedAt": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "page": {
                          "type": "integer",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "example": 12
                        },
                        "totalPages": {
                          "type": "integer",
                          "example": 1
                        },
                        "hasNextPage": {
                          "type": "boolean",
                          "example": false
                        },
                        "hasPrevPage": {
                          "type": "boolean",
                          "example": false
                        },
                        "nextCursor": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": null
                        },
                        "prevCursor": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": null
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "example": {
                    "success": true,
                    "data": [
                      {
                        "id": "6650a1b2c3d4e5f6a7b8c9d0",
                        "name": "July promo blast",
                        "description": "Summer sale announcement",
                        "status": "DRAFT",
                        "templateId": "6650a1b2c3d4e5f6a7b8c9d1",
                        "composition": {
                          "templateId": "6650a1b2c3d4e5f6a7b8c9d1",
                          "parameters": {
                            "body": [
                              "Jane"
                            ]
                          }
                        },
                        "audience": {
                          "type": "MANUAL",
                          "selection": {
                            "contactIds": [
                              "663fa1b2c3d4e5f6a7b8c9d0"
                            ],
                            "includeTags": [
                              "vip"
                            ],
                            "excludeContactIds": [],
                            "excludeTags": []
                          },
                          "counts": {
                            "estimated": 240,
                            "resolved": 240,
                            "lastEstimatedAt": "2026-07-12T09:00:00.000Z",
                            "lastResolvedAt": "2026-07-12T09:00:00.000Z"
                          },
                          "validation": {
                            "isValid": true,
                            "issues": [],
                            "lastValidatedAt": "2026-07-12T09:00:00.000Z"
                          }
                        },
                        "schedule": null,
                        "stats": {
                          "total": 240,
                          "pending": 240,
                          "queued": 0,
                          "processing": 0,
                          "completed": 0,
                          "failed": 0,
                          "cancelled": 0,
                          "skipped": 0
                        },
                        "progress": {
                          "processed": 0,
                          "total": 240,
                          "percent": 0
                        },
                        "execution": null,
                        "monitoring": null,
                        "isArchived": false,
                        "createdAt": "2026-07-12T09:00:00.000Z",
                        "updatedAt": "2026-07-12T09:00:00.000Z"
                      }
                    ],
                    "pagination": {
                      "page": 1,
                      "limit": 25,
                      "total": 12,
                      "totalPages": 1,
                      "hasNextPage": false,
                      "hasPrevPage": false,
                      "nextCursor": null,
                      "prevCursor": null
                    },
                    "meta": {
                      "apiVersion": "v1",
                      "sort": {
                        "field": "updatedAt",
                        "order": "desc"
                      }
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z"
                  }
                },
                "example": {
                  "success": true,
                  "data": [
                    {
                      "id": "6650a1b2c3d4e5f6a7b8c9d0",
                      "name": "July promo blast",
                      "description": "Summer sale announcement",
                      "status": "DRAFT",
                      "templateId": "6650a1b2c3d4e5f6a7b8c9d1",
                      "composition": {
                        "templateId": "6650a1b2c3d4e5f6a7b8c9d1",
                        "parameters": {
                          "body": [
                            "Jane"
                          ]
                        }
                      },
                      "audience": {
                        "type": "MANUAL",
                        "selection": {
                          "contactIds": [
                            "663fa1b2c3d4e5f6a7b8c9d0"
                          ],
                          "includeTags": [
                            "vip"
                          ],
                          "excludeContactIds": [],
                          "excludeTags": []
                        },
                        "counts": {
                          "estimated": 240,
                          "resolved": 240,
                          "lastEstimatedAt": "2026-07-12T09:00:00.000Z",
                          "lastResolvedAt": "2026-07-12T09:00:00.000Z"
                        },
                        "validation": {
                          "isValid": true,
                          "issues": [],
                          "lastValidatedAt": "2026-07-12T09:00:00.000Z"
                        }
                      },
                      "schedule": null,
                      "stats": {
                        "total": 240,
                        "pending": 240,
                        "queued": 0,
                        "processing": 0,
                        "completed": 0,
                        "failed": 0,
                        "cancelled": 0,
                        "skipped": 0
                      },
                      "progress": {
                        "processed": 0,
                        "total": 240,
                        "percent": 0
                      },
                      "execution": null,
                      "monitoring": null,
                      "isArchived": false,
                      "createdAt": "2026-07-12T09:00:00.000Z",
                      "updatedAt": "2026-07-12T09:00:00.000Z"
                    }
                  ],
                  "pagination": {
                    "page": 1,
                    "limit": 25,
                    "total": 12,
                    "totalPages": 1,
                    "hasNextPage": false,
                    "hasPrevPage": false,
                    "nextCursor": null,
                    "prevCursor": null
                  },
                  "meta": {
                    "apiVersion": "v1",
                    "sort": {
                      "field": "updatedAt",
                      "order": "desc"
                    }
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "ACCOUNT_CONFIGURATION_ERROR",
                      "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "ACCOUNT_CONFIGURATION_ERROR",
                    "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "API_KEY_INVALID",
                      "message": "Invalid API key.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "API_KEY_INVALID",
                    "message": "Invalid API key.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DEVELOPER_PLATFORM_DISABLED",
                      "message": "Developer platform is disabled for this organization.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DEVELOPER_PLATFORM_DISABLED",
                    "message": "Developer platform is disabled for this organization.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed (invalid body, empty/segment audience, missing template, no connected channel)",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed (invalid body, empty/segment audience, missing template, no connected channel)",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "VALIDATION_ERROR",
                      "message": "Validation failed",
                      "details": {
                        "issues": [
                          {
                            "path": [
                              "name"
                            ],
                            "message": "Broadcast name is required."
                          }
                        ]
                      }
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "VALIDATION_ERROR",
                    "message": "Validation failed",
                    "details": {
                      "issues": [
                        {
                          "path": [
                            "name"
                          ],
                          "message": "Broadcast name is required."
                        }
                      ]
                    }
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests - rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests - rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Too many requests. Please retry later.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RATE_LIMIT_EXCEEDED",
                    "message": "Too many requests. Please retry later.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "INTERNAL_SERVER_ERROR",
                      "message": "Internal server error",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "message": "Internal server error",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/broadcasts\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/broadcasts\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/broadcasts\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/broadcasts\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/broadcasts\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/broadcasts\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/broadcasts\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      },
      "post": {
        "summary": "Create a broadcast",
        "tags": [
          "Public API - Broadcasts"
        ],
        "description": "Creates a broadcast (composite). Returns 201 for a draft or 202 Accepted when queued/scheduled.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "additionalProperties": true,
                "description": "Create a broadcast. Composite one-call: creates a DRAFT, optionally sets template and audience, and optionally executes now (sendImmediately) or schedules it. Returns 201 for a draft, or 202 Accepted when queued/scheduled. sendImmediately and schedule are mutually exclusive and both require template + audience.",
                "properties": {
                  "name": {
                    "type": "string",
                    "example": "July promo blast"
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "example": "Summer sale announcement"
                  },
                  "template": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Provide either templateId, or name + language.",
                    "properties": {
                      "templateId": {
                        "type": "string",
                        "example": "6650a1b2c3d4e5f6a7b8c9d1"
                      },
                      "name": {
                        "type": "string",
                        "example": "order_update"
                      },
                      "language": {
                        "type": "string",
                        "example": "en_US"
                      },
                      "variables": {
                        "type": "object",
                        "additionalProperties": true,
                        "description": "Alias of parameters."
                      },
                      "parameters": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  },
                  "audience": {
                    "type": "object",
                    "required": [
                      "type"
                    ],
                    "additionalProperties": true,
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "MANUAL",
                          "ALL",
                          "SEGMENT"
                        ],
                        "example": "MANUAL"
                      },
                      "contactIds": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "example": [
                          "663fa1b2c3d4e5f6a7b8c9d0"
                        ]
                      },
                      "includeTags": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "example": [
                          "vip"
                        ]
                      },
                      "excludeContactIds": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "excludeTags": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "sendImmediately": {
                    "type": "boolean",
                    "example": false
                  },
                  "schedule": {
                    "type": "object",
                    "properties": {
                      "scheduledAt": {
                        "type": "string",
                        "example": "2026-07-15T10:00:00"
                      }
                    }
                  }
                }
              },
              "examples": {
                "example1": {
                  "value": {
                    "name": "July promo blast",
                    "description": "Summer sale",
                    "template": {
                      "templateId": "6650a1b2c3d4e5f6a7b8c9d1",
                      "parameters": {
                        "body": [
                          "Jane"
                        ]
                      }
                    },
                    "audience": {
                      "type": "ALL"
                    }
                  }
                },
                "example2": {
                  "value": {
                    "name": "Scheduled reminder",
                    "template": {
                      "name": "order_update",
                      "language": "en_US",
                      "parameters": {
                        "body": [
                          "Jane"
                        ]
                      }
                    },
                    "audience": {
                      "type": "MANUAL",
                      "includeTags": [
                        "vip"
                      ]
                    },
                    "schedule": {
                      "scheduledAt": "2026-07-15T10:00:00"
                    }
                  }
                }
              }
            }
          },
          "required": true,
          "description": "Create a broadcast. Composite one-call: creates a DRAFT, optionally sets template and audience, and optionally executes now (sendImmediately) or schedules it. Returns 201 for a draft, or 202 Accepted when queued/scheduled. sendImmediately and schedule are mutually exclusive and both require template + audience."
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "201": {
            "description": "Draft broadcast created",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Draft broadcast created",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "id": {
                          "type": "string",
                          "example": "6650a1b2c3d4e5f6a7b8c9d0"
                        },
                        "name": {
                          "type": "string",
                          "example": "July promo blast"
                        },
                        "description": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "Summer sale announcement"
                        },
                        "status": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "enum": [
                            "DRAFT",
                            "SCHEDULED",
                            "RUNNING",
                            "PAUSED",
                            "COMPLETED",
                            "CANCELLED",
                            "FAILED",
                            null
                          ],
                          "example": "DRAFT"
                        },
                        "templateId": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "6650a1b2c3d4e5f6a7b8c9d1"
                        },
                        "composition": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true,
                          "properties": {
                            "templateId": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "parameters": {
                              "type": [
                                "null",
                                "object"
                              ],
                              "additionalProperties": true
                            }
                          }
                        },
                        "audience": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true,
                          "properties": {
                            "type": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "enum": [
                                "MANUAL",
                                "ALL",
                                "SEGMENT",
                                null
                              ],
                              "example": "MANUAL"
                            },
                            "selection": {
                              "type": [
                                "null",
                                "object"
                              ],
                              "additionalProperties": true,
                              "properties": {
                                "contactIds": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "includeTags": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "excludeContactIds": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "excludeTags": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                }
                              }
                            },
                            "counts": {
                              "type": [
                                "null",
                                "object"
                              ],
                              "additionalProperties": true
                            },
                            "validation": {
                              "type": [
                                "null",
                                "object"
                              ],
                              "additionalProperties": true
                            }
                          }
                        },
                        "schedule": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "stats": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "progress": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "execution": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true,
                          "properties": {
                            "executionId": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "status": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "mode": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "startedAt": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "format": "date-time"
                            },
                            "completedAt": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "format": "date-time"
                            },
                            "cancelledAt": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "format": "date-time"
                            },
                            "failureReason": {
                              "type": [
                                "null",
                                "string"
                              ]
                            }
                          }
                        },
                        "monitoring": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "isArchived": {
                          "type": "boolean",
                          "example": false
                        },
                        "createdAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "example": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11"
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "example": {
                    "success": true,
                    "data": {
                      "id": "6650a1b2c3d4e5f6a7b8c9d0",
                      "name": "July promo blast",
                      "description": "Summer sale announcement",
                      "status": "DRAFT",
                      "templateId": "6650a1b2c3d4e5f6a7b8c9d1",
                      "composition": {
                        "templateId": "6650a1b2c3d4e5f6a7b8c9d1",
                        "parameters": {
                          "body": [
                            "Jane"
                          ]
                        }
                      },
                      "audience": {
                        "type": "MANUAL",
                        "selection": {
                          "contactIds": [
                            "663fa1b2c3d4e5f6a7b8c9d0"
                          ],
                          "includeTags": [
                            "vip"
                          ],
                          "excludeContactIds": [],
                          "excludeTags": []
                        },
                        "counts": {
                          "estimated": 240,
                          "resolved": 240,
                          "lastEstimatedAt": "2026-07-12T09:00:00.000Z",
                          "lastResolvedAt": "2026-07-12T09:00:00.000Z"
                        },
                        "validation": {
                          "isValid": true,
                          "issues": [],
                          "lastValidatedAt": "2026-07-12T09:00:00.000Z"
                        }
                      },
                      "schedule": null,
                      "stats": {
                        "total": 240,
                        "pending": 240,
                        "queued": 0,
                        "processing": 0,
                        "completed": 0,
                        "failed": 0,
                        "cancelled": 0,
                        "skipped": 0
                      },
                      "progress": {
                        "processed": 0,
                        "total": 240,
                        "percent": 0
                      },
                      "execution": null,
                      "monitoring": null,
                      "isArchived": false,
                      "createdAt": "2026-07-12T09:00:00.000Z",
                      "updatedAt": "2026-07-12T09:00:00.000Z"
                    },
                    "meta": {
                      "apiVersion": "v1"
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z"
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "6650a1b2c3d4e5f6a7b8c9d0",
                    "name": "July promo blast",
                    "description": "Summer sale announcement",
                    "status": "DRAFT",
                    "templateId": "6650a1b2c3d4e5f6a7b8c9d1",
                    "composition": {
                      "templateId": "6650a1b2c3d4e5f6a7b8c9d1",
                      "parameters": {
                        "body": [
                          "Jane"
                        ]
                      }
                    },
                    "audience": {
                      "type": "MANUAL",
                      "selection": {
                        "contactIds": [
                          "663fa1b2c3d4e5f6a7b8c9d0"
                        ],
                        "includeTags": [
                          "vip"
                        ],
                        "excludeContactIds": [],
                        "excludeTags": []
                      },
                      "counts": {
                        "estimated": 240,
                        "resolved": 240,
                        "lastEstimatedAt": "2026-07-12T09:00:00.000Z",
                        "lastResolvedAt": "2026-07-12T09:00:00.000Z"
                      },
                      "validation": {
                        "isValid": true,
                        "issues": [],
                        "lastValidatedAt": "2026-07-12T09:00:00.000Z"
                      }
                    },
                    "schedule": null,
                    "stats": {
                      "total": 240,
                      "pending": 240,
                      "queued": 0,
                      "processing": 0,
                      "completed": 0,
                      "failed": 0,
                      "cancelled": 0,
                      "skipped": 0
                    },
                    "progress": {
                      "processed": 0,
                      "total": 240,
                      "percent": 0
                    },
                    "execution": null,
                    "monitoring": null,
                    "isArchived": false,
                    "createdAt": "2026-07-12T09:00:00.000Z",
                    "updatedAt": "2026-07-12T09:00:00.000Z"
                  },
                  "meta": {
                    "apiVersion": "v1"
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z"
                }
              }
            }
          },
          "202": {
            "description": "Broadcast queued or scheduled",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Broadcast queued or scheduled",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "broadcastId": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "6650a1b2c3d4e5f6a7b8c9d0"
                        },
                        "status": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "RUNNING"
                        },
                        "execution": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "schedule": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "progress": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "stats": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "estimatedRecipients": {
                          "type": "integer",
                          "example": 240
                        },
                        "timezone": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "Asia/Kolkata"
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "example": {
                    "success": true,
                    "data": {
                      "broadcastId": "6650a1b2c3d4e5f6a7b8c9d0",
                      "status": "RUNNING",
                      "execution": {
                        "executionId": "exec_9f8e7d",
                        "status": "queued",
                        "mode": "immediate",
                        "startedAt": "2026-07-12T09:05:00.000Z",
                        "completedAt": null,
                        "cancelledAt": null,
                        "failureReason": null
                      },
                      "schedule": null,
                      "progress": {
                        "processed": 0,
                        "total": 240,
                        "percent": 0
                      },
                      "stats": {
                        "total": 240,
                        "pending": 240,
                        "queued": 0,
                        "processing": 0,
                        "completed": 0,
                        "failed": 0,
                        "cancelled": 0,
                        "skipped": 0
                      },
                      "estimatedRecipients": 240,
                      "timezone": "Asia/Kolkata"
                    },
                    "meta": {
                      "apiVersion": "v1",
                      "queued": true
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:05:00.000Z"
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "broadcastId": "6650a1b2c3d4e5f6a7b8c9d0",
                    "status": "RUNNING",
                    "execution": {
                      "executionId": "exec_9f8e7d",
                      "status": "queued",
                      "mode": "immediate",
                      "startedAt": "2026-07-12T09:05:00.000Z",
                      "completedAt": null,
                      "cancelledAt": null,
                      "failureReason": null
                    },
                    "schedule": null,
                    "progress": {
                      "processed": 0,
                      "total": 240,
                      "percent": 0
                    },
                    "stats": {
                      "total": 240,
                      "pending": 240,
                      "queued": 0,
                      "processing": 0,
                      "completed": 0,
                      "failed": 0,
                      "cancelled": 0,
                      "skipped": 0
                    },
                    "estimatedRecipients": 240,
                    "timezone": "Asia/Kolkata"
                  },
                  "meta": {
                    "apiVersion": "v1",
                    "queued": true
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:05:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "ACCOUNT_CONFIGURATION_ERROR",
                      "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "ACCOUNT_CONFIGURATION_ERROR",
                    "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "API_KEY_INVALID",
                      "message": "Invalid API key.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "API_KEY_INVALID",
                    "message": "Invalid API key.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DEVELOPER_PLATFORM_DISABLED",
                      "message": "Developer platform is disabled for this organization.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DEVELOPER_PLATFORM_DISABLED",
                    "message": "Developer platform is disabled for this organization.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "404": {
            "description": "Broadcast or template not found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Broadcast or template not found",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "CAMPAIGN_NOT_FOUND",
                      "message": "Campaign not found.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "CAMPAIGN_NOT_FOUND",
                    "message": "Campaign not found.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "409": {
            "description": "Conflicting state (not editable, cancel not allowed, already running)",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Conflicting state (not editable, cancel not allowed, already running)",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "CAMPAIGN_NOT_EDITABLE",
                      "message": "Only draft broadcasts can be modified.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "CAMPAIGN_NOT_EDITABLE",
                    "message": "Only draft broadcasts can be modified.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed (invalid body, empty/segment audience, missing template, no connected channel)",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed (invalid body, empty/segment audience, missing template, no connected channel)",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "VALIDATION_ERROR",
                      "message": "Validation failed",
                      "details": {
                        "issues": [
                          {
                            "path": [
                              "name"
                            ],
                            "message": "Broadcast name is required."
                          }
                        ]
                      }
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "VALIDATION_ERROR",
                    "message": "Validation failed",
                    "details": {
                      "issues": [
                        {
                          "path": [
                            "name"
                          ],
                          "message": "Broadcast name is required."
                        }
                      ]
                    }
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests - rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests - rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Too many requests. Please retry later.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RATE_LIMIT_EXCEEDED",
                    "message": "Too many requests. Please retry later.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "INTERNAL_SERVER_ERROR",
                      "message": "Internal server error",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "message": "Internal server error",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X POST \"https://api.inaiy.com/api/public/v1/broadcasts\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/broadcasts\", {\n  method: \"POST\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/broadcasts\", {\n    method: \"POST\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.post(\"https://api.inaiy.com/api/public/v1/broadcasts\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/broadcasts\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"POST\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/broadcasts\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"POST\"), \"https://api.inaiy.com/api/public/v1/broadcasts\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/broadcasts/{id}": {
      "get": {
        "summary": "Get a broadcast by id",
        "tags": [
          "Public API - Broadcasts"
        ],
        "description": "Fetch a single broadcast by its id.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "example": "id,name,status"
            },
            "in": "query",
            "name": "fields",
            "required": false,
            "description": "Comma-separated list of fields to return (sparse fieldset)."
          },
          {
            "schema": {
              "type": "string",
              "example": "6650a1b2c3d4e5f6a7b8c9d0"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "24-char broadcast ObjectId"
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "The broadcast",
            "content": {
              "application/json": {
                "schema": {
                  "description": "The broadcast",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "id": {
                          "type": "string",
                          "example": "6650a1b2c3d4e5f6a7b8c9d0"
                        },
                        "name": {
                          "type": "string",
                          "example": "July promo blast"
                        },
                        "description": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "Summer sale announcement"
                        },
                        "status": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "enum": [
                            "DRAFT",
                            "SCHEDULED",
                            "RUNNING",
                            "PAUSED",
                            "COMPLETED",
                            "CANCELLED",
                            "FAILED",
                            null
                          ],
                          "example": "DRAFT"
                        },
                        "templateId": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "6650a1b2c3d4e5f6a7b8c9d1"
                        },
                        "composition": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true,
                          "properties": {
                            "templateId": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "parameters": {
                              "type": [
                                "null",
                                "object"
                              ],
                              "additionalProperties": true
                            }
                          }
                        },
                        "audience": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true,
                          "properties": {
                            "type": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "enum": [
                                "MANUAL",
                                "ALL",
                                "SEGMENT",
                                null
                              ],
                              "example": "MANUAL"
                            },
                            "selection": {
                              "type": [
                                "null",
                                "object"
                              ],
                              "additionalProperties": true,
                              "properties": {
                                "contactIds": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "includeTags": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "excludeContactIds": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "excludeTags": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                }
                              }
                            },
                            "counts": {
                              "type": [
                                "null",
                                "object"
                              ],
                              "additionalProperties": true
                            },
                            "validation": {
                              "type": [
                                "null",
                                "object"
                              ],
                              "additionalProperties": true
                            }
                          }
                        },
                        "schedule": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "stats": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "progress": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "execution": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true,
                          "properties": {
                            "executionId": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "status": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "mode": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "startedAt": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "format": "date-time"
                            },
                            "completedAt": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "format": "date-time"
                            },
                            "cancelledAt": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "format": "date-time"
                            },
                            "failureReason": {
                              "type": [
                                "null",
                                "string"
                              ]
                            }
                          }
                        },
                        "monitoring": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "isArchived": {
                          "type": "boolean",
                          "example": false
                        },
                        "createdAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "example": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11"
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "example": {
                    "success": true,
                    "data": {
                      "id": "6650a1b2c3d4e5f6a7b8c9d0",
                      "name": "July promo blast",
                      "description": "Summer sale announcement",
                      "status": "DRAFT",
                      "templateId": "6650a1b2c3d4e5f6a7b8c9d1",
                      "composition": {
                        "templateId": "6650a1b2c3d4e5f6a7b8c9d1",
                        "parameters": {
                          "body": [
                            "Jane"
                          ]
                        }
                      },
                      "audience": {
                        "type": "MANUAL",
                        "selection": {
                          "contactIds": [
                            "663fa1b2c3d4e5f6a7b8c9d0"
                          ],
                          "includeTags": [
                            "vip"
                          ],
                          "excludeContactIds": [],
                          "excludeTags": []
                        },
                        "counts": {
                          "estimated": 240,
                          "resolved": 240,
                          "lastEstimatedAt": "2026-07-12T09:00:00.000Z",
                          "lastResolvedAt": "2026-07-12T09:00:00.000Z"
                        },
                        "validation": {
                          "isValid": true,
                          "issues": [],
                          "lastValidatedAt": "2026-07-12T09:00:00.000Z"
                        }
                      },
                      "schedule": null,
                      "stats": {
                        "total": 240,
                        "pending": 240,
                        "queued": 0,
                        "processing": 0,
                        "completed": 0,
                        "failed": 0,
                        "cancelled": 0,
                        "skipped": 0
                      },
                      "progress": {
                        "processed": 0,
                        "total": 240,
                        "percent": 0
                      },
                      "execution": null,
                      "monitoring": null,
                      "isArchived": false,
                      "createdAt": "2026-07-12T09:00:00.000Z",
                      "updatedAt": "2026-07-12T09:00:00.000Z"
                    },
                    "meta": {
                      "apiVersion": "v1"
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z"
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "6650a1b2c3d4e5f6a7b8c9d0",
                    "name": "July promo blast",
                    "description": "Summer sale announcement",
                    "status": "DRAFT",
                    "templateId": "6650a1b2c3d4e5f6a7b8c9d1",
                    "composition": {
                      "templateId": "6650a1b2c3d4e5f6a7b8c9d1",
                      "parameters": {
                        "body": [
                          "Jane"
                        ]
                      }
                    },
                    "audience": {
                      "type": "MANUAL",
                      "selection": {
                        "contactIds": [
                          "663fa1b2c3d4e5f6a7b8c9d0"
                        ],
                        "includeTags": [
                          "vip"
                        ],
                        "excludeContactIds": [],
                        "excludeTags": []
                      },
                      "counts": {
                        "estimated": 240,
                        "resolved": 240,
                        "lastEstimatedAt": "2026-07-12T09:00:00.000Z",
                        "lastResolvedAt": "2026-07-12T09:00:00.000Z"
                      },
                      "validation": {
                        "isValid": true,
                        "issues": [],
                        "lastValidatedAt": "2026-07-12T09:00:00.000Z"
                      }
                    },
                    "schedule": null,
                    "stats": {
                      "total": 240,
                      "pending": 240,
                      "queued": 0,
                      "processing": 0,
                      "completed": 0,
                      "failed": 0,
                      "cancelled": 0,
                      "skipped": 0
                    },
                    "progress": {
                      "processed": 0,
                      "total": 240,
                      "percent": 0
                    },
                    "execution": null,
                    "monitoring": null,
                    "isArchived": false,
                    "createdAt": "2026-07-12T09:00:00.000Z",
                    "updatedAt": "2026-07-12T09:00:00.000Z"
                  },
                  "meta": {
                    "apiVersion": "v1"
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "ACCOUNT_CONFIGURATION_ERROR",
                      "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "ACCOUNT_CONFIGURATION_ERROR",
                    "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "API_KEY_INVALID",
                      "message": "Invalid API key.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "API_KEY_INVALID",
                    "message": "Invalid API key.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DEVELOPER_PLATFORM_DISABLED",
                      "message": "Developer platform is disabled for this organization.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DEVELOPER_PLATFORM_DISABLED",
                    "message": "Developer platform is disabled for this organization.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "404": {
            "description": "Broadcast or template not found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Broadcast or template not found",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "CAMPAIGN_NOT_FOUND",
                      "message": "Campaign not found.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "CAMPAIGN_NOT_FOUND",
                    "message": "Campaign not found.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests - rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests - rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Too many requests. Please retry later.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RATE_LIMIT_EXCEEDED",
                    "message": "Too many requests. Please retry later.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "INTERNAL_SERVER_ERROR",
                      "message": "Internal server error",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "message": "Internal server error",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      },
      "patch": {
        "summary": "Update a broadcast",
        "tags": [
          "Public API - Broadcasts"
        ],
        "description": "Update a DRAFT broadcast (name/description/template/audience).",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "description": "Update a DRAFT broadcast. At least one field is required.",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "template": {
                    "type": "object",
                    "additionalProperties": true,
                    "description": "Provide either templateId, or name + language.",
                    "properties": {
                      "templateId": {
                        "type": "string",
                        "example": "6650a1b2c3d4e5f6a7b8c9d1"
                      },
                      "name": {
                        "type": "string",
                        "example": "order_update"
                      },
                      "language": {
                        "type": "string",
                        "example": "en_US"
                      },
                      "variables": {
                        "type": "object",
                        "additionalProperties": true,
                        "description": "Alias of parameters."
                      },
                      "parameters": {
                        "type": "object",
                        "additionalProperties": true
                      }
                    }
                  },
                  "audience": {
                    "type": "object",
                    "required": [
                      "type"
                    ],
                    "additionalProperties": true,
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "MANUAL",
                          "ALL",
                          "SEGMENT"
                        ],
                        "example": "MANUAL"
                      },
                      "contactIds": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "example": [
                          "663fa1b2c3d4e5f6a7b8c9d0"
                        ]
                      },
                      "includeTags": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        },
                        "example": [
                          "vip"
                        ]
                      },
                      "excludeContactIds": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "excludeTags": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "description": "Update a DRAFT broadcast. At least one field is required."
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "example": "6650a1b2c3d4e5f6a7b8c9d0"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "24-char broadcast ObjectId"
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "The updated broadcast",
            "content": {
              "application/json": {
                "schema": {
                  "description": "The updated broadcast",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "id": {
                          "type": "string",
                          "example": "6650a1b2c3d4e5f6a7b8c9d0"
                        },
                        "name": {
                          "type": "string",
                          "example": "July promo blast"
                        },
                        "description": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "Summer sale announcement"
                        },
                        "status": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "enum": [
                            "DRAFT",
                            "SCHEDULED",
                            "RUNNING",
                            "PAUSED",
                            "COMPLETED",
                            "CANCELLED",
                            "FAILED",
                            null
                          ],
                          "example": "DRAFT"
                        },
                        "templateId": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "6650a1b2c3d4e5f6a7b8c9d1"
                        },
                        "composition": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true,
                          "properties": {
                            "templateId": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "parameters": {
                              "type": [
                                "null",
                                "object"
                              ],
                              "additionalProperties": true
                            }
                          }
                        },
                        "audience": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true,
                          "properties": {
                            "type": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "enum": [
                                "MANUAL",
                                "ALL",
                                "SEGMENT",
                                null
                              ],
                              "example": "MANUAL"
                            },
                            "selection": {
                              "type": [
                                "null",
                                "object"
                              ],
                              "additionalProperties": true,
                              "properties": {
                                "contactIds": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "includeTags": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "excludeContactIds": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "excludeTags": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                }
                              }
                            },
                            "counts": {
                              "type": [
                                "null",
                                "object"
                              ],
                              "additionalProperties": true
                            },
                            "validation": {
                              "type": [
                                "null",
                                "object"
                              ],
                              "additionalProperties": true
                            }
                          }
                        },
                        "schedule": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "stats": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "progress": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "execution": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true,
                          "properties": {
                            "executionId": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "status": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "mode": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "startedAt": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "format": "date-time"
                            },
                            "completedAt": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "format": "date-time"
                            },
                            "cancelledAt": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "format": "date-time"
                            },
                            "failureReason": {
                              "type": [
                                "null",
                                "string"
                              ]
                            }
                          }
                        },
                        "monitoring": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "isArchived": {
                          "type": "boolean",
                          "example": false
                        },
                        "createdAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ],
                      "example": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11"
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "example": {
                    "success": true,
                    "data": {
                      "id": "6650a1b2c3d4e5f6a7b8c9d0",
                      "name": "July promo blast",
                      "description": "Summer sale announcement",
                      "status": "DRAFT",
                      "templateId": "6650a1b2c3d4e5f6a7b8c9d1",
                      "composition": {
                        "templateId": "6650a1b2c3d4e5f6a7b8c9d1",
                        "parameters": {
                          "body": [
                            "Jane"
                          ]
                        }
                      },
                      "audience": {
                        "type": "MANUAL",
                        "selection": {
                          "contactIds": [
                            "663fa1b2c3d4e5f6a7b8c9d0"
                          ],
                          "includeTags": [
                            "vip"
                          ],
                          "excludeContactIds": [],
                          "excludeTags": []
                        },
                        "counts": {
                          "estimated": 240,
                          "resolved": 240,
                          "lastEstimatedAt": "2026-07-12T09:00:00.000Z",
                          "lastResolvedAt": "2026-07-12T09:00:00.000Z"
                        },
                        "validation": {
                          "isValid": true,
                          "issues": [],
                          "lastValidatedAt": "2026-07-12T09:00:00.000Z"
                        }
                      },
                      "schedule": null,
                      "stats": {
                        "total": 240,
                        "pending": 240,
                        "queued": 0,
                        "processing": 0,
                        "completed": 0,
                        "failed": 0,
                        "cancelled": 0,
                        "skipped": 0
                      },
                      "progress": {
                        "processed": 0,
                        "total": 240,
                        "percent": 0
                      },
                      "execution": null,
                      "monitoring": null,
                      "isArchived": false,
                      "createdAt": "2026-07-12T09:00:00.000Z",
                      "updatedAt": "2026-07-12T09:00:00.000Z"
                    },
                    "meta": {
                      "apiVersion": "v1"
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z"
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "id": "6650a1b2c3d4e5f6a7b8c9d0",
                    "name": "July promo blast",
                    "description": "Summer sale announcement",
                    "status": "DRAFT",
                    "templateId": "6650a1b2c3d4e5f6a7b8c9d1",
                    "composition": {
                      "templateId": "6650a1b2c3d4e5f6a7b8c9d1",
                      "parameters": {
                        "body": [
                          "Jane"
                        ]
                      }
                    },
                    "audience": {
                      "type": "MANUAL",
                      "selection": {
                        "contactIds": [
                          "663fa1b2c3d4e5f6a7b8c9d0"
                        ],
                        "includeTags": [
                          "vip"
                        ],
                        "excludeContactIds": [],
                        "excludeTags": []
                      },
                      "counts": {
                        "estimated": 240,
                        "resolved": 240,
                        "lastEstimatedAt": "2026-07-12T09:00:00.000Z",
                        "lastResolvedAt": "2026-07-12T09:00:00.000Z"
                      },
                      "validation": {
                        "isValid": true,
                        "issues": [],
                        "lastValidatedAt": "2026-07-12T09:00:00.000Z"
                      }
                    },
                    "schedule": null,
                    "stats": {
                      "total": 240,
                      "pending": 240,
                      "queued": 0,
                      "processing": 0,
                      "completed": 0,
                      "failed": 0,
                      "cancelled": 0,
                      "skipped": 0
                    },
                    "progress": {
                      "processed": 0,
                      "total": 240,
                      "percent": 0
                    },
                    "execution": null,
                    "monitoring": null,
                    "isArchived": false,
                    "createdAt": "2026-07-12T09:00:00.000Z",
                    "updatedAt": "2026-07-12T09:00:00.000Z"
                  },
                  "meta": {
                    "apiVersion": "v1"
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "ACCOUNT_CONFIGURATION_ERROR",
                      "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "ACCOUNT_CONFIGURATION_ERROR",
                    "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "API_KEY_INVALID",
                      "message": "Invalid API key.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "API_KEY_INVALID",
                    "message": "Invalid API key.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DEVELOPER_PLATFORM_DISABLED",
                      "message": "Developer platform is disabled for this organization.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DEVELOPER_PLATFORM_DISABLED",
                    "message": "Developer platform is disabled for this organization.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "404": {
            "description": "Broadcast or template not found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Broadcast or template not found",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "CAMPAIGN_NOT_FOUND",
                      "message": "Campaign not found.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "CAMPAIGN_NOT_FOUND",
                    "message": "Campaign not found.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "409": {
            "description": "Conflicting state (not editable, cancel not allowed, already running)",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Conflicting state (not editable, cancel not allowed, already running)",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "CAMPAIGN_NOT_EDITABLE",
                      "message": "Only draft broadcasts can be modified.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "CAMPAIGN_NOT_EDITABLE",
                    "message": "Only draft broadcasts can be modified.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed (invalid body, empty/segment audience, missing template, no connected channel)",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed (invalid body, empty/segment audience, missing template, no connected channel)",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "VALIDATION_ERROR",
                      "message": "Validation failed",
                      "details": {
                        "issues": [
                          {
                            "path": [
                              "name"
                            ],
                            "message": "Broadcast name is required."
                          }
                        ]
                      }
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "VALIDATION_ERROR",
                    "message": "Validation failed",
                    "details": {
                      "issues": [
                        {
                          "path": [
                            "name"
                          ],
                          "message": "Broadcast name is required."
                        }
                      ]
                    }
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests - rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests - rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Too many requests. Please retry later.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RATE_LIMIT_EXCEEDED",
                    "message": "Too many requests. Please retry later.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "INTERNAL_SERVER_ERROR",
                      "message": "Internal server error",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "message": "Internal server error",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X PATCH \"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0\", {\n  method: \"PATCH\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0\", {\n    method: \"PATCH\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.patch(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"PATCH\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"PATCH\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"PATCH\"), \"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      },
      "delete": {
        "summary": "Delete a broadcast",
        "tags": [
          "Public API - Broadcasts"
        ],
        "description": "Soft-delete a DRAFT broadcast. Returns 204 No Content.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "example": "6650a1b2c3d4e5f6a7b8c9d0"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "24-char broadcast ObjectId"
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "204": {
            "description": "Broadcast deleted"
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "ACCOUNT_CONFIGURATION_ERROR",
                      "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "ACCOUNT_CONFIGURATION_ERROR",
                    "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "API_KEY_INVALID",
                      "message": "Invalid API key.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "API_KEY_INVALID",
                    "message": "Invalid API key.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DEVELOPER_PLATFORM_DISABLED",
                      "message": "Developer platform is disabled for this organization.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DEVELOPER_PLATFORM_DISABLED",
                    "message": "Developer platform is disabled for this organization.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "404": {
            "description": "Broadcast or template not found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Broadcast or template not found",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "CAMPAIGN_NOT_FOUND",
                      "message": "Campaign not found.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "CAMPAIGN_NOT_FOUND",
                    "message": "Campaign not found.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "409": {
            "description": "Conflicting state (not editable, cancel not allowed, already running)",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Conflicting state (not editable, cancel not allowed, already running)",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "CAMPAIGN_NOT_EDITABLE",
                      "message": "Only draft broadcasts can be modified.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "CAMPAIGN_NOT_EDITABLE",
                    "message": "Only draft broadcasts can be modified.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests - rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests - rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Too many requests. Please retry later.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RATE_LIMIT_EXCEEDED",
                    "message": "Too many requests. Please retry later.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "INTERNAL_SERVER_ERROR",
                      "message": "Internal server error",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "message": "Internal server error",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X DELETE \"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0\", {\n  method: \"DELETE\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0\", {\n    method: \"DELETE\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.delete(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"DELETE\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"DELETE\"), \"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/broadcasts/{id}/execute": {
      "post": {
        "summary": "Execute a broadcast now",
        "tags": [
          "Public API - Broadcasts"
        ],
        "description": "Queues a DRAFT broadcast for immediate asynchronous execution. Returns 202 Accepted. Execution never bypasses the queue.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "example": "6650a1b2c3d4e5f6a7b8c9d0"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "24-char broadcast ObjectId"
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "202": {
            "description": "Broadcast queued for execution",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Broadcast queued for execution",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "broadcastId": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "6650a1b2c3d4e5f6a7b8c9d0"
                        },
                        "status": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "RUNNING"
                        },
                        "execution": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "schedule": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "progress": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "stats": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "estimatedRecipients": {
                          "type": "integer",
                          "example": 240
                        },
                        "timezone": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "Asia/Kolkata"
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "example": {
                    "success": true,
                    "data": {
                      "broadcastId": "6650a1b2c3d4e5f6a7b8c9d0",
                      "status": "RUNNING",
                      "execution": {
                        "executionId": "exec_9f8e7d",
                        "status": "queued",
                        "mode": "immediate",
                        "startedAt": "2026-07-12T09:05:00.000Z",
                        "completedAt": null,
                        "cancelledAt": null,
                        "failureReason": null
                      },
                      "schedule": null,
                      "progress": {
                        "processed": 0,
                        "total": 240,
                        "percent": 0
                      },
                      "stats": {
                        "total": 240,
                        "pending": 240,
                        "queued": 0,
                        "processing": 0,
                        "completed": 0,
                        "failed": 0,
                        "cancelled": 0,
                        "skipped": 0
                      },
                      "estimatedRecipients": 240,
                      "timezone": "Asia/Kolkata"
                    },
                    "meta": {
                      "apiVersion": "v1",
                      "queued": true
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:05:00.000Z"
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "broadcastId": "6650a1b2c3d4e5f6a7b8c9d0",
                    "status": "RUNNING",
                    "execution": {
                      "executionId": "exec_9f8e7d",
                      "status": "queued",
                      "mode": "immediate",
                      "startedAt": "2026-07-12T09:05:00.000Z",
                      "completedAt": null,
                      "cancelledAt": null,
                      "failureReason": null
                    },
                    "schedule": null,
                    "progress": {
                      "processed": 0,
                      "total": 240,
                      "percent": 0
                    },
                    "stats": {
                      "total": 240,
                      "pending": 240,
                      "queued": 0,
                      "processing": 0,
                      "completed": 0,
                      "failed": 0,
                      "cancelled": 0,
                      "skipped": 0
                    },
                    "estimatedRecipients": 240,
                    "timezone": "Asia/Kolkata"
                  },
                  "meta": {
                    "apiVersion": "v1",
                    "queued": true
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:05:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "ACCOUNT_CONFIGURATION_ERROR",
                      "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "ACCOUNT_CONFIGURATION_ERROR",
                    "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "API_KEY_INVALID",
                      "message": "Invalid API key.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "API_KEY_INVALID",
                    "message": "Invalid API key.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DEVELOPER_PLATFORM_DISABLED",
                      "message": "Developer platform is disabled for this organization.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DEVELOPER_PLATFORM_DISABLED",
                    "message": "Developer platform is disabled for this organization.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "404": {
            "description": "Broadcast or template not found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Broadcast or template not found",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "CAMPAIGN_NOT_FOUND",
                      "message": "Campaign not found.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "CAMPAIGN_NOT_FOUND",
                    "message": "Campaign not found.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "409": {
            "description": "Conflicting state (not editable, cancel not allowed, already running)",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Conflicting state (not editable, cancel not allowed, already running)",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "CAMPAIGN_NOT_EDITABLE",
                      "message": "Only draft broadcasts can be modified.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "CAMPAIGN_NOT_EDITABLE",
                    "message": "Only draft broadcasts can be modified.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed (invalid body, empty/segment audience, missing template, no connected channel)",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed (invalid body, empty/segment audience, missing template, no connected channel)",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "VALIDATION_ERROR",
                      "message": "Validation failed",
                      "details": {
                        "issues": [
                          {
                            "path": [
                              "name"
                            ],
                            "message": "Broadcast name is required."
                          }
                        ]
                      }
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "VALIDATION_ERROR",
                    "message": "Validation failed",
                    "details": {
                      "issues": [
                        {
                          "path": [
                            "name"
                          ],
                          "message": "Broadcast name is required."
                        }
                      ]
                    }
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests - rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests - rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Too many requests. Please retry later.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RATE_LIMIT_EXCEEDED",
                    "message": "Too many requests. Please retry later.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "INTERNAL_SERVER_ERROR",
                      "message": "Internal server error",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "message": "Internal server error",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X POST \"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/execute\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/execute\", {\n  method: \"POST\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/execute\", {\n    method: \"POST\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.post(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/execute\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/execute\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"POST\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/execute\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"POST\"), \"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/execute\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/broadcasts/{id}/schedule": {
      "post": {
        "summary": "Schedule a broadcast",
        "tags": [
          "Public API - Broadcasts"
        ],
        "description": "Schedules a DRAFT broadcast for future execution. Returns 202 Accepted.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "scheduledAt"
                ],
                "properties": {
                  "scheduledAt": {
                    "type": "string",
                    "description": "Local datetime; converted to the org timezone.",
                    "example": "2026-07-15T10:00:00"
                  }
                }
              }
            }
          },
          "required": true
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "example": "6650a1b2c3d4e5f6a7b8c9d0"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "24-char broadcast ObjectId"
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "202": {
            "description": "Broadcast scheduled",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Broadcast scheduled",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "broadcastId": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "6650a1b2c3d4e5f6a7b8c9d0"
                        },
                        "status": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "RUNNING"
                        },
                        "execution": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "schedule": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "progress": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "stats": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "estimatedRecipients": {
                          "type": "integer",
                          "example": 240
                        },
                        "timezone": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "Asia/Kolkata"
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "example": {
                    "success": true,
                    "data": {
                      "broadcastId": "6650a1b2c3d4e5f6a7b8c9d0",
                      "status": "RUNNING",
                      "execution": {
                        "executionId": "exec_9f8e7d",
                        "status": "queued",
                        "mode": "immediate",
                        "startedAt": "2026-07-12T09:05:00.000Z",
                        "completedAt": null,
                        "cancelledAt": null,
                        "failureReason": null
                      },
                      "schedule": null,
                      "progress": {
                        "processed": 0,
                        "total": 240,
                        "percent": 0
                      },
                      "stats": {
                        "total": 240,
                        "pending": 240,
                        "queued": 0,
                        "processing": 0,
                        "completed": 0,
                        "failed": 0,
                        "cancelled": 0,
                        "skipped": 0
                      },
                      "estimatedRecipients": 240,
                      "timezone": "Asia/Kolkata"
                    },
                    "meta": {
                      "apiVersion": "v1",
                      "queued": true
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:05:00.000Z"
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "broadcastId": "6650a1b2c3d4e5f6a7b8c9d0",
                    "status": "RUNNING",
                    "execution": {
                      "executionId": "exec_9f8e7d",
                      "status": "queued",
                      "mode": "immediate",
                      "startedAt": "2026-07-12T09:05:00.000Z",
                      "completedAt": null,
                      "cancelledAt": null,
                      "failureReason": null
                    },
                    "schedule": null,
                    "progress": {
                      "processed": 0,
                      "total": 240,
                      "percent": 0
                    },
                    "stats": {
                      "total": 240,
                      "pending": 240,
                      "queued": 0,
                      "processing": 0,
                      "completed": 0,
                      "failed": 0,
                      "cancelled": 0,
                      "skipped": 0
                    },
                    "estimatedRecipients": 240,
                    "timezone": "Asia/Kolkata"
                  },
                  "meta": {
                    "apiVersion": "v1",
                    "queued": true
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:05:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "ACCOUNT_CONFIGURATION_ERROR",
                      "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "ACCOUNT_CONFIGURATION_ERROR",
                    "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "API_KEY_INVALID",
                      "message": "Invalid API key.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "API_KEY_INVALID",
                    "message": "Invalid API key.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DEVELOPER_PLATFORM_DISABLED",
                      "message": "Developer platform is disabled for this organization.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DEVELOPER_PLATFORM_DISABLED",
                    "message": "Developer platform is disabled for this organization.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "404": {
            "description": "Broadcast or template not found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Broadcast or template not found",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "CAMPAIGN_NOT_FOUND",
                      "message": "Campaign not found.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "CAMPAIGN_NOT_FOUND",
                    "message": "Campaign not found.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "409": {
            "description": "Conflicting state (not editable, cancel not allowed, already running)",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Conflicting state (not editable, cancel not allowed, already running)",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "CAMPAIGN_NOT_EDITABLE",
                      "message": "Only draft broadcasts can be modified.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "CAMPAIGN_NOT_EDITABLE",
                    "message": "Only draft broadcasts can be modified.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed (invalid body, empty/segment audience, missing template, no connected channel)",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed (invalid body, empty/segment audience, missing template, no connected channel)",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "VALIDATION_ERROR",
                      "message": "Validation failed",
                      "details": {
                        "issues": [
                          {
                            "path": [
                              "name"
                            ],
                            "message": "Broadcast name is required."
                          }
                        ]
                      }
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "VALIDATION_ERROR",
                    "message": "Validation failed",
                    "details": {
                      "issues": [
                        {
                          "path": [
                            "name"
                          ],
                          "message": "Broadcast name is required."
                        }
                      ]
                    }
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests - rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests - rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Too many requests. Please retry later.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RATE_LIMIT_EXCEEDED",
                    "message": "Too many requests. Please retry later.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "INTERNAL_SERVER_ERROR",
                      "message": "Internal server error",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "message": "Internal server error",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X POST \"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/schedule\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/schedule\", {\n  method: \"POST\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/schedule\", {\n    method: \"POST\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.post(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/schedule\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/schedule\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"POST\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/schedule\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"POST\"), \"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/schedule\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/broadcasts/{id}/cancel": {
      "post": {
        "summary": "Cancel a broadcast",
        "tags": [
          "Public API - Broadcasts"
        ],
        "description": "Cancels a SCHEDULED broadcast (reverts to draft) or a RUNNING broadcast. Returns 200.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "example": "6650a1b2c3d4e5f6a7b8c9d0"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "24-char broadcast ObjectId"
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "Broadcast cancelled",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Broadcast cancelled",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "broadcastId": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "6650a1b2c3d4e5f6a7b8c9d0"
                        },
                        "status": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "RUNNING"
                        },
                        "execution": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "schedule": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "progress": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "stats": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "estimatedRecipients": {
                          "type": "integer",
                          "example": 240
                        },
                        "timezone": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "Asia/Kolkata"
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "example": {
                    "success": true,
                    "data": {
                      "broadcastId": "6650a1b2c3d4e5f6a7b8c9d0",
                      "status": "RUNNING",
                      "execution": {
                        "executionId": "exec_9f8e7d",
                        "status": "queued",
                        "mode": "immediate",
                        "startedAt": "2026-07-12T09:05:00.000Z",
                        "completedAt": null,
                        "cancelledAt": null,
                        "failureReason": null
                      },
                      "schedule": null,
                      "progress": {
                        "processed": 0,
                        "total": 240,
                        "percent": 0
                      },
                      "stats": {
                        "total": 240,
                        "pending": 240,
                        "queued": 0,
                        "processing": 0,
                        "completed": 0,
                        "failed": 0,
                        "cancelled": 0,
                        "skipped": 0
                      },
                      "estimatedRecipients": 240,
                      "timezone": "Asia/Kolkata"
                    },
                    "meta": {
                      "apiVersion": "v1",
                      "queued": true
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:05:00.000Z"
                  }
                },
                "example": {
                  "success": true,
                  "data": {
                    "broadcastId": "6650a1b2c3d4e5f6a7b8c9d0",
                    "status": "RUNNING",
                    "execution": {
                      "executionId": "exec_9f8e7d",
                      "status": "queued",
                      "mode": "immediate",
                      "startedAt": "2026-07-12T09:05:00.000Z",
                      "completedAt": null,
                      "cancelledAt": null,
                      "failureReason": null
                    },
                    "schedule": null,
                    "progress": {
                      "processed": 0,
                      "total": 240,
                      "percent": 0
                    },
                    "stats": {
                      "total": 240,
                      "pending": 240,
                      "queued": 0,
                      "processing": 0,
                      "completed": 0,
                      "failed": 0,
                      "cancelled": 0,
                      "skipped": 0
                    },
                    "estimatedRecipients": 240,
                    "timezone": "Asia/Kolkata"
                  },
                  "meta": {
                    "apiVersion": "v1",
                    "queued": true
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:05:00.000Z"
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "ACCOUNT_CONFIGURATION_ERROR",
                      "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "ACCOUNT_CONFIGURATION_ERROR",
                    "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "API_KEY_INVALID",
                      "message": "Invalid API key.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "API_KEY_INVALID",
                    "message": "Invalid API key.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DEVELOPER_PLATFORM_DISABLED",
                      "message": "Developer platform is disabled for this organization.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DEVELOPER_PLATFORM_DISABLED",
                    "message": "Developer platform is disabled for this organization.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "404": {
            "description": "Broadcast or template not found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Broadcast or template not found",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "CAMPAIGN_NOT_FOUND",
                      "message": "Campaign not found.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "CAMPAIGN_NOT_FOUND",
                    "message": "Campaign not found.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "409": {
            "description": "Conflicting state (not editable, cancel not allowed, already running)",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Conflicting state (not editable, cancel not allowed, already running)",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "CAMPAIGN_NOT_EDITABLE",
                      "message": "Only draft broadcasts can be modified.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "CAMPAIGN_NOT_EDITABLE",
                    "message": "Only draft broadcasts can be modified.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests - rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests - rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Too many requests. Please retry later.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RATE_LIMIT_EXCEEDED",
                    "message": "Too many requests. Please retry later.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "INTERNAL_SERVER_ERROR",
                      "message": "Internal server error",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "message": "Internal server error",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X POST \"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/cancel\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/cancel\", {\n  method: \"POST\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/cancel\", {\n    method: \"POST\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.post(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/cancel\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/cancel\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"POST\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/cancel\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"POST\"), \"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/cancel\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/broadcasts/{id}/progress": {
      "get": {
        "summary": "Get broadcast progress",
        "tags": [
          "Public API - Broadcasts"
        ],
        "description": "Returns real-time progress: status, phase, recipient counts (processed/queued/failed/completed), completion percent, and retry counters.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "example": "id,name,status"
            },
            "in": "query",
            "name": "fields",
            "required": false,
            "description": "Comma-separated list of fields to return (sparse fieldset)."
          },
          {
            "schema": {
              "type": "string",
              "example": "6650a1b2c3d4e5f6a7b8c9d0"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "24-char broadcast ObjectId"
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "Broadcast progress snapshot",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Broadcast progress snapshot",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "broadcastId": {
                          "type": [
                            "null",
                            "string"
                          ]
                        },
                        "status": {
                          "type": [
                            "null",
                            "string"
                          ]
                        },
                        "phase": {
                          "type": [
                            "null",
                            "string"
                          ]
                        },
                        "counts": {
                          "type": "object",
                          "additionalProperties": true
                        },
                        "completionPercent": {
                          "type": "number",
                          "example": 42
                        },
                        "timing": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "retry": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "lastUpdatedAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "ACCOUNT_CONFIGURATION_ERROR",
                      "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "ACCOUNT_CONFIGURATION_ERROR",
                    "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "API_KEY_INVALID",
                      "message": "Invalid API key.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "API_KEY_INVALID",
                    "message": "Invalid API key.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DEVELOPER_PLATFORM_DISABLED",
                      "message": "Developer platform is disabled for this organization.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DEVELOPER_PLATFORM_DISABLED",
                    "message": "Developer platform is disabled for this organization.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "404": {
            "description": "Broadcast or template not found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Broadcast or template not found",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "CAMPAIGN_NOT_FOUND",
                      "message": "Campaign not found.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "CAMPAIGN_NOT_FOUND",
                    "message": "Campaign not found.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests - rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests - rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Too many requests. Please retry later.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RATE_LIMIT_EXCEEDED",
                    "message": "Too many requests. Please retry later.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "INTERNAL_SERVER_ERROR",
                      "message": "Internal server error",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "message": "Internal server error",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/progress\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/progress\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/progress\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/progress\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/progress\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/progress\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/progress\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/broadcasts/{id}/analytics": {
      "get": {
        "summary": "Get broadcast analytics",
        "tags": [
          "Public API - Broadcasts"
        ],
        "description": "Returns delivery metrics (sent/delivered/read/failed + rates), timing, summary, and optional charts.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "executionId",
            "required": false
          },
          {
            "schema": {
              "type": "boolean",
              "default": true
            },
            "in": "query",
            "name": "includeCharts",
            "required": false
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "fields",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "6650a1b2c3d4e5f6a7b8c9d0"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "24-char broadcast ObjectId"
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "Broadcast analytics",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Broadcast analytics",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "broadcast": {
                          "type": "object",
                          "additionalProperties": true
                        },
                        "metrics": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "timing": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "summary": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "hasData": {
                          "type": "boolean"
                        },
                        "charts": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "ACCOUNT_CONFIGURATION_ERROR",
                      "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "ACCOUNT_CONFIGURATION_ERROR",
                    "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "API_KEY_INVALID",
                      "message": "Invalid API key.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "API_KEY_INVALID",
                    "message": "Invalid API key.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DEVELOPER_PLATFORM_DISABLED",
                      "message": "Developer platform is disabled for this organization.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DEVELOPER_PLATFORM_DISABLED",
                    "message": "Developer platform is disabled for this organization.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "404": {
            "description": "Broadcast or template not found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Broadcast or template not found",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "CAMPAIGN_NOT_FOUND",
                      "message": "Campaign not found.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "CAMPAIGN_NOT_FOUND",
                    "message": "Campaign not found.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests - rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests - rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Too many requests. Please retry later.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RATE_LIMIT_EXCEEDED",
                    "message": "Too many requests. Please retry later.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "INTERNAL_SERVER_ERROR",
                      "message": "Internal server error",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "message": "Internal server error",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/analytics\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/analytics\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/analytics\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/analytics\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/analytics\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/analytics\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/analytics\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/broadcasts/{id}/recipients": {
      "get": {
        "summary": "List broadcast recipients",
        "tags": [
          "Public API - Broadcasts"
        ],
        "description": "Per-recipient delivery log for the latest execution of a broadcast, with the WhatsApp delivery status and failure reason of each recipient. Returns an empty list for broadcasts that have not run.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": [
                "queued",
                "sent",
                "delivered",
                "read",
                "failed"
              ]
            },
            "in": "query",
            "name": "deliveryStatus",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "queued",
                "sending",
                "sent",
                "failed",
                "cancelled"
              ]
            },
            "in": "query",
            "name": "status",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 100
            },
            "in": "query",
            "name": "search",
            "required": false,
            "description": "Substring match on contact name or phone."
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "example": 1
            },
            "in": "query",
            "name": "page",
            "required": false
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "example": 25
            },
            "in": "query",
            "name": "limit",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "updatedAt",
                "contactName",
                "phone",
                "status",
                "deliveryStatus",
                "sentAt",
                "deliveredAt",
                "readAt",
                "retryCount"
              ]
            },
            "in": "query",
            "name": "sort",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            },
            "in": "query",
            "name": "order",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "6650a1b2c3d4e5f6a7b8c9d0"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "24-char broadcast ObjectId"
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>`. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "Broadcast recipients",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Broadcast recipients",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true,
                        "properties": {
                          "id": {
                            "type": "string",
                            "example": "6650a1b2c3d4e5f6a7b8c9e1"
                          },
                          "contactId": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "6650a1b2c3d4e5f6a7b8c9f2"
                          },
                          "contactName": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "Asha"
                          },
                          "phone": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "+919800000000"
                          },
                          "status": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "description": "Send pipeline state.",
                            "example": "sent"
                          },
                          "deliveryStatus": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "description": "WhatsApp delivery outcome.",
                            "example": "read"
                          },
                          "messageId": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "description": "Message id, usable with GET /messages/{id}."
                          },
                          "failureReason": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": null
                          },
                          "retryCount": {
                            "type": "integer",
                            "example": 0
                          },
                          "queuedAt": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "format": "date-time"
                          },
                          "sentAt": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "format": "date-time"
                          },
                          "deliveredAt": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "format": "date-time"
                          },
                          "readAt": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "format": "date-time"
                          },
                          "updatedAt": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "ACCOUNT_CONFIGURATION_ERROR",
                      "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "ACCOUNT_CONFIGURATION_ERROR",
                    "message": "Tenant and product context is required. Provide the x-tenant-id header.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "API_KEY_INVALID",
                      "message": "Invalid API key.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "API_KEY_INVALID",
                    "message": "Invalid API key.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden - developer platform disabled, key expired/disabled, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "DEVELOPER_PLATFORM_DISABLED",
                      "message": "Developer platform is disabled for this organization.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "DEVELOPER_PLATFORM_DISABLED",
                    "message": "Developer platform is disabled for this organization.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "404": {
            "description": "Broadcast or template not found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Broadcast or template not found",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "CAMPAIGN_NOT_FOUND",
                      "message": "Campaign not found.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "CAMPAIGN_NOT_FOUND",
                    "message": "Campaign not found.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "422": {
            "description": "Validation failed (invalid body, empty/segment audience, missing template, no connected channel)",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed (invalid body, empty/segment audience, missing template, no connected channel)",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "VALIDATION_ERROR",
                      "message": "Validation failed",
                      "details": {
                        "issues": [
                          {
                            "path": [
                              "name"
                            ],
                            "message": "Broadcast name is required."
                          }
                        ]
                      }
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "VALIDATION_ERROR",
                    "message": "Validation failed",
                    "details": {
                      "issues": [
                        {
                          "path": [
                            "name"
                          ],
                          "message": "Broadcast name is required."
                        }
                      ]
                    }
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests - rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests - rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "RATE_LIMIT_EXCEEDED",
                      "message": "Too many requests. Please retry later.",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "RATE_LIMIT_EXCEEDED",
                    "message": "Too many requests. Please retry later.",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  },
                  "example": {
                    "success": false,
                    "error": {
                      "code": "INTERNAL_SERVER_ERROR",
                      "message": "Internal server error",
                      "details": {}
                    },
                    "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                    "timestamp": "2026-07-12T09:00:00.000Z",
                    "path": "/api/public/v1/broadcasts",
                    "method": "POST"
                  }
                },
                "example": {
                  "success": false,
                  "error": {
                    "code": "INTERNAL_SERVER_ERROR",
                    "message": "Internal server error",
                    "details": {}
                  },
                  "requestId": "a1f4c2e0-9b6d-4a1e-8c3f-2d7e5b9a0c11",
                  "timestamp": "2026-07-12T09:00:00.000Z",
                  "path": "/api/public/v1/broadcasts",
                  "method": "POST"
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/recipients\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/recipients\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/recipients\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/recipients\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/recipients\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/recipients\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/broadcasts/6650a1b2c3d4e5f6a7b8c9d0/recipients\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/commerce/catalog/products": {
      "post": {
        "summary": "Upsert a catalog product",
        "tags": [
          "Public API - Catalog"
        ],
        "description": "Create or update a product in the Inaiy catalog from an external system.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "externalId"
                ],
                "additionalProperties": true,
                "properties": {
                  "externalId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "description": "Your system's product id (string or number).",
                    "example": "SKU-1001"
                  },
                  "sku": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 64,
                    "example": "SKU-1001"
                  },
                  "title": {
                    "type": "string",
                    "maxLength": 200,
                    "description": "Product name. `title` or `name` is required.",
                    "example": "Ceramic Table Lamp"
                  },
                  "name": {
                    "type": "string",
                    "maxLength": 200,
                    "description": "Alias of `title`."
                  },
                  "description": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 5000
                  },
                  "brand": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 120
                  },
                  "category": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 120,
                    "example": "Lighting"
                  },
                  "categoryName": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 120,
                    "description": "Alias of `category`."
                  },
                  "price": {
                    "type": [
                      "number",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 999999999,
                    "example": 1499
                  },
                  "currency": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "pattern": "^[A-Za-z]{3}$",
                    "description": "3-letter ISO 4217 code.",
                    "example": "INR"
                  },
                  "stock": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "maximum": 999999999,
                    "example": 25
                  },
                  "status": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "maxLength": 32,
                    "description": "ACTIVE / PUBLISHED → active, ARCHIVED / DELETED → archived; anything else is a draft.",
                    "example": "ACTIVE"
                  },
                  "imageUrls": {
                    "type": "array",
                    "maxItems": 50,
                    "items": {
                      "type": "string",
                      "format": "uri",
                      "maxLength": 2000,
                      "description": "Public http(s) image URL. Inaiy downloads it (JPEG, PNG, WebP or GIF, up to 10 MB); private or internal addresses are refused."
                    },
                    "description": "The first 12 images are imported; the first one becomes the primary image.",
                    "example": [
                      "https://cdn.example.com/lamp.jpg"
                    ]
                  },
                  "imageUrl": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "uri",
                    "maxLength": 2000,
                    "description": "Single-image alias of `imageUrls`."
                  },
                  "variants": {
                    "type": "array",
                    "maxItems": 100,
                    "items": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "externalId": {
                          "type": "string",
                          "maxLength": 128,
                          "example": "SKU-1001-RED"
                        },
                        "sku": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 64
                        },
                        "title": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 120,
                          "example": "Red"
                        },
                        "price": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "minimum": 0,
                          "example": 1599
                        },
                        "stock": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0,
                          "example": 10
                        },
                        "options": {
                          "type": "object",
                          "additionalProperties": true,
                          "example": {
                            "color": "Red"
                          }
                        }
                      }
                    }
                  },
                  "platform": {
                    "type": "string",
                    "maxLength": 64,
                    "description": "Source system name (default `generic`); products are matched on (platform, externalId).",
                    "example": "generic"
                  },
                  "connectionId": {
                    "type": "string",
                    "maxLength": 128,
                    "description": "Optional source connection id. Defaults to `public-api:<platform>`."
                  }
                }
              }
            }
          },
          "required": true
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "maxLength": 64,
              "example": "generic"
            },
            "in": "query",
            "name": "platform",
            "required": false,
            "description": "Source system name (default `generic`); products are matched on (platform, externalId)."
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 128
            },
            "in": "query",
            "name": "connectionId",
            "required": false,
            "description": "Optional source connection id. Defaults to `public-api:<platform>`."
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "201": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X POST \"https://api.inaiy.com/api/public/v1/commerce/catalog/products\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/commerce/catalog/products\", {\n  method: \"POST\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/commerce/catalog/products\", {\n    method: \"POST\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.post(\"https://api.inaiy.com/api/public/v1/commerce/catalog/products\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/commerce/catalog/products\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"POST\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/commerce/catalog/products\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"POST\"), \"https://api.inaiy.com/api/public/v1/commerce/catalog/products\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/commerce/catalog/products/batch": {
      "post": {
        "summary": "Batch upsert catalog products",
        "tags": [
          "Public API - Catalog"
        ],
        "description": "Create or update up to 500 products in one request.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "products"
                ],
                "additionalProperties": true,
                "properties": {
                  "products": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "externalId"
                      ],
                      "additionalProperties": true,
                      "properties": {
                        "externalId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128,
                          "description": "Your system's product id (string or number).",
                          "example": "SKU-1001"
                        },
                        "sku": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 64,
                          "example": "SKU-1001"
                        },
                        "title": {
                          "type": "string",
                          "maxLength": 200,
                          "description": "Product name. `title` or `name` is required.",
                          "example": "Ceramic Table Lamp"
                        },
                        "name": {
                          "type": "string",
                          "maxLength": 200,
                          "description": "Alias of `title`."
                        },
                        "description": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 5000
                        },
                        "brand": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 120
                        },
                        "category": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 120,
                          "example": "Lighting"
                        },
                        "categoryName": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 120,
                          "description": "Alias of `category`."
                        },
                        "price": {
                          "type": [
                            "number",
                            "null"
                          ],
                          "minimum": 0,
                          "maximum": 999999999,
                          "example": 1499
                        },
                        "currency": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "pattern": "^[A-Za-z]{3}$",
                          "description": "3-letter ISO 4217 code.",
                          "example": "INR"
                        },
                        "stock": {
                          "type": [
                            "integer",
                            "null"
                          ],
                          "minimum": 0,
                          "maximum": 999999999,
                          "example": 25
                        },
                        "status": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "maxLength": 32,
                          "description": "ACTIVE / PUBLISHED → active, ARCHIVED / DELETED → archived; anything else is a draft.",
                          "example": "ACTIVE"
                        },
                        "imageUrls": {
                          "type": "array",
                          "maxItems": 50,
                          "items": {
                            "type": "string",
                            "format": "uri",
                            "maxLength": 2000,
                            "description": "Public http(s) image URL. Inaiy downloads it (JPEG, PNG, WebP or GIF, up to 10 MB); private or internal addresses are refused."
                          },
                          "description": "The first 12 images are imported; the first one becomes the primary image.",
                          "example": [
                            "https://cdn.example.com/lamp.jpg"
                          ]
                        },
                        "imageUrl": {
                          "type": [
                            "string",
                            "null"
                          ],
                          "format": "uri",
                          "maxLength": 2000,
                          "description": "Single-image alias of `imageUrls`."
                        },
                        "variants": {
                          "type": "array",
                          "maxItems": 100,
                          "items": {
                            "type": "object",
                            "additionalProperties": true,
                            "properties": {
                              "externalId": {
                                "type": "string",
                                "maxLength": 128,
                                "example": "SKU-1001-RED"
                              },
                              "sku": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "maxLength": 64
                              },
                              "title": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "maxLength": 120,
                                "example": "Red"
                              },
                              "price": {
                                "type": [
                                  "number",
                                  "null"
                                ],
                                "minimum": 0,
                                "example": 1599
                              },
                              "stock": {
                                "type": [
                                  "integer",
                                  "null"
                                ],
                                "minimum": 0,
                                "example": 10
                              },
                              "options": {
                                "type": "object",
                                "additionalProperties": true,
                                "example": {
                                  "color": "Red"
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "minItems": 1,
                    "maxItems": 500
                  },
                  "platform": {
                    "type": "string",
                    "maxLength": 64,
                    "description": "Source system name (default `generic`); products are matched on (platform, externalId).",
                    "example": "generic"
                  },
                  "connectionId": {
                    "type": "string",
                    "maxLength": 128,
                    "description": "Optional source connection id. Defaults to `public-api:<platform>`."
                  }
                }
              }
            }
          },
          "required": true
        },
        "parameters": [
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X POST \"https://api.inaiy.com/api/public/v1/commerce/catalog/products/batch\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/commerce/catalog/products/batch\", {\n  method: \"POST\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/commerce/catalog/products/batch\", {\n    method: \"POST\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.post(\"https://api.inaiy.com/api/public/v1/commerce/catalog/products/batch\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/commerce/catalog/products/batch\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"POST\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/commerce/catalog/products/batch\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"POST\"), \"https://api.inaiy.com/api/public/v1/commerce/catalog/products/batch\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/commerce/catalog/products/{externalId}": {
      "delete": {
        "summary": "Archive a product by externalId",
        "tags": [
          "Public API - Catalog"
        ],
        "description": "Soft-archives the Inaiy product linked to the given external identifier.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "maxLength": 64,
              "example": "generic"
            },
            "in": "query",
            "name": "platform",
            "required": false,
            "description": "Source system name (default `generic`); products are matched on (platform, externalId)."
          },
          {
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "in": "path",
            "name": "externalId",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          }
        ],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X DELETE \"https://api.inaiy.com/api/public/v1/commerce/catalog/products/6650a1b2c3d4e5f6a7b8c9d0\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/commerce/catalog/products/6650a1b2c3d4e5f6a7b8c9d0\", {\n  method: \"DELETE\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/commerce/catalog/products/6650a1b2c3d4e5f6a7b8c9d0\", {\n    method: \"DELETE\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.delete(\"https://api.inaiy.com/api/public/v1/commerce/catalog/products/6650a1b2c3d4e5f6a7b8c9d0\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/commerce/catalog/products/6650a1b2c3d4e5f6a7b8c9d0\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"DELETE\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/commerce/catalog/products/6650a1b2c3d4e5f6a7b8c9d0\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"DELETE\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"DELETE\"), \"https://api.inaiy.com/api/public/v1/commerce/catalog/products/6650a1b2c3d4e5f6a7b8c9d0\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/agents": {
      "get": {
        "summary": "List agents",
        "tags": [
          "Public API - Team"
        ],
        "description": "People in this workspace. Deleted users are excluded.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "example": 1
            },
            "in": "query",
            "name": "page",
            "required": false,
            "description": "Page number (default 1)."
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "example": 25
            },
            "in": "query",
            "name": "limit",
            "required": false,
            "description": "Page size (default 25, max 100)."
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 100,
              "example": "priya"
            },
            "in": "query",
            "name": "search",
            "required": false,
            "description": "Case-insensitive text search."
          },
          {
            "schema": {
              "type": "string",
              "example": "ACTIVE"
            },
            "in": "query",
            "name": "status",
            "required": false,
            "description": "ACTIVE, INVITED, INACTIVE, or SUSPENDED (case-insensitive)."
          },
          {
            "schema": {
              "type": "string",
              "example": "6650a1b2c3d4e5f6a7b8c9d4"
            },
            "in": "query",
            "name": "teamId",
            "required": false,
            "description": "Only members of this team."
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>` or an OAuth access token. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of agents",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Paginated list of agents",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true,
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Use as `assignedAgentId` on contacts and conversations.",
                            "example": "6650a1b2c3d4e5f6a7b8c9d5"
                          },
                          "name": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "Priya Raman"
                          },
                          "firstName": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "Priya"
                          },
                          "lastName": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "Raman"
                          },
                          "email": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "priya@example.com"
                          },
                          "status": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "enum": [
                              "ACTIVE",
                              "INVITED",
                              "INACTIVE",
                              "SUSPENDED",
                              null
                            ],
                            "example": "ACTIVE"
                          },
                          "department": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "Support"
                          },
                          "designation": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "Agent"
                          },
                          "createdAt": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "format": "date-time"
                          },
                          "updatedAt": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "page": {
                          "type": "integer",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "example": 3
                        },
                        "totalPages": {
                          "type": "integer",
                          "example": 1
                        },
                        "hasNextPage": {
                          "type": "boolean",
                          "example": false
                        },
                        "hasPrevPage": {
                          "type": "boolean",
                          "example": false
                        },
                        "nextCursor": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": null
                        },
                        "prevCursor": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": null
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key / access token",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key / access token",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — plan, scope, key status, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden — plan, scope, key status, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests — rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/agents\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/agents\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/agents\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/agents\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/agents\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/agents\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/agents\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/agents/{id}": {
      "get": {
        "summary": "Get an agent",
        "tags": [
          "Public API - Team"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "24-char id"
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>` or an OAuth access token. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "The agent",
            "content": {
              "application/json": {
                "schema": {
                  "description": "The agent",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "Use as `assignedAgentId` on contacts and conversations.",
                          "example": "6650a1b2c3d4e5f6a7b8c9d5"
                        },
                        "name": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "Priya Raman"
                        },
                        "firstName": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "Priya"
                        },
                        "lastName": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "Raman"
                        },
                        "email": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "priya@example.com"
                        },
                        "status": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "enum": [
                            "ACTIVE",
                            "INVITED",
                            "INACTIVE",
                            "SUSPENDED",
                            null
                          ],
                          "example": "ACTIVE"
                        },
                        "department": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "Support"
                        },
                        "designation": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "Agent"
                        },
                        "createdAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key / access token",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key / access token",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — plan, scope, key status, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden — plan, scope, key status, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Resource not found",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests — rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/agents/6650a1b2c3d4e5f6a7b8c9d0\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/agents/6650a1b2c3d4e5f6a7b8c9d0\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/agents/6650a1b2c3d4e5f6a7b8c9d0\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/agents/6650a1b2c3d4e5f6a7b8c9d0\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/agents/6650a1b2c3d4e5f6a7b8c9d0\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/agents/6650a1b2c3d4e5f6a7b8c9d0\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/agents/6650a1b2c3d4e5f6a7b8c9d0\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/teams": {
      "get": {
        "summary": "List teams",
        "tags": [
          "Public API - Team"
        ],
        "description": "Teams in this workspace with their member agent ids, sorted by name.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "example": 1
            },
            "in": "query",
            "name": "page",
            "required": false,
            "description": "Page number (default 1)."
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "example": 25
            },
            "in": "query",
            "name": "limit",
            "required": false,
            "description": "Page size (default 25, max 100)."
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 100,
              "example": "support"
            },
            "in": "query",
            "name": "search",
            "required": false,
            "description": "Case-insensitive text search."
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>` or an OAuth access token. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of teams",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Paginated list of teams",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true,
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Use as `primaryTeamId` on contacts.",
                            "example": "6650a1b2c3d4e5f6a7b8c9d4"
                          },
                          "name": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "Support"
                          },
                          "description": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "Tier 1 support"
                          },
                          "status": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "ACTIVE"
                          },
                          "managerId": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "6650a1b2c3d4e5f6a7b8c9d5"
                          },
                          "memberIds": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            },
                            "example": [
                              "6650a1b2c3d4e5f6a7b8c9d5"
                            ]
                          },
                          "memberCount": {
                            "type": "integer",
                            "example": 1
                          },
                          "createdAt": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "format": "date-time"
                          },
                          "updatedAt": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "page": {
                          "type": "integer",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "example": 3
                        },
                        "totalPages": {
                          "type": "integer",
                          "example": 1
                        },
                        "hasNextPage": {
                          "type": "boolean",
                          "example": false
                        },
                        "hasPrevPage": {
                          "type": "boolean",
                          "example": false
                        },
                        "nextCursor": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": null
                        },
                        "prevCursor": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": null
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key / access token",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key / access token",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — plan, scope, key status, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden — plan, scope, key status, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests — rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/teams\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/teams\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/teams\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/teams\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/teams\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/teams\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/teams\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/teams/{id}": {
      "get": {
        "summary": "Get a team",
        "tags": [
          "Public API - Team"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "24-char id"
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>` or an OAuth access token. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "The team",
            "content": {
              "application/json": {
                "schema": {
                  "description": "The team",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "id": {
                          "type": "string",
                          "description": "Use as `primaryTeamId` on contacts.",
                          "example": "6650a1b2c3d4e5f6a7b8c9d4"
                        },
                        "name": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "Support"
                        },
                        "description": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "Tier 1 support"
                        },
                        "status": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "ACTIVE"
                        },
                        "managerId": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "6650a1b2c3d4e5f6a7b8c9d5"
                        },
                        "memberIds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "example": [
                            "6650a1b2c3d4e5f6a7b8c9d5"
                          ]
                        },
                        "memberCount": {
                          "type": "integer",
                          "example": 1
                        },
                        "createdAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "format": "date-time"
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key / access token",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key / access token",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — plan, scope, key status, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden — plan, scope, key status, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Resource not found",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests — rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/teams/6650a1b2c3d4e5f6a7b8c9d0\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/teams/6650a1b2c3d4e5f6a7b8c9d0\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/teams/6650a1b2c3d4e5f6a7b8c9d0\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/teams/6650a1b2c3d4e5f6a7b8c9d0\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/teams/6650a1b2c3d4e5f6a7b8c9d0\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/teams/6650a1b2c3d4e5f6a7b8c9d0\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/teams/6650a1b2c3d4e5f6a7b8c9d0\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/analytics/messages": {
      "get": {
        "summary": "Messaging analytics",
        "tags": [
          "Public API - Analytics"
        ],
        "description": "Inbound and outbound message volume with delivery, read and failure counts for the range, broken down by day (zero-filled), channel and message type.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "example": "2026-10-01T00:00:00Z"
            },
            "in": "query",
            "name": "from",
            "required": false,
            "description": "Start of the range (ISO 8601 date or date-time, inclusive). Defaults to 30 days before `to`."
          },
          {
            "schema": {
              "type": "string",
              "example": "2026-10-31"
            },
            "in": "query",
            "name": "to",
            "required": false,
            "description": "End of the range (exclusive; a date-only value includes that whole UTC day). Defaults to now. Max range 92 days."
          },
          {
            "schema": {
              "type": "string",
              "example": "Asia/Kolkata"
            },
            "in": "query",
            "name": "timezone",
            "required": false,
            "description": "IANA timezone used to label per-day buckets (default UTC)."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "channelId",
            "required": false,
            "description": "Only include this channel (24-char id from GET /channels)."
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>` or an OAuth access token. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "Messaging analytics",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Messaging analytics",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "range": {
                          "type": "object",
                          "additionalProperties": true,
                          "properties": {
                            "from": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "to": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "timezone": {
                              "type": "string",
                              "example": "UTC"
                            }
                          }
                        },
                        "totals": {
                          "type": "object",
                          "additionalProperties": true,
                          "properties": {
                            "total": {
                              "type": "integer",
                              "example": 1240
                            },
                            "inbound": {
                              "type": "integer",
                              "example": 410
                            },
                            "outbound": {
                              "type": "integer",
                              "example": 830
                            },
                            "sent": {
                              "type": "integer",
                              "description": "Outbound messages that reached sent, delivered or read.",
                              "example": 812
                            },
                            "delivered": {
                              "type": "integer",
                              "description": "Outbound messages that reached delivered or read.",
                              "example": 790
                            },
                            "read": {
                              "type": "integer",
                              "example": 512
                            },
                            "failed": {
                              "type": "integer",
                              "example": 18
                            },
                            "broadcast": {
                              "type": "integer",
                              "description": "Outbound messages sent by broadcasts.",
                              "example": 600
                            },
                            "session": {
                              "type": "integer",
                              "description": "Other outbound messages (agent, API, automation).",
                              "example": 230
                            },
                            "deliveryRatePercent": {
                              "type": [
                                "null",
                                "number"
                              ],
                              "example": 97.29
                            },
                            "readRatePercent": {
                              "type": [
                                "null",
                                "number"
                              ],
                              "example": 63.05
                            },
                            "failureRatePercent": {
                              "type": [
                                "null",
                                "number"
                              ],
                              "example": 2.17
                            }
                          }
                        },
                        "byDay": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": true,
                            "properties": {
                              "date": {
                                "type": "string",
                                "example": "2026-10-28"
                              },
                              "total": {
                                "type": "integer",
                                "example": 1240
                              },
                              "inbound": {
                                "type": "integer",
                                "example": 410
                              },
                              "outbound": {
                                "type": "integer",
                                "example": 830
                              },
                              "sent": {
                                "type": "integer",
                                "description": "Outbound messages that reached sent, delivered or read.",
                                "example": 812
                              },
                              "delivered": {
                                "type": "integer",
                                "description": "Outbound messages that reached delivered or read.",
                                "example": 790
                              },
                              "read": {
                                "type": "integer",
                                "example": 512
                              },
                              "failed": {
                                "type": "integer",
                                "example": 18
                              },
                              "broadcast": {
                                "type": "integer",
                                "description": "Outbound messages sent by broadcasts.",
                                "example": 600
                              },
                              "session": {
                                "type": "integer",
                                "description": "Other outbound messages (agent, API, automation).",
                                "example": 230
                              },
                              "deliveryRatePercent": {
                                "type": [
                                  "null",
                                  "number"
                                ],
                                "example": 97.29
                              },
                              "readRatePercent": {
                                "type": [
                                  "null",
                                  "number"
                                ],
                                "example": 63.05
                              },
                              "failureRatePercent": {
                                "type": [
                                  "null",
                                  "number"
                                ],
                                "example": 2.17
                              }
                            }
                          }
                        },
                        "byChannel": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": true,
                            "properties": {
                              "channelId": {
                                "type": "string"
                              },
                              "channelType": {
                                "type": [
                                  "null",
                                  "string"
                                ],
                                "example": "WHATSAPP"
                              },
                              "channelName": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "total": {
                                "type": "integer",
                                "example": 1240
                              },
                              "inbound": {
                                "type": "integer",
                                "example": 410
                              },
                              "outbound": {
                                "type": "integer",
                                "example": 830
                              },
                              "sent": {
                                "type": "integer",
                                "description": "Outbound messages that reached sent, delivered or read.",
                                "example": 812
                              },
                              "delivered": {
                                "type": "integer",
                                "description": "Outbound messages that reached delivered or read.",
                                "example": 790
                              },
                              "read": {
                                "type": "integer",
                                "example": 512
                              },
                              "failed": {
                                "type": "integer",
                                "example": 18
                              },
                              "broadcast": {
                                "type": "integer",
                                "description": "Outbound messages sent by broadcasts.",
                                "example": 600
                              },
                              "session": {
                                "type": "integer",
                                "description": "Other outbound messages (agent, API, automation).",
                                "example": 230
                              },
                              "deliveryRatePercent": {
                                "type": [
                                  "null",
                                  "number"
                                ],
                                "example": 97.29
                              },
                              "readRatePercent": {
                                "type": [
                                  "null",
                                  "number"
                                ],
                                "example": 63.05
                              },
                              "failureRatePercent": {
                                "type": [
                                  "null",
                                  "number"
                                ],
                                "example": 2.17
                              }
                            }
                          }
                        },
                        "byType": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": true,
                            "properties": {
                              "type": {
                                "type": "string",
                                "example": "template"
                              },
                              "total": {
                                "type": "integer"
                              },
                              "inbound": {
                                "type": "integer"
                              },
                              "outbound": {
                                "type": "integer"
                              }
                            }
                          }
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key / access token",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key / access token",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — plan, scope, key status, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden — plan, scope, key status, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests — rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/analytics/messages\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/analytics/messages\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/analytics/messages\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/analytics/messages\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/analytics/messages\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/analytics/messages\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/analytics/messages\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/analytics/templates": {
      "get": {
        "summary": "Template analytics",
        "tags": [
          "Public API - Analytics"
        ],
        "description": "Delivery, read, failure and quick-reply click counts per template (name + language) for template messages sent in the range, from broadcasts, the API and automations. Pass `name` to also get a per-day series. URL-button taps are not reported by WhatsApp, so they are not counted.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "example": "2026-10-01T00:00:00Z"
            },
            "in": "query",
            "name": "from",
            "required": false,
            "description": "Start of the range (ISO 8601 date or date-time, inclusive). Defaults to 30 days before `to`."
          },
          {
            "schema": {
              "type": "string",
              "example": "2026-10-31"
            },
            "in": "query",
            "name": "to",
            "required": false,
            "description": "End of the range (exclusive; a date-only value includes that whole UTC day). Defaults to now. Max range 92 days."
          },
          {
            "schema": {
              "type": "string",
              "example": "Asia/Kolkata"
            },
            "in": "query",
            "name": "timezone",
            "required": false,
            "description": "IANA timezone used to label per-day buckets (default UTC)."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "channelId",
            "required": false,
            "description": "Only include this channel (24-char id from GET /channels)."
          },
          {
            "schema": {
              "type": "string",
              "example": "order_update"
            },
            "in": "query",
            "name": "name",
            "required": false,
            "description": "Only this template name (exact)."
          },
          {
            "schema": {
              "type": "string",
              "example": "en_US"
            },
            "in": "query",
            "name": "language",
            "required": false,
            "description": "Only this template language."
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>` or an OAuth access token. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "Template analytics",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Template analytics",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "range": {
                          "type": "object",
                          "additionalProperties": true,
                          "properties": {
                            "from": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "to": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "timezone": {
                              "type": "string",
                              "example": "UTC"
                            }
                          }
                        },
                        "totals": {
                          "type": "object",
                          "additionalProperties": true,
                          "properties": {
                            "sent": {
                              "type": "integer",
                              "example": 500
                            },
                            "delivered": {
                              "type": "integer",
                              "example": 480
                            },
                            "read": {
                              "type": "integer",
                              "example": 300
                            },
                            "failed": {
                              "type": "integer",
                              "example": 6
                            },
                            "pending": {
                              "type": "integer",
                              "description": "Accepted but not yet sent.",
                              "example": 0
                            },
                            "clicks": {
                              "type": "integer",
                              "description": "Quick-reply button taps on these messages.",
                              "example": 42
                            },
                            "deliveryRatePercent": {
                              "type": [
                                "null",
                                "number"
                              ]
                            },
                            "readRatePercent": {
                              "type": [
                                "null",
                                "number"
                              ],
                              "description": "Read / delivered."
                            },
                            "failureRatePercent": {
                              "type": [
                                "null",
                                "number"
                              ]
                            },
                            "clickRatePercent": {
                              "type": [
                                "null",
                                "number"
                              ],
                              "description": "Clicks / delivered."
                            }
                          }
                        },
                        "templates": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": true,
                            "properties": {
                              "name": {
                                "type": "string",
                                "example": "order_update"
                              },
                              "language": {
                                "type": [
                                  "null",
                                  "string"
                                ],
                                "example": "en_US"
                              },
                              "category": {
                                "type": [
                                  "null",
                                  "string"
                                ],
                                "example": "UTILITY"
                              },
                              "templateId": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "lastSentAt": {
                                "type": [
                                  "null",
                                  "string"
                                ],
                                "format": "date-time"
                              },
                              "sent": {
                                "type": "integer",
                                "example": 500
                              },
                              "delivered": {
                                "type": "integer",
                                "example": 480
                              },
                              "read": {
                                "type": "integer",
                                "example": 300
                              },
                              "failed": {
                                "type": "integer",
                                "example": 6
                              },
                              "pending": {
                                "type": "integer",
                                "description": "Accepted but not yet sent.",
                                "example": 0
                              },
                              "clicks": {
                                "type": "integer",
                                "description": "Quick-reply button taps on these messages.",
                                "example": 42
                              },
                              "deliveryRatePercent": {
                                "type": [
                                  "null",
                                  "number"
                                ]
                              },
                              "readRatePercent": {
                                "type": [
                                  "null",
                                  "number"
                                ],
                                "description": "Read / delivered."
                              },
                              "failureRatePercent": {
                                "type": [
                                  "null",
                                  "number"
                                ]
                              },
                              "clickRatePercent": {
                                "type": [
                                  "null",
                                  "number"
                                ],
                                "description": "Clicks / delivered."
                              },
                              "buttons": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "additionalProperties": true,
                                  "properties": {
                                    "text": {
                                      "type": "string",
                                      "example": "Track order"
                                    },
                                    "clicks": {
                                      "type": "integer",
                                      "example": 30
                                    }
                                  }
                                }
                              }
                            }
                          }
                        },
                        "byDay": {
                          "type": "array",
                          "description": "Only when `name` is given.",
                          "items": {
                            "type": "object",
                            "additionalProperties": true
                          }
                        },
                        "truncated": {
                          "type": "boolean",
                          "description": "True when the result was capped (over 500 templates or 20,000 button taps)."
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key / access token",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key / access token",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — plan, scope, key status, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden — plan, scope, key status, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests — rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/analytics/templates\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/analytics/templates\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/analytics/templates\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/analytics/templates\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/analytics/templates\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/analytics/templates\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/analytics/templates\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/analytics/broadcasts": {
      "get": {
        "summary": "Broadcast analytics summary",
        "tags": [
          "Public API - Analytics"
        ],
        "description": "Aggregate delivery metrics across broadcasts (drafts excluded unless `status` is set), plus a paginated per-broadcast table and highlights. `from`/`to` filter on the broadcast start time. Use GET /broadcasts/{id}/recipients for per-recipient statuses.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "from",
            "required": false,
            "description": "Broadcasts started at or after (ISO 8601)."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "to",
            "required": false,
            "description": "Broadcasts started at or before (ISO 8601; a date-only value includes that whole UTC day)."
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "DRAFT",
                "SCHEDULED",
                "RUNNING",
                "PAUSED",
                "COMPLETED",
                "CANCELLED",
                "FAILED"
              ]
            },
            "in": "query",
            "name": "status",
            "required": false
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "channelId",
            "required": false
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "templateId",
            "required": false
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "example": 1
            },
            "in": "query",
            "name": "page",
            "required": false,
            "description": "Page number (default 1)."
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "example": 25
            },
            "in": "query",
            "name": "limit",
            "required": false,
            "description": "Page size (default 25, max 100)."
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "startedAt",
                "name",
                "status",
                "totalRecipients",
                "sent",
                "delivered",
                "read",
                "failed",
                "deliveryRate",
                "readRate",
                "completion"
              ]
            },
            "in": "query",
            "name": "sort",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            },
            "in": "query",
            "name": "order",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>` or an OAuth access token. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "Broadcast analytics summary",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Broadcast analytics summary",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "summary": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true,
                          "description": "Totals and rates across all matching broadcasts."
                        },
                        "highlights": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "broadcasts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": true,
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "status": {
                                "type": [
                                  "null",
                                  "string"
                                ],
                                "example": "COMPLETED"
                              },
                              "templateId": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "templateName": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "totalRecipients": {
                                "type": "integer"
                              },
                              "sent": {
                                "type": "integer"
                              },
                              "delivered": {
                                "type": "integer"
                              },
                              "read": {
                                "type": "integer"
                              },
                              "failed": {
                                "type": "integer"
                              },
                              "successRate": {
                                "type": "number"
                              },
                              "failureRate": {
                                "type": "number"
                              },
                              "deliveryRate": {
                                "type": "number"
                              },
                              "readRate": {
                                "type": "number"
                              },
                              "startedAt": {
                                "type": [
                                  "null",
                                  "string"
                                ],
                                "format": "date-time"
                              }
                            }
                          }
                        },
                        "pagination": {
                          "type": "object",
                          "additionalProperties": true
                        },
                        "truncated": {
                          "type": "boolean"
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key / access token",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key / access token",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — plan, scope, key status, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden — plan, scope, key status, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests — rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/analytics/broadcasts\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/analytics/broadcasts\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/analytics/broadcasts\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/analytics/broadcasts\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/analytics/broadcasts\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/analytics/broadcasts\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/analytics/broadcasts\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/analytics/inbox": {
      "get": {
        "summary": "Inbox analytics",
        "tags": [
          "Public API - Analytics"
        ],
        "description": "Conversation counts by status, priority, channel, team, label and source; first-response and resolution times; per-agent load; message volume; and SLA compliance for conversations created in the range. The range is day-granular: `to` covers through the end of its UTC day.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "example": "2026-10-01T00:00:00Z"
            },
            "in": "query",
            "name": "from",
            "required": false,
            "description": "Start of the range (ISO 8601 date or date-time, inclusive). Defaults to 30 days before `to`."
          },
          {
            "schema": {
              "type": "string",
              "example": "2026-10-31"
            },
            "in": "query",
            "name": "to",
            "required": false,
            "description": "End of the range (exclusive; a date-only value includes that whole UTC day). Defaults to now. Max range 92 days."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "channelId",
            "required": false,
            "description": "Only include this channel (24-char id from GET /channels)."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "teamId",
            "required": false,
            "description": "Only conversations of this team (id from GET /teams)."
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>` or an OAuth access token. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "Inbox analytics",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Inbox analytics",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "range": {
                          "type": "object",
                          "additionalProperties": true,
                          "properties": {
                            "from": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "to": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "timezone": {
                              "type": "string",
                              "example": "UTC"
                            }
                          }
                        },
                        "overview": {
                          "type": "object",
                          "additionalProperties": true,
                          "properties": {
                            "total": {
                              "type": "integer"
                            },
                            "open": {
                              "type": "integer"
                            },
                            "pending": {
                              "type": "integer"
                            },
                            "resolved": {
                              "type": "integer"
                            },
                            "closed": {
                              "type": "integer"
                            },
                            "unassigned": {
                              "type": "integer"
                            },
                            "avgFirstResponseMs": {
                              "type": [
                                "null",
                                "number"
                              ]
                            },
                            "avgResolutionHours": {
                              "type": [
                                "null",
                                "number"
                              ]
                            }
                          }
                        },
                        "breakdowns": {
                          "type": "object",
                          "additionalProperties": true
                        },
                        "agents": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": true,
                            "properties": {
                              "agentId": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "name": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "email": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "open": {
                                "type": "integer"
                              },
                              "pending": {
                                "type": "integer"
                              },
                              "resolved": {
                                "type": "integer"
                              },
                              "closed": {
                                "type": "integer"
                              },
                              "total": {
                                "type": "integer"
                              },
                              "avgFirstResponseMs": {
                                "type": [
                                  "null",
                                  "number"
                                ]
                              }
                            }
                          }
                        },
                        "messages": {
                          "type": "object",
                          "additionalProperties": true
                        },
                        "sla": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key / access token",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key / access token",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — plan, scope, key status, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden — plan, scope, key status, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests — rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/analytics/inbox\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/analytics/inbox\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/analytics/inbox\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/analytics/inbox\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/analytics/inbox\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/analytics/inbox\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/analytics/inbox\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/analytics/usage": {
      "get": {
        "summary": "Plan usage",
        "tags": [
          "Public API - Analytics"
        ],
        "description": "Current plan and usage against each plan limit (contacts, messages this month, API calls, storage, and more).",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>` or an OAuth access token. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "Plan usage",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Plan usage",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "period": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": "2026-10"
                        },
                        "plan": {
                          "type": "object",
                          "additionalProperties": true,
                          "properties": {
                            "code": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "name": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "status": {
                              "type": [
                                "null",
                                "string"
                              ]
                            }
                          }
                        },
                        "metrics": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": true,
                            "properties": {
                              "key": {
                                "type": "string",
                                "example": "messages_per_month"
                              },
                              "label": {
                                "type": "string",
                                "example": "Messages Per Month"
                              },
                              "used": {
                                "type": "number",
                                "example": 1200
                              },
                              "limit": {
                                "type": [
                                  "null",
                                  "number"
                                ],
                                "description": "Null when unlimited.",
                                "example": 10000
                              },
                              "remaining": {
                                "type": [
                                  "null",
                                  "number"
                                ]
                              },
                              "percentUsed": {
                                "type": [
                                  "null",
                                  "number"
                                ]
                              },
                              "unlimited": {
                                "type": "boolean"
                              },
                              "resetsMonthly": {
                                "type": "boolean"
                              }
                            }
                          }
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key / access token",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key / access token",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — plan, scope, key status, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden — plan, scope, key status, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests — rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/analytics/usage\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/analytics/usage\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/analytics/usage\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/analytics/usage\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/analytics/usage\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/analytics/usage\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/analytics/usage\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/analytics/commerce/{report}": {
      "get": {
        "summary": "Commerce analytics",
        "tags": [
          "Public API - Analytics"
        ],
        "description": "Commerce reports, the same as the in-app commerce dashboard. `overview`: net/gross sales, orders, AOV, customers and conversion with previous-period comparison. `revenue` and `orders`: totals plus a time series. `customers`: new/repeat and top customers. `products`: top/lowest products, variants and categories. `inventory`: stock summary and out-of-stock items with recent sales. `promotions`: promotion performance. `funnel`: cart-to-order funnel. Amounts are in the order currency; when several currencies exist, pass `currency`.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": [
                "today",
                "yesterday",
                "this_week",
                "last_week",
                "this_month",
                "last_month",
                "this_year"
              ]
            },
            "in": "query",
            "name": "period",
            "required": false,
            "description": "Preset range (default this_month). Ignored when from/to are given."
          },
          {
            "schema": {
              "type": "string",
              "example": "2026-10-01"
            },
            "in": "query",
            "name": "from",
            "required": false,
            "description": "Custom range start, YYYY-MM-DD in `timezone` (requires `to`)."
          },
          {
            "schema": {
              "type": "string",
              "example": "2026-10-28"
            },
            "in": "query",
            "name": "to",
            "required": false,
            "description": "Custom range end, YYYY-MM-DD inclusive (max 366 days)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Asia/Kolkata"
            },
            "in": "query",
            "name": "timezone",
            "required": false,
            "description": "IANA timezone (default: the workspace timezone)."
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "day",
                "week",
                "month"
              ]
            },
            "in": "query",
            "name": "granularity",
            "required": false,
            "description": "Series bucket size for revenue/orders."
          },
          {
            "schema": {
              "type": "string",
              "example": "INR"
            },
            "in": "query",
            "name": "currency",
            "required": false
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "channel",
            "required": false,
            "description": "Order channel filter."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "categoryId",
            "required": false
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "collectionId",
            "required": false
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "catalogProductId",
            "required": false,
            "description": "Catalog product filter."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "promotionId",
            "required": false
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            },
            "in": "query",
            "name": "limit",
            "required": false,
            "description": "Rows in top-N lists (default 10)."
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "overview",
                "revenue",
                "orders",
                "customers",
                "products",
                "inventory",
                "promotions",
                "funnel"
              ]
            },
            "in": "path",
            "name": "report",
            "required": true
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>` or an OAuth access token. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "Commerce report",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Commerce report",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key / access token",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key / access token",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — plan, scope, key status, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden — plan, scope, key status, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests — rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/analytics/commerce/6650a1b2c3d4e5f6a7b8c9d0\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/analytics/commerce/6650a1b2c3d4e5f6a7b8c9d0\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/analytics/commerce/6650a1b2c3d4e5f6a7b8c9d0\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/analytics/commerce/6650a1b2c3d4e5f6a7b8c9d0\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/analytics/commerce/6650a1b2c3d4e5f6a7b8c9d0\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/analytics/commerce/6650a1b2c3d4e5f6a7b8c9d0\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/analytics/commerce/6650a1b2c3d4e5f6a7b8c9d0\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/analytics/drips": {
      "get": {
        "summary": "Drip campaign analytics",
        "tags": [
          "Public API - Analytics"
        ],
        "description": "Drip campaigns with enrollment outcomes (enrolled, completed, stopped by reply or opt-out, failed, cancelled).",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "example": 1
            },
            "in": "query",
            "name": "page",
            "required": false,
            "description": "Page number (default 1)."
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "example": 25
            },
            "in": "query",
            "name": "limit",
            "required": false,
            "description": "Page size (default 25, max 100)."
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "DRAFT",
                "SCHEDULED",
                "RUNNING",
                "PAUSED",
                "COMPLETED",
                "CANCELLED"
              ]
            },
            "in": "query",
            "name": "status",
            "required": false
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>` or an OAuth access token. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "Drip campaigns",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Drip campaigns",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": true,
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "status": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "example": "RUNNING"
                          },
                          "channelId": {
                            "type": [
                              "null",
                              "string"
                            ]
                          },
                          "stepCount": {
                            "type": "integer"
                          },
                          "counts": {
                            "type": "object",
                            "additionalProperties": true,
                            "properties": {
                              "enrolled": {
                                "type": "integer"
                              },
                              "completed": {
                                "type": "integer"
                              },
                              "stoppedReply": {
                                "type": "integer"
                              },
                              "stoppedOptOut": {
                                "type": "integer"
                              },
                              "failed": {
                                "type": "integer"
                              },
                              "cancelled": {
                                "type": "integer"
                              }
                            }
                          },
                          "startedAt": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "format": "date-time"
                          },
                          "completedAt": {
                            "type": [
                              "null",
                              "string"
                            ],
                            "format": "date-time"
                          }
                        }
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "page": {
                          "type": "integer",
                          "example": 1
                        },
                        "limit": {
                          "type": "integer",
                          "example": 25
                        },
                        "total": {
                          "type": "integer",
                          "example": 3
                        },
                        "totalPages": {
                          "type": "integer",
                          "example": 1
                        },
                        "hasNextPage": {
                          "type": "boolean",
                          "example": false
                        },
                        "hasPrevPage": {
                          "type": "boolean",
                          "example": false
                        },
                        "nextCursor": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": null
                        },
                        "prevCursor": {
                          "type": [
                            "null",
                            "string"
                          ],
                          "example": null
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key / access token",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key / access token",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — plan, scope, key status, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden — plan, scope, key status, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests — rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/analytics/drips\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/analytics/drips\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/analytics/drips\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/analytics/drips\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/analytics/drips\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/analytics/drips\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/analytics/drips\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/analytics/drips/{id}": {
      "get": {
        "summary": "Drip campaign step analytics",
        "tags": [
          "Public API - Analytics"
        ],
        "description": "Enrollments by status and sent / failed / queued counts for each step of one drip campaign.",
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "24-char drip id"
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>` or an OAuth access token. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "Drip step analytics",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Drip step analytics",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "drip": {
                          "type": "object",
                          "additionalProperties": true,
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "name": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "status": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "example": "RUNNING"
                            },
                            "channelId": {
                              "type": [
                                "null",
                                "string"
                              ]
                            },
                            "stepCount": {
                              "type": "integer"
                            },
                            "counts": {
                              "type": "object",
                              "additionalProperties": true,
                              "properties": {
                                "enrolled": {
                                  "type": "integer"
                                },
                                "completed": {
                                  "type": "integer"
                                },
                                "stoppedReply": {
                                  "type": "integer"
                                },
                                "stoppedOptOut": {
                                  "type": "integer"
                                },
                                "failed": {
                                  "type": "integer"
                                },
                                "cancelled": {
                                  "type": "integer"
                                }
                              }
                            },
                            "startedAt": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "format": "date-time"
                            },
                            "completedAt": {
                              "type": [
                                "null",
                                "string"
                              ],
                              "format": "date-time"
                            }
                          }
                        },
                        "totalEnrollments": {
                          "type": "integer"
                        },
                        "enrollmentsByStatus": {
                          "type": "object",
                          "additionalProperties": true
                        },
                        "steps": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": true,
                            "properties": {
                              "order": {
                                "type": "integer"
                              },
                              "templateId": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "templateName": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "delayMs": {
                                "type": "integer"
                              },
                              "sent": {
                                "type": "integer"
                              },
                              "failed": {
                                "type": "integer"
                              },
                              "queued": {
                                "type": "integer"
                              }
                            }
                          }
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key / access token",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key / access token",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — plan, scope, key status, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden — plan, scope, key status, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Resource not found",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests — rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/analytics/drips/6650a1b2c3d4e5f6a7b8c9d0\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/analytics/drips/6650a1b2c3d4e5f6a7b8c9d0\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/analytics/drips/6650a1b2c3d4e5f6a7b8c9d0\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/analytics/drips/6650a1b2c3d4e5f6a7b8c9d0\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/analytics/drips/6650a1b2c3d4e5f6a7b8c9d0\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/analytics/drips/6650a1b2c3d4e5f6a7b8c9d0\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/analytics/drips/6650a1b2c3d4e5f6a7b8c9d0\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/analytics/ai-agents": {
      "get": {
        "summary": "AI agent analytics",
        "tags": [
          "Public API - Analytics"
        ],
        "description": "Replies, handoffs, unanswered questions, containment rate and token usage for each AI agent (up to 50) over the look-back window.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 90
            },
            "in": "query",
            "name": "sinceDays",
            "required": false,
            "description": "Look-back window in days (default 7)."
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>` or an OAuth access token. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "AI agent analytics",
            "content": {
              "application/json": {
                "schema": {
                  "description": "AI agent analytics",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "sinceDays": {
                          "type": "integer"
                        },
                        "agents": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": true,
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "status": {
                                "type": [
                                  "null",
                                  "string"
                                ],
                                "example": "LIVE"
                              },
                              "mode": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "channelId": {
                                "type": [
                                  "null",
                                  "string"
                                ]
                              },
                              "conversationsTouched": {
                                "type": "integer"
                              },
                              "replies": {
                                "type": "integer",
                                "description": "Turns the AI answered."
                              },
                              "handoffs": {
                                "type": "integer",
                                "description": "Turns escalated to a human."
                              },
                              "unanswered": {
                                "type": "integer"
                              },
                              "skipped": {
                                "type": "integer"
                              },
                              "containmentRate": {
                                "type": [
                                  "null",
                                  "number"
                                ],
                                "description": "Replies / (replies + handoffs + no-answer), 0-1."
                              },
                              "escalationTotal": {
                                "type": "integer"
                              },
                              "tokens": {
                                "type": "object",
                                "additionalProperties": true,
                                "properties": {
                                  "prompt": {
                                    "type": "integer"
                                  },
                                  "completion": {
                                    "type": "integer"
                                  },
                                  "total": {
                                    "type": "integer"
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key / access token",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key / access token",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — plan, scope, key status, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden — plan, scope, key status, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests — rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/analytics/ai-agents\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/analytics/ai-agents\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/analytics/ai-agents\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/analytics/ai-agents\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/analytics/ai-agents\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/analytics/ai-agents\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/analytics/ai-agents\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/analytics/ai-agents/{id}": {
      "get": {
        "summary": "AI agent analytics (single)",
        "tags": [
          "Public API - Analytics"
        ],
        "description": "One AI agent: metrics, escalation reasons, CSAT survey results and the most recent unanswered customer questions.",
        "parameters": [
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 90
            },
            "in": "query",
            "name": "sinceDays",
            "required": false,
            "description": "Look-back window in days (default 7)."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true,
            "description": "24-char AI agent id"
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>` or an OAuth access token. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "AI agent analytics",
            "content": {
              "application/json": {
                "schema": {
                  "description": "AI agent analytics",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "agentId": {
                          "type": "string"
                        },
                        "sinceDays": {
                          "type": "integer"
                        },
                        "conversationsTouched": {
                          "type": "integer"
                        },
                        "replies": {
                          "type": "integer",
                          "description": "Turns the AI answered."
                        },
                        "handoffs": {
                          "type": "integer",
                          "description": "Turns escalated to a human."
                        },
                        "unanswered": {
                          "type": "integer"
                        },
                        "skipped": {
                          "type": "integer"
                        },
                        "containmentRate": {
                          "type": [
                            "null",
                            "number"
                          ],
                          "description": "Replies / (replies + handoffs + no-answer), 0-1."
                        },
                        "escalationTotal": {
                          "type": "integer"
                        },
                        "tokens": {
                          "type": "object",
                          "additionalProperties": true,
                          "properties": {
                            "prompt": {
                              "type": "integer"
                            },
                            "completion": {
                              "type": "integer"
                            },
                            "total": {
                              "type": "integer"
                            }
                          }
                        },
                        "escalationBreakdown": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": true
                          }
                        },
                        "csat": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        },
                        "topUnanswered": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": true
                          }
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key / access token",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key / access token",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — plan, scope, key status, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden — plan, scope, key status, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Resource not found",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests — rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/analytics/ai-agents/6650a1b2c3d4e5f6a7b8c9d0\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/analytics/ai-agents/6650a1b2c3d4e5f6a7b8c9d0\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/analytics/ai-agents/6650a1b2c3d4e5f6a7b8c9d0\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/analytics/ai-agents/6650a1b2c3d4e5f6a7b8c9d0\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/analytics/ai-agents/6650a1b2c3d4e5f6a7b8c9d0\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/analytics/ai-agents/6650a1b2c3d4e5f6a7b8c9d0\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/analytics/ai-agents/6650a1b2c3d4e5f6a7b8c9d0\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/api/public/v1/analytics/api-usage": {
      "get": {
        "summary": "Public API usage",
        "tags": [
          "Public API - Analytics"
        ],
        "description": "Your Public API traffic: calls, success and error counts, average and p95 latency, by day (zero-filled), endpoint, API key / OAuth app and status code, plus the monthly api_calls quota. Only authenticated requests are counted.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "example": "2026-10-01T00:00:00Z"
            },
            "in": "query",
            "name": "from",
            "required": false,
            "description": "Start of the range (ISO 8601 date or date-time, inclusive). Defaults to 30 days before `to`."
          },
          {
            "schema": {
              "type": "string",
              "example": "2026-10-31"
            },
            "in": "query",
            "name": "to",
            "required": false,
            "description": "End of the range (exclusive; a date-only value includes that whole UTC day). Defaults to now. Max range 92 days."
          },
          {
            "schema": {
              "type": "string",
              "example": "Asia/Kolkata"
            },
            "in": "query",
            "name": "timezone",
            "required": false,
            "description": "IANA timezone used to label per-day buckets (default UTC)."
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "query",
            "name": "keyId",
            "required": false,
            "description": "Only this API key id, or `oauth:<clientId>` for an OAuth app."
          },
          {
            "schema": {
              "type": "string",
              "example": "demo"
            },
            "in": "header",
            "name": "x-tenant-id",
            "required": true,
            "description": "Tenant subdomain or MongoDB ObjectId (required)."
          },
          {
            "schema": {
              "type": "string",
              "example": "Bearer wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "authorization",
            "required": false,
            "description": "API key as `Bearer <key>` or an OAuth access token. Alternatively use the X-API-Key header."
          },
          {
            "schema": {
              "type": "string",
              "example": "wp_live_a1b2c3d4e5f6g7h8..."
            },
            "in": "header",
            "name": "x-api-key",
            "required": false,
            "description": "API key (alternative to Authorization: Bearer)."
          }
        ],
        "responses": {
          "200": {
            "description": "Public API usage",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Public API usage",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "range": {
                          "type": "object",
                          "additionalProperties": true,
                          "properties": {
                            "from": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "to": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "timezone": {
                              "type": "string",
                              "example": "UTC"
                            }
                          }
                        },
                        "totals": {
                          "type": "object",
                          "additionalProperties": true,
                          "properties": {
                            "calls": {
                              "type": "integer",
                              "example": 10520
                            },
                            "success": {
                              "type": "integer",
                              "example": 10220
                            },
                            "errors": {
                              "type": "integer",
                              "example": 300
                            },
                            "clientErrors": {
                              "type": "integer",
                              "example": 297
                            },
                            "serverErrors": {
                              "type": "integer",
                              "example": 3
                            },
                            "rateLimited": {
                              "type": "integer",
                              "example": 0
                            },
                            "successRatePercent": {
                              "type": [
                                "null",
                                "number"
                              ]
                            },
                            "errorRatePercent": {
                              "type": [
                                "null",
                                "number"
                              ]
                            },
                            "avgLatencyMs": {
                              "type": [
                                "null",
                                "integer"
                              ],
                              "example": 84
                            },
                            "p95LatencyMs": {
                              "type": [
                                "null",
                                "integer"
                              ],
                              "example": 240
                            }
                          }
                        },
                        "byDay": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": true
                          }
                        },
                        "byEndpoint": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": true
                          }
                        },
                        "byKey": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": true
                          }
                        },
                        "byStatus": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": true
                          }
                        },
                        "quota": {
                          "type": [
                            "null",
                            "object"
                          ],
                          "additionalProperties": true
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "apiVersion": {
                          "type": "string",
                          "example": "v1"
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed request or missing tenant context",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Malformed request or missing tenant context",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key / access token",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Missing or invalid API key / access token",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — plan, scope, key status, or tenant mismatch",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Forbidden — plan, scope, key status, or tenant mismatch",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Validation failed",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests — rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Too many requests — rate limit exceeded",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Unexpected server error",
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "null",
                        "string"
                      ]
                    },
                    "method": {
                      "type": [
                        "null",
                        "string"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/api/public/v1/analytics/api-usage\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/api/public/v1/analytics/api-usage\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/api/public/v1/analytics/api-usage\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/api/public/v1/analytics/api-usage\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/api/public/v1/analytics/api-usage\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/api/public/v1/analytics/api-usage\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/api/public/v1/analytics/api-usage\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/oauth/authorize": {
      "get": {
        "tags": [
          "OAuth 2.0"
        ],
        "summary": "Authorization endpoint",
        "description": "Starts the Authorization Code flow. Redirect the resource owner here to grant consent.\nSupports PKCE (`code_challenge` + `code_challenge_method=S256`), strongly recommended for public clients.\nOn approval, the user is redirected back to `redirect_uri` with a short-lived `code` (and the original `state`).",
        "operationId": "oauthAuthorize",
        "security": [],
        "parameters": [
          {
            "name": "response_type",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "code"
              ]
            },
            "example": "code"
          },
          {
            "name": "client_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "wp_client_a1b2c3d4"
          },
          {
            "name": "redirect_uri",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uri"
            },
            "example": "https://app.example.com/callback"
          },
          {
            "name": "scope",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "contacts.read messages.write"
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "xyz123"
          },
          {
            "name": "code_challenge",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM"
          },
          {
            "name": "code_challenge_method",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "S256"
              ]
            },
            "example": "S256"
          },
          {
            "name": "x-tenant-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "demo"
          }
        ],
        "responses": {
          "200": {
            "description": "Consent info (when requested by the first-party consent UI)."
          },
          "302": {
            "description": "Redirect back to `redirect_uri` with `code` and `state` (or an `error`)."
          },
          "400": {
            "description": "Invalid request.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "invalid_grant"
                    },
                    "error_description": {
                      "type": "string",
                      "example": "The authorization code is invalid or expired."
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/oauth/authorize\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/oauth/authorize\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/oauth/authorize\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/oauth/authorize\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/oauth/authorize\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/oauth/authorize\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/oauth/authorize\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/oauth/token": {
      "post": {
        "tags": [
          "OAuth 2.0"
        ],
        "summary": "Token endpoint",
        "description": "Exchanges an authorization grant for tokens. Supported `grant_type` values:\n- `authorization_code` (with `code`, `redirect_uri`, and `code_verifier` for PKCE)\n- `refresh_token` (with `refresh_token`; rotates the refresh token)\n- `client_credentials` (server-to-server; returns an access token only)\n\nClient authentication: HTTP Basic (`client_id`:`client_secret`) or form body `client_id`/`client_secret`.",
        "operationId": "oauthToken",
        "security": [],
        "parameters": [
          {
            "name": "x-tenant-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "demo"
          },
          {
            "name": "Authorization",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Basic base64(client_id:client_secret) for confidential clients.",
            "example": "Basic d3BfY2xpZW50Xz..."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "grant_type"
                ],
                "properties": {
                  "grant_type": {
                    "type": "string",
                    "enum": [
                      "authorization_code",
                      "refresh_token",
                      "client_credentials"
                    ],
                    "example": "authorization_code"
                  },
                  "code": {
                    "type": "string",
                    "description": "authorization_code grant.",
                    "example": "wp_ac_9f8e7d6c..."
                  },
                  "redirect_uri": {
                    "type": "string",
                    "format": "uri",
                    "example": "https://app.example.com/callback"
                  },
                  "code_verifier": {
                    "type": "string",
                    "description": "PKCE verifier for the authorization_code grant.",
                    "example": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"
                  },
                  "refresh_token": {
                    "type": "string",
                    "description": "refresh_token grant.",
                    "example": "wp_rt_k1l2m3n4..."
                  },
                  "scope": {
                    "type": "string",
                    "description": "client_credentials / down-scoping.",
                    "example": "contacts.read messages.write"
                  },
                  "client_id": {
                    "type": "string",
                    "example": "wp_client_a1b2c3d4"
                  },
                  "client_secret": {
                    "type": "string",
                    "example": "wp_secret_..."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Tokens issued.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "access_token": {
                      "type": "string",
                      "example": "wp_at_a1b2c3d4e5f6g7h8i9j0..."
                    },
                    "token_type": {
                      "type": "string",
                      "example": "Bearer"
                    },
                    "expires_in": {
                      "type": "integer",
                      "example": 3600
                    },
                    "scope": {
                      "type": "string",
                      "example": "contacts.read messages.write"
                    },
                    "refresh_token": {
                      "type": "string",
                      "example": "wp_rt_k1l2m3n4o5p6q7r8s9t0..."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "OAuth error (invalid_request, invalid_grant, unsupported_grant_type, invalid_scope).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "invalid_grant"
                    },
                    "error_description": {
                      "type": "string",
                      "example": "The authorization code is invalid or expired."
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Client authentication failed (invalid_client).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "invalid_grant"
                    },
                    "error_description": {
                      "type": "string",
                      "example": "The authorization code is invalid or expired."
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X POST \"https://api.inaiy.com/oauth/token\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/oauth/token\", {\n  method: \"POST\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/oauth/token\", {\n    method: \"POST\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.post(\"https://api.inaiy.com/oauth/token\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/oauth/token\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"POST\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/oauth/token\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"POST\"), \"https://api.inaiy.com/oauth/token\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/oauth/revoke": {
      "post": {
        "tags": [
          "OAuth 2.0"
        ],
        "summary": "Revocation endpoint (RFC 7009)",
        "description": "Revokes an access or refresh token. Always returns 200 even if the token was already invalid.",
        "operationId": "oauthRevoke",
        "security": [],
        "parameters": [
          {
            "name": "x-tenant-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "demo"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "token"
                ],
                "properties": {
                  "token": {
                    "type": "string",
                    "example": "wp_at_a1b2c3d4..."
                  },
                  "token_type_hint": {
                    "type": "string",
                    "enum": [
                      "access_token",
                      "refresh_token"
                    ],
                    "example": "access_token"
                  },
                  "client_id": {
                    "type": "string",
                    "example": "wp_client_a1b2c3d4"
                  },
                  "client_secret": {
                    "type": "string",
                    "example": "wp_secret_..."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Token revoked (or already invalid)."
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X POST \"https://api.inaiy.com/oauth/revoke\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/oauth/revoke\", {\n  method: \"POST\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/oauth/revoke\", {\n    method: \"POST\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.post(\"https://api.inaiy.com/oauth/revoke\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/oauth/revoke\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"POST\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/oauth/revoke\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"POST\"), \"https://api.inaiy.com/oauth/revoke\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/oauth/introspect": {
      "post": {
        "tags": [
          "OAuth 2.0"
        ],
        "summary": "Introspection endpoint (RFC 7662)",
        "description": "Returns the active state and metadata for an access or refresh token. Requires client authentication.",
        "operationId": "oauthIntrospect",
        "security": [],
        "parameters": [
          {
            "name": "x-tenant-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "demo"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "token"
                ],
                "properties": {
                  "token": {
                    "type": "string",
                    "example": "wp_at_a1b2c3d4..."
                  },
                  "token_type_hint": {
                    "type": "string",
                    "enum": [
                      "access_token",
                      "refresh_token"
                    ],
                    "example": "access_token"
                  },
                  "client_id": {
                    "type": "string",
                    "example": "wp_client_a1b2c3d4"
                  },
                  "client_secret": {
                    "type": "string",
                    "example": "wp_secret_..."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Introspection result.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "active": {
                      "type": "boolean",
                      "example": true
                    },
                    "scope": {
                      "type": "string",
                      "example": "contacts.read messages.write"
                    },
                    "client_id": {
                      "type": "string",
                      "example": "wp_client_a1b2c3d4"
                    },
                    "token_type": {
                      "type": "string",
                      "example": "Bearer"
                    },
                    "exp": {
                      "type": "integer",
                      "example": 1752316205
                    },
                    "iat": {
                      "type": "integer",
                      "example": 1752312605
                    },
                    "sub": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "example": "6650a1b2c3d4e5f6a7b8c9d0"
                    },
                    "inaiy_token_use": {
                      "type": "string",
                      "example": "access"
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X POST \"https://api.inaiy.com/oauth/introspect\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/oauth/introspect\", {\n  method: \"POST\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/oauth/introspect\", {\n    method: \"POST\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.post(\"https://api.inaiy.com/oauth/introspect\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/oauth/introspect\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"POST\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/oauth/introspect\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"POST\"), \"https://api.inaiy.com/oauth/introspect\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    },
    "/oauth/userinfo": {
      "get": {
        "tags": [
          "OAuth 2.0"
        ],
        "summary": "UserInfo endpoint",
        "description": "Returns profile claims for the resource owner associated with the access token. Requires a valid `Authorization: Bearer` access token.",
        "operationId": "oauthUserinfo",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": []
          }
        ],
        "parameters": [
          {
            "name": "x-tenant-id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "demo"
          }
        ],
        "responses": {
          "200": {
            "description": "UserInfo claims.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "sub": {
                      "type": "string",
                      "example": "6650a1b2c3d4e5f6a7b8c9d0"
                    },
                    "scope": {
                      "type": "string",
                      "example": "contacts.read messages.write"
                    },
                    "client_id": {
                      "type": "string",
                      "example": "wp_client_a1b2c3d4"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid access token.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "object",
                      "additionalProperties": true,
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        },
                        "details": {
                          "type": "object",
                          "additionalProperties": true
                        }
                      }
                    },
                    "requestId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "timestamp": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "path": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "method": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "cURL",
            "label": "cURL",
            "source": "curl -X GET \"https://api.inaiy.com/oauth/userinfo\" \\\n  -H \"x-tenant-id: demo\" \\\n  -H \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\""
          },
          {
            "lang": "JavaScript",
            "label": "JavaScript",
            "source": "const res = await fetch(\"https://api.inaiy.com/oauth/userinfo\", {\n  method: \"GET\",\n  headers: {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n  }\n});\nconst data = await res.json();\nconsole.log(data);"
          },
          {
            "lang": "Node.js",
            "label": "Node.js",
            "source": "import https from \"node:https\";\n\nconst res = await fetch(\"https://api.inaiy.com/oauth/userinfo\", {\n    method: \"GET\",\n    headers: {\n      \"x-tenant-id\": \"demo\",\n      \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\"\n    }\n});\nconsole.log(await res.json());"
          },
          {
            "lang": "Python",
            "label": "Python",
            "source": "import requests\n\nheaders = {\n    \"x-tenant-id\": \"demo\",\n    \"x-api-key\": \"wp_live_xxxxxxxxxxxxxxxxxxxx\",\n}\nres = requests.get(\"https://api.inaiy.com/oauth/userinfo\", headers=headers)\nprint(res.json())"
          },
          {
            "lang": "Java",
            "label": "Java",
            "source": "HttpClient client = HttpClient.newHttpClient();\nHttpRequest request = HttpRequest.newBuilder()\n    .uri(URI.create(\"https://api.inaiy.com/oauth/userinfo\"))\n    .header(\"x-tenant-id\", \"demo\")\n    .header(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\")\n    .method(\"GET\", HttpRequest.BodyPublishers.noBody())\n    .build();\nHttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());\nSystem.out.println(response.body());"
          },
          {
            "lang": "PHP",
            "label": "PHP",
            "source": "<?php\n$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, \"https://api.inaiy.com/oauth/userinfo\");\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\ncurl_setopt($ch, CURLOPT_CUSTOMREQUEST, \"GET\");\ncurl_setopt($ch, CURLOPT_HTTPHEADER, [\n    \"x-tenant-id: demo\",\n    \"x-api-key: wp_live_xxxxxxxxxxxxxxxxxxxx\"\n]);\n$response = curl_exec($ch);\ncurl_close($ch);\necho $response;"
          },
          {
            "lang": "C#",
            "label": "C#",
            "source": "using var client = new HttpClient();\nvar request = new HttpRequestMessage(new HttpMethod(\"GET\"), \"https://api.inaiy.com/oauth/userinfo\");\nrequest.Headers.Add(\"x-tenant-id\", \"demo\");\nrequest.Headers.Add(\"x-api-key\", \"wp_live_xxxxxxxxxxxxxxxxxxxx\");\nvar response = await client.SendAsync(request);\nConsole.WriteLine(await response.Content.ReadAsStringAsync());"
          }
        ]
      }
    }
  },
  "webhooks": {
    "message.sent": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Message sent",
        "description": "An outbound message was accepted by the provider for delivery.\n\nDelivered to your subscribed endpoint(s). Verify the `X-Inaiy-Signature` header before trusting the payload.",
        "operationId": "webhook_message_sent",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "required": [
                  "event",
                  "eventId",
                  "timestamp",
                  "data"
                ],
                "properties": {
                  "event": {
                    "type": "string",
                    "enum": [
                      "message.sent"
                    ],
                    "example": "message.sent"
                  },
                  "eventId": {
                    "type": "string",
                    "example": "evt_6650a1b2c3d4e5f6a7b8c9d0_message_sent"
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time",
                    "example": "2026-07-12T09:30:05.000Z"
                  },
                  "data": {
                    "type": "object",
                    "additionalProperties": true,
                    "properties": {
                      "message": {
                        "type": "object",
                        "additionalProperties": true,
                        "properties": {
                          "id": {
                            "type": "string",
                            "example": "6650a1b2c3d4e5f6a7b8c9d0"
                          },
                          "conversationId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "6650a1b2c3d4e5f6a7b8c9d1"
                          },
                          "contactId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "6650a1b2c3d4e5f6a7b8c9d2"
                          },
                          "channelId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "6650a1b2c3d4e5f6a7b8c9d3"
                          },
                          "direction": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "inbound",
                              "outbound",
                              null
                            ],
                            "example": "outbound"
                          },
                          "type": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "text"
                          },
                          "status": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "sent"
                          },
                          "body": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "Hello from Inaiy!"
                          },
                          "timestamp": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "example": "2026-07-12T09:30:00.000Z"
                          },
                          "providerMessageId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "wamid.HBgLMTQ..."
                          }
                        }
                      }
                    }
                  }
                }
              },
              "example": {
                "event": "message.sent",
                "eventId": "evt_6650a1b2c3d4e5f6a7b8c9d0_message_sent",
                "timestamp": "2026-07-12T09:30:05.000Z",
                "data": {
                  "message": {
                    "id": "6650a1b2c3d4e5f6a7b8c9d0",
                    "conversationId": "6650a1b2c3d4e5f6a7b8c9d1",
                    "contactId": "6650a1b2c3d4e5f6a7b8c9d2",
                    "channelId": "6650a1b2c3d4e5f6a7b8c9d3",
                    "direction": "outbound",
                    "type": "text",
                    "status": "sent",
                    "body": "Hello from Inaiy!",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "providerMessageId": "wamid.HBgLMTQ..."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return any 2xx status to acknowledge receipt."
          }
        }
      }
    },
    "message.delivered": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Message delivered",
        "description": "An outbound message was delivered to the recipient device.\n\nDelivered to your subscribed endpoint(s). Verify the `X-Inaiy-Signature` header before trusting the payload.",
        "operationId": "webhook_message_delivered",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "required": [
                  "event",
                  "eventId",
                  "timestamp",
                  "data"
                ],
                "properties": {
                  "event": {
                    "type": "string",
                    "enum": [
                      "message.delivered"
                    ],
                    "example": "message.delivered"
                  },
                  "eventId": {
                    "type": "string",
                    "example": "evt_6650a1b2c3d4e5f6a7b8c9d0_message_delivered"
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time",
                    "example": "2026-07-12T09:30:05.000Z"
                  },
                  "data": {
                    "type": "object",
                    "additionalProperties": true,
                    "properties": {
                      "message": {
                        "type": "object",
                        "additionalProperties": true,
                        "properties": {
                          "id": {
                            "type": "string",
                            "example": "6650a1b2c3d4e5f6a7b8c9d0"
                          },
                          "conversationId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "6650a1b2c3d4e5f6a7b8c9d1"
                          },
                          "contactId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "6650a1b2c3d4e5f6a7b8c9d2"
                          },
                          "channelId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "6650a1b2c3d4e5f6a7b8c9d3"
                          },
                          "direction": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "inbound",
                              "outbound",
                              null
                            ],
                            "example": "outbound"
                          },
                          "type": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "text"
                          },
                          "status": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "sent"
                          },
                          "body": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "Hello from Inaiy!"
                          },
                          "timestamp": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "example": "2026-07-12T09:30:00.000Z"
                          },
                          "providerMessageId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "wamid.HBgLMTQ..."
                          }
                        }
                      }
                    }
                  }
                }
              },
              "example": {
                "event": "message.delivered",
                "eventId": "evt_6650a1b2c3d4e5f6a7b8c9d0_message_delivered",
                "timestamp": "2026-07-12T09:30:05.000Z",
                "data": {
                  "message": {
                    "id": "6650a1b2c3d4e5f6a7b8c9d0",
                    "conversationId": "6650a1b2c3d4e5f6a7b8c9d1",
                    "contactId": "6650a1b2c3d4e5f6a7b8c9d2",
                    "channelId": "6650a1b2c3d4e5f6a7b8c9d3",
                    "direction": "outbound",
                    "type": "text",
                    "status": "delivered",
                    "body": "Hello from Inaiy!",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "providerMessageId": "wamid.HBgLMTQ..."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return any 2xx status to acknowledge receipt."
          }
        }
      }
    },
    "message.read": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Message read",
        "description": "The recipient read an outbound message.\n\nDelivered to your subscribed endpoint(s). Verify the `X-Inaiy-Signature` header before trusting the payload.",
        "operationId": "webhook_message_read",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "required": [
                  "event",
                  "eventId",
                  "timestamp",
                  "data"
                ],
                "properties": {
                  "event": {
                    "type": "string",
                    "enum": [
                      "message.read"
                    ],
                    "example": "message.read"
                  },
                  "eventId": {
                    "type": "string",
                    "example": "evt_6650a1b2c3d4e5f6a7b8c9d0_message_read"
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time",
                    "example": "2026-07-12T09:30:05.000Z"
                  },
                  "data": {
                    "type": "object",
                    "additionalProperties": true,
                    "properties": {
                      "message": {
                        "type": "object",
                        "additionalProperties": true,
                        "properties": {
                          "id": {
                            "type": "string",
                            "example": "6650a1b2c3d4e5f6a7b8c9d0"
                          },
                          "conversationId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "6650a1b2c3d4e5f6a7b8c9d1"
                          },
                          "contactId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "6650a1b2c3d4e5f6a7b8c9d2"
                          },
                          "channelId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "6650a1b2c3d4e5f6a7b8c9d3"
                          },
                          "direction": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "inbound",
                              "outbound",
                              null
                            ],
                            "example": "outbound"
                          },
                          "type": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "text"
                          },
                          "status": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "sent"
                          },
                          "body": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "Hello from Inaiy!"
                          },
                          "timestamp": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "example": "2026-07-12T09:30:00.000Z"
                          },
                          "providerMessageId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "wamid.HBgLMTQ..."
                          }
                        }
                      }
                    }
                  }
                }
              },
              "example": {
                "event": "message.read",
                "eventId": "evt_6650a1b2c3d4e5f6a7b8c9d0_message_read",
                "timestamp": "2026-07-12T09:30:05.000Z",
                "data": {
                  "message": {
                    "id": "6650a1b2c3d4e5f6a7b8c9d0",
                    "conversationId": "6650a1b2c3d4e5f6a7b8c9d1",
                    "contactId": "6650a1b2c3d4e5f6a7b8c9d2",
                    "channelId": "6650a1b2c3d4e5f6a7b8c9d3",
                    "direction": "outbound",
                    "type": "text",
                    "status": "read",
                    "body": "Hello from Inaiy!",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "providerMessageId": "wamid.HBgLMTQ..."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return any 2xx status to acknowledge receipt."
          }
        }
      }
    },
    "message.failed": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Message failed",
        "description": "An outbound message failed to send or deliver.\n\nDelivered to your subscribed endpoint(s). Verify the `X-Inaiy-Signature` header before trusting the payload.",
        "operationId": "webhook_message_failed",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "required": [
                  "event",
                  "eventId",
                  "timestamp",
                  "data"
                ],
                "properties": {
                  "event": {
                    "type": "string",
                    "enum": [
                      "message.failed"
                    ],
                    "example": "message.failed"
                  },
                  "eventId": {
                    "type": "string",
                    "example": "evt_6650a1b2c3d4e5f6a7b8c9d0_message_failed"
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time",
                    "example": "2026-07-12T09:30:05.000Z"
                  },
                  "data": {
                    "type": "object",
                    "additionalProperties": true,
                    "properties": {
                      "message": {
                        "type": "object",
                        "additionalProperties": true,
                        "properties": {
                          "id": {
                            "type": "string",
                            "example": "6650a1b2c3d4e5f6a7b8c9d0"
                          },
                          "conversationId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "6650a1b2c3d4e5f6a7b8c9d1"
                          },
                          "contactId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "6650a1b2c3d4e5f6a7b8c9d2"
                          },
                          "channelId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "6650a1b2c3d4e5f6a7b8c9d3"
                          },
                          "direction": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "inbound",
                              "outbound",
                              null
                            ],
                            "example": "outbound"
                          },
                          "type": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "text"
                          },
                          "status": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "sent"
                          },
                          "body": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "Hello from Inaiy!"
                          },
                          "timestamp": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "example": "2026-07-12T09:30:00.000Z"
                          },
                          "providerMessageId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "wamid.HBgLMTQ..."
                          }
                        }
                      }
                    }
                  }
                }
              },
              "example": {
                "event": "message.failed",
                "eventId": "evt_6650a1b2c3d4e5f6a7b8c9d0_message_failed",
                "timestamp": "2026-07-12T09:30:05.000Z",
                "data": {
                  "message": {
                    "id": "6650a1b2c3d4e5f6a7b8c9d0",
                    "conversationId": "6650a1b2c3d4e5f6a7b8c9d1",
                    "contactId": "6650a1b2c3d4e5f6a7b8c9d2",
                    "channelId": "6650a1b2c3d4e5f6a7b8c9d3",
                    "direction": "outbound",
                    "type": "text",
                    "status": "failed",
                    "body": "Hello from Inaiy!",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "providerMessageId": "wamid.HBgLMTQ..."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return any 2xx status to acknowledge receipt."
          }
        }
      }
    },
    "message.received": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Message received",
        "description": "An inbound message was received from a contact.\n\nDelivered to your subscribed endpoint(s). Verify the `X-Inaiy-Signature` header before trusting the payload.",
        "operationId": "webhook_message_received",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true,
                "required": [
                  "event",
                  "eventId",
                  "timestamp",
                  "data"
                ],
                "properties": {
                  "event": {
                    "type": "string",
                    "enum": [
                      "message.received"
                    ],
                    "example": "message.received"
                  },
                  "eventId": {
                    "type": "string",
                    "example": "evt_6650a1b2c3d4e5f6a7b8c9d0_message_received"
                  },
                  "timestamp": {
                    "type": "string",
                    "format": "date-time",
                    "example": "2026-07-12T09:30:05.000Z"
                  },
                  "data": {
                    "type": "object",
                    "additionalProperties": true,
                    "properties": {
                      "message": {
                        "type": "object",
                        "additionalProperties": true,
                        "properties": {
                          "id": {
                            "type": "string",
                            "example": "6650a1b2c3d4e5f6a7b8c9d0"
                          },
                          "conversationId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "6650a1b2c3d4e5f6a7b8c9d1"
                          },
                          "contactId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "6650a1b2c3d4e5f6a7b8c9d2"
                          },
                          "channelId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "6650a1b2c3d4e5f6a7b8c9d3"
                          },
                          "direction": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "enum": [
                              "inbound",
                              "outbound",
                              null
                            ],
                            "example": "outbound"
                          },
                          "type": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "text"
                          },
                          "status": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "sent"
                          },
                          "body": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "Hello from Inaiy!"
                          },
                          "timestamp": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date-time",
                            "example": "2026-07-12T09:30:00.000Z"
                          },
                          "providerMessageId": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "example": "wamid.HBgLMTQ..."
                          }
                        }
                      }
                    }
                  }
                }
              },
              "example": {
                "event": "message.received",
                "eventId": "evt_6650a1b2c3d4e5f6a7b8c9d0_message_received",
                "timestamp": "2026-07-12T09:30:05.000Z",
                "data": {
                  "message": {
                    "id": "6650a1b2c3d4e5f6a7b8c9d0",
                    "conversationId": "6650a1b2c3d4e5f6a7b8c9d1",
                    "contactId": "6650a1b2c3d4e5f6a7b8c9d2",
                    "channelId": "6650a1b2c3d4e5f6a7b8c9d3",
                    "direction": "inbound",
                    "type": "text",
                    "status": "received",
                    "body": "Hi, I need help.",
                    "timestamp": "2026-07-12T09:30:00.000Z",
                    "providerMessageId": "wamid.HBgLMTQ..."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Return any 2xx status to acknowledge receipt."
          }
        }
      }
    }
  }
}