{
  "openapi": "3.1.0",
  "info": {
    "title": "RelayWA customer API",
    "version": "1.2.0",
    "description": "Outbound WhatsApp messaging through tenant-owned dedicated connections and an INR wallet. Import/upload media before message admission. Each accepted message is charged once at its stored price. Customer accounts receive one ₹10 activation credit. Fund wallets through verified manual UPI top-ups in the dashboard. Idempotency is retained for 30 days; never automatically resend unknown outcomes."
  },
  "servers": [
    {
      "url": "https://transport.ogensync.com"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/v1/messages": {
      "post": {
        "summary": "Accept and charge one message",
        "description": "Required scope: messages:send. Uses the customer's INR wallet. One charge per accepted job; captions, safe retries and receipts do not add charges. The accepted price is fixed for the job. HTTP 402 INSUFFICIENT_WALLET_BALANCE means no job or charge was created. Confirmed pre-send failures/cancellations refund once; unknown outcomes remain charged. Read current prices at GET /api/public/plans; manage wallet funding through the authenticated dashboard.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Message"
              },
              "examples": {
                "text": {
                  "value": {
                    "phone": "+12025550123",
                    "type": "text",
                    "message": "Hello from RelayWA"
                  }
                },
                "image": {
                  "value": {
                    "phone": "+12025550123",
                    "type": "image",
                    "mediaId": "11111111-1111-4111-8111-111111111111",
                    "caption": "A photo",
                    "viewOnce": false
                  }
                },
                "video": {
                  "value": {
                    "phone": "+12025550123",
                    "type": "video",
                    "mediaId": "11111111-1111-4111-8111-111111111111",
                    "caption": "A video",
                    "gifPlayback": false
                  }
                },
                "audio": {
                  "value": {
                    "phone": "+12025550123",
                    "type": "audio",
                    "mediaId": "11111111-1111-4111-8111-111111111111",
                    "ptt": false
                  }
                },
                "voice": {
                  "value": {
                    "phone": "+12025550123",
                    "type": "voice",
                    "mediaId": "11111111-1111-4111-8111-111111111111",
                    "seconds": 12
                  }
                },
                "document": {
                  "value": {
                    "phone": "+12025550123",
                    "type": "document",
                    "mediaId": "11111111-1111-4111-8111-111111111111",
                    "fileName": "invoice.pdf",
                    "caption": "Your invoice"
                  }
                },
                "sticker": {
                  "value": {
                    "phone": "+12025550123",
                    "type": "sticker",
                    "mediaId": "11111111-1111-4111-8111-111111111111",
                    "isAnimated": false
                  }
                },
                "location": {
                  "value": {
                    "phone": "+12025550123",
                    "type": "location",
                    "location": {
                      "latitude": 22.5726,
                      "longitude": 88.3639,
                      "name": "Meeting point"
                    }
                  }
                },
                "contacts": {
                  "value": {
                    "phone": "+12025550123",
                    "type": "contacts",
                    "contacts": [
                      {
                        "name": "Example Contact",
                        "phone": "+12025550124",
                        "organization": "Example"
                      }
                    ]
                  }
                },
                "poll": {
                  "value": {
                    "phone": "+12025550123",
                    "type": "poll",
                    "poll": {
                      "name": "Choose a time",
                      "options": [
                        "Morning",
                        "Afternoon"
                      ],
                      "selectableCount": 1
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Durably accepted and charged once; poll status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageAcceptance"
                }
              }
            }
          },
          "400": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9._:-]+$"
            }
          }
        ]
      },
      "get": {
        "summary": "List owned messages",
        "description": "Required scope: messages:read.",
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageHistory"
                }
              }
            }
          },
          "400": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          }
        ]
      }
    },
    "/v1/messages/{id}": {
      "get": {
        "summary": "Read one owned message",
        "description": "Required scope: messages:read.",
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageStatus"
                }
              }
            }
          },
          "400": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/v1/media/uploads": {
      "post": {
        "summary": "Create an exact-size upload ticket",
        "description": "Required scope: media:write. Media type limits apply: image 10 MiB, video 50 MiB, audio/voice 16 MiB, document 100 MiB, sticker 1 MiB. Current deployment returns multipart tickets with 8 MiB parts and a 15-minute expiry. Direct mode is optional and uses a 5-minute URL grant; never forward the customer API key to that URL.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "type": {
                    "enum": [
                      "image",
                      "video",
                      "audio",
                      "voice",
                      "document",
                      "sticker"
                    ]
                  },
                  "size": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 104857600
                  },
                  "fileName": {
                    "type": "string",
                    "maxLength": 255
                  },
                  "mimetype": {
                    "type": "string",
                    "maxLength": 200
                  }
                },
                "required": [
                  "type",
                  "size"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadTicket"
                }
              }
            }
          },
          "400": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/media/uploads/{id}/parts/{part}": {
      "put": {
        "summary": "Stream one multipart part",
        "description": "Required scope: media:write.",
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UploadPart"
                }
              }
            }
          },
          "400": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "part",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 13
            }
          },
          {
            "name": "X-Upload-Id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 128
            }
          },
          {
            "name": "Content-Length",
            "in": "header",
            "required": true,
            "description": "Exact bytes in this part. Use raw binary, not FormData. Only the last part may be smaller than partSize. HTTP clients derive this from the supplied buffer/file; browsers must not set it manually.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 8388608
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary",
                "maxLength": 8388608
              }
            }
          }
        }
      }
    },
    "/v1/media/uploads/{id}/complete": {
      "post": {
        "summary": "Complete upload and queue byte inspection",
        "description": "Required scope: media:write.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {},
                "required": []
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Durably accepted; poll status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MediaAcceptance"
                }
              }
            }
          },
          "400": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/v1/media/imports": {
      "post": {
        "summary": "Import a public HTTPS file for inspection",
        "description": "Required scope: media:write.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "type": {
                    "enum": [
                      "image",
                      "video",
                      "audio",
                      "voice",
                      "document",
                      "sticker"
                    ]
                  },
                  "url": {
                    "type": "string",
                    "format": "uri",
                    "maxLength": 2048
                  },
                  "fileName": {
                    "type": "string",
                    "maxLength": 255
                  }
                },
                "required": [
                  "type",
                  "url"
                ]
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Durably accepted; poll status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MediaAcceptance"
                }
              }
            }
          },
          "400": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/media/{id}": {
      "get": {
        "summary": "Read media inspection state",
        "description": "Required scope: media:read.",
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MediaStatus"
                }
              }
            }
          },
          "400": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/v1/session": {
      "get": {
        "summary": "Read allocation and connection",
        "description": "Required scope: session:read.",
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionStatus"
                }
              }
            }
          },
          "400": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/session/pairing": {
      "post": {
        "summary": "Start pairing or refresh an expired QR",
        "description": "Required scope: session:manage.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "fresh": {
                    "type": "boolean",
                    "default": true
                  }
                },
                "required": []
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QrSnapshot"
                }
              }
            }
          },
          "400": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/session/qr": {
      "get": {
        "summary": "Read the current private QR snapshot",
        "description": "Required scope: session:manage. Returns qr:null when no current QR is available or the account is connected. Treat QR text/images as private; only poll while someone is pairing. Compare generation and expiresAt before displaying a code.",
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QrSnapshot"
                }
              }
            }
          },
          "400": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/session/disconnect": {
      "post": {
        "summary": "Unlink, clean and release the owned session",
        "description": "Required scope: session:manage. Destructive: unlinks WhatsApp, cleans the owned session and releases its server. A new allocation and pairing are required afterwards.",
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DisconnectResult"
                }
              }
            }
          },
          "400": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/live": {
      "get": {
        "summary": "Gateway process liveness",
        "security": [],
        "responses": {
          "200": {
            "description": "Process is alive"
          }
        }
      }
    },
    "/ready": {
      "get": {
        "summary": "Gateway database readiness",
        "security": [],
        "responses": {
          "200": {
            "description": "Ready"
          },
          "503": {
            "description": "Not ready"
          }
        }
      }
    },
    "/api/public/plans": {
      "get": {
        "summary": "Read the current INR message price catalogue",
        "security": [],
        "responses": {
          "200": {
            "description": "Current prices for new accepted jobs; this is not a wallet balance endpoint",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessagePricing"
                }
              }
            }
          },
          "400": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "504": {
            "description": "Rejected; inspect error.code and error.message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Scoped customer API key; never use a Render worker credential."
      }
    },
    "schemas": {
      "Job": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 128
          },
          "jobId": {
            "type": "string",
            "maxLength": 128
          },
          "status": {
            "$ref": "#/components/schemas/JobStatus"
          },
          "type": {
            "type": "string",
            "maxLength": 32
          },
          "phone": {
            "type": "string",
            "description": "International number including country calling code; normalized to E.164",
            "example": "+12025550123"
          },
          "preview": {
            "type": "string",
            "maxLength": 1024
          },
          "attempts": {
            "type": "integer",
            "minimum": 0
          },
          "currency": {
            "const": "INR"
          },
          "chargePaise": {
            "type": "integer",
            "minimum": 0
          },
          "refundedPaise": {
            "type": "integer",
            "minimum": 0
          },
          "pricingRevision": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1
          },
          "billingType": {
            "type": [
              "string",
              "null"
            ]
          },
          "messageId": {
            "type": [
              "string",
              "null"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "sentAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "deliveredAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "readAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "nextAttemptAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "error": {
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "code": {
                    "type": "string",
                    "maxLength": 128
                  }
                },
                "required": [
                  "code"
                ]
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "jobId",
          "status",
          "attempts",
          "currency",
          "chargePaise",
          "refundedPaise"
        ]
      },
      "MessageStatus": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "job": {
            "$ref": "#/components/schemas/Job"
          }
        },
        "required": [
          "job"
        ]
      },
      "MessageHistory": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Job"
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "UploadTicket": {
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "mediaId": {
                "type": "string",
                "format": "uuid"
              },
              "uploadId": {
                "type": "string",
                "maxLength": 128
              },
              "mode": {
                "const": "multipart"
              },
              "partSize": {
                "type": "integer",
                "const": 8388608
              },
              "expiresAt": {
                "type": "integer",
                "minimum": 0,
                "description": "Unix epoch milliseconds"
              }
            },
            "required": [
              "mediaId",
              "uploadId",
              "mode",
              "partSize",
              "expiresAt"
            ]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "mediaId": {
                "type": "string",
                "format": "uuid"
              },
              "uploadId": {
                "type": "string",
                "maxLength": 128
              },
              "mode": {
                "const": "direct"
              },
              "url": {
                "type": "string",
                "format": "uri"
              },
              "headers": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "expiresAt": {
                "type": "integer",
                "minimum": 0,
                "description": "Unix epoch milliseconds"
              }
            },
            "required": [
              "mediaId",
              "uploadId",
              "mode",
              "url",
              "headers",
              "expiresAt"
            ]
          }
        ]
      },
      "UploadPart": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "partNumber": {
            "type": "integer",
            "minimum": 1
          },
          "etag": {
            "type": "string",
            "maxLength": 256
          }
        },
        "required": [
          "partNumber",
          "etag"
        ]
      },
      "MediaAcceptance": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "mediaId": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "maxLength": 32
          }
        },
        "required": [
          "mediaId",
          "status"
        ]
      },
      "Media": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "enum": [
              "image",
              "video",
              "audio",
              "voice",
              "document",
              "sticker"
            ]
          },
          "status": {
            "enum": [
              "pending",
              "import_pending",
              "uploaded",
              "inspecting",
              "ready",
              "failed",
              "expired"
            ]
          },
          "size": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "mimetype": {
            "type": "string",
            "maxLength": 200
          },
          "fileName": {
            "type": [
              "string",
              "null"
            ]
          },
          "expiresAt": {
            "type": "integer",
            "minimum": 0,
            "description": "Unix epoch milliseconds"
          },
          "error": {
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "code": {
                    "type": "string",
                    "maxLength": 128
                  }
                },
                "required": [
                  "code"
                ]
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "type",
          "status",
          "expiresAt"
        ]
      },
      "MediaStatus": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "media": {
            "$ref": "#/components/schemas/Media"
          }
        },
        "required": [
          "media"
        ]
      },
      "SessionStatus": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "assignment": {
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "id": {
                    "type": "string",
                    "maxLength": 128
                  },
                  "status": {
                    "type": "string",
                    "maxLength": 32
                  }
                },
                "required": [
                  "id",
                  "status"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "connection": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "connected": {
                "type": "boolean"
              },
              "state": {
                "type": "string",
                "maxLength": 64
              }
            },
            "required": [
              "connected",
              "state"
            ]
          },
          "waiting": {
            "type": "boolean"
          }
        },
        "required": [
          "assignment",
          "connection",
          "waiting"
        ]
      },
      "QrSnapshot": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "state": {
            "type": "string",
            "maxLength": 64
          },
          "connected": {
            "type": "boolean"
          },
          "qr": {
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "text": {
                    "type": "string",
                    "maxLength": 8192
                  },
                  "imageDataUrl": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "expiresAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "generation": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{24}$"
                  }
                },
                "required": [
                  "text",
                  "imageDataUrl",
                  "expiresAt",
                  "generation"
                ]
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "state",
          "connected",
          "qr"
        ]
      },
      "DisconnectResult": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "disconnected": {
            "type": "boolean"
          },
          "requiresPairing": {
            "type": "boolean"
          }
        },
        "required": [
          "disconnected",
          "requiresPairing"
        ]
      },
      "Message": {
        "oneOf": [
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "phone": {
                "type": "string",
                "description": "International number including country calling code; normalized to E.164",
                "example": "+12025550123"
              },
              "type": {
                "const": "text"
              },
              "message": {
                "type": "string",
                "maxLength": 4096,
                "minLength": 1
              }
            },
            "required": [
              "phone",
              "type",
              "message"
            ]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "phone": {
                "type": "string",
                "description": "International number including country calling code; normalized to E.164",
                "example": "+12025550123"
              },
              "type": {
                "const": "image"
              },
              "mediaId": {
                "type": "string",
                "format": "uuid"
              },
              "mimetype": {
                "type": "string",
                "maxLength": 200
              },
              "caption": {
                "type": "string",
                "maxLength": 1024
              },
              "viewOnce": {
                "type": "boolean"
              }
            },
            "required": [
              "phone",
              "type",
              "mediaId"
            ]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "phone": {
                "type": "string",
                "description": "International number including country calling code; normalized to E.164",
                "example": "+12025550123"
              },
              "type": {
                "const": "video"
              },
              "mediaId": {
                "type": "string",
                "format": "uuid"
              },
              "mimetype": {
                "type": "string",
                "maxLength": 200
              },
              "caption": {
                "type": "string",
                "maxLength": 1024
              },
              "gifPlayback": {
                "type": "boolean"
              },
              "viewOnce": {
                "type": "boolean"
              }
            },
            "required": [
              "phone",
              "type",
              "mediaId"
            ]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "phone": {
                "type": "string",
                "description": "International number including country calling code; normalized to E.164",
                "example": "+12025550123"
              },
              "type": {
                "const": "audio"
              },
              "mediaId": {
                "type": "string",
                "format": "uuid"
              },
              "mimetype": {
                "type": "string",
                "maxLength": 200
              },
              "ptt": {
                "type": "boolean"
              },
              "seconds": {
                "type": "integer",
                "minimum": 0,
                "maximum": 86400
              },
              "viewOnce": {
                "type": "boolean"
              }
            },
            "required": [
              "phone",
              "type",
              "mediaId"
            ]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "phone": {
                "type": "string",
                "description": "International number including country calling code; normalized to E.164",
                "example": "+12025550123"
              },
              "type": {
                "const": "voice"
              },
              "mediaId": {
                "type": "string",
                "format": "uuid"
              },
              "mimetype": {
                "type": "string",
                "maxLength": 200
              },
              "seconds": {
                "type": "integer",
                "minimum": 0,
                "maximum": 86400
              },
              "viewOnce": {
                "type": "boolean"
              }
            },
            "required": [
              "phone",
              "type",
              "mediaId"
            ]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "phone": {
                "type": "string",
                "description": "International number including country calling code; normalized to E.164",
                "example": "+12025550123"
              },
              "type": {
                "const": "document"
              },
              "mediaId": {
                "type": "string",
                "format": "uuid"
              },
              "mimetype": {
                "type": "string",
                "maxLength": 200
              },
              "caption": {
                "type": "string",
                "maxLength": 1024
              },
              "fileName": {
                "type": "string",
                "maxLength": 255
              }
            },
            "required": [
              "phone",
              "type",
              "mediaId"
            ]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "phone": {
                "type": "string",
                "description": "International number including country calling code; normalized to E.164",
                "example": "+12025550123"
              },
              "type": {
                "const": "sticker"
              },
              "mediaId": {
                "type": "string",
                "format": "uuid"
              },
              "mimetype": {
                "type": "string",
                "maxLength": 200
              },
              "isAnimated": {
                "type": "boolean"
              }
            },
            "required": [
              "phone",
              "type",
              "mediaId"
            ]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "phone": {
                "type": "string",
                "description": "International number including country calling code; normalized to E.164",
                "example": "+12025550123"
              },
              "type": {
                "const": "location"
              },
              "location": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "latitude": {
                    "type": "number",
                    "minimum": -90,
                    "maximum": 90
                  },
                  "longitude": {
                    "type": "number",
                    "minimum": -180,
                    "maximum": 180
                  },
                  "name": {
                    "type": "string",
                    "maxLength": 256
                  },
                  "address": {
                    "type": "string",
                    "maxLength": 1024
                  }
                },
                "required": [
                  "latitude",
                  "longitude"
                ]
              }
            },
            "required": [
              "phone",
              "type",
              "location"
            ]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "phone": {
                "type": "string",
                "description": "International number including country calling code; normalized to E.164",
                "example": "+12025550123"
              },
              "type": {
                "const": "contacts"
              },
              "contacts": {
                "type": "array",
                "minItems": 1,
                "maxItems": 20,
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "name": {
                      "type": "string",
                      "maxLength": 256
                    },
                    "phone": {
                      "type": "string",
                      "description": "International number including country calling code; normalized to E.164",
                      "example": "+12025550123"
                    },
                    "organization": {
                      "type": "string",
                      "maxLength": 256
                    },
                    "email": {
                      "type": "string",
                      "maxLength": 254,
                      "format": "email"
                    }
                  },
                  "required": [
                    "name",
                    "phone"
                  ]
                }
              },
              "displayName": {
                "type": "string",
                "maxLength": 256
              }
            },
            "required": [
              "phone",
              "type",
              "contacts"
            ]
          },
          {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "phone": {
                "type": "string",
                "description": "International number including country calling code; normalized to E.164",
                "example": "+12025550123"
              },
              "type": {
                "const": "poll"
              },
              "poll": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 256
                  },
                  "options": {
                    "type": "array",
                    "minItems": 2,
                    "maxItems": 12,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "maxLength": 100
                    }
                  },
                  "selectableCount": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 12
                  }
                },
                "required": [
                  "name",
                  "options"
                ]
              }
            },
            "required": [
              "phone",
              "type",
              "poll"
            ]
          }
        ],
        "discriminator": {
          "propertyName": "type"
        }
      },
      "MessageAcceptance": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "jobId": {
            "type": "string",
            "maxLength": 128
          },
          "status": {
            "$ref": "#/components/schemas/JobStatus"
          },
          "statusUrl": {
            "type": "string",
            "maxLength": 256
          },
          "replayed": {
            "type": "boolean"
          },
          "chargePaise": {
            "type": "integer",
            "minimum": 0
          },
          "refundedPaise": {
            "type": "integer",
            "minimum": 0
          },
          "currency": {
            "const": "INR"
          },
          "pricingRevision": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1
          }
        },
        "required": [
          "jobId",
          "status",
          "statusUrl",
          "replayed"
        ]
      },
      "MessagePricing": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "billingMode": {
            "const": "wallet"
          },
          "currency": {
            "const": "INR"
          },
          "activationCreditPaise": {
            "type": "integer",
            "const": 1000
          },
          "welcomeCreditPaise": {
            "type": "integer",
            "const": 1000
          },
          "upiId": {
            "type": "string",
            "maxLength": 256
          },
          "revision": {
            "type": "integer",
            "minimum": 1
          },
          "configured": {
            "type": "boolean"
          },
          "rates": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "type": {
                  "enum": [
                    "text",
                    "image",
                    "video",
                    "audio",
                    "voice",
                    "document",
                    "sticker",
                    "location",
                    "contacts",
                    "poll"
                  ]
                },
                "pricePaise": {
                  "type": "integer",
                  "minimum": 0
                },
                "enabled": {
                  "type": "boolean"
                },
                "revision": {
                  "type": "integer",
                  "minimum": 1
                }
              },
              "required": [
                "type",
                "pricePaise",
                "enabled",
                "revision"
              ]
            }
          }
        },
        "required": [
          "billingMode",
          "currency",
          "rates"
        ]
      },
      "Error": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "error": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "code": {
                "type": "string",
                "maxLength": 200
              },
              "message": {
                "type": "string",
                "maxLength": 1000
              },
              "requestId": {
                "type": "string",
                "maxLength": 128
              }
            },
            "required": [
              "code",
              "message"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "JobStatus": {
        "enum": [
          "queued",
          "processing",
          "retry_wait",
          "sent",
          "delivered",
          "read",
          "failed",
          "cancelled",
          "unknown"
        ]
      }
    }
  }
}
