{
  "openapi": "3.1.0",
  "info": {
    "title": "QuackAPI messaging API",
    "version": "1.0.0",
    "description": "Send WhatsApp messages from your own application through a number linked with a QR code. This is a linked-device integration, separate from Meta's official WhatsApp Cloud API.",
    "termsOfService": "https://quackapi.com/terms",
    "contact": {
      "name": "QuackAPI support",
      "url": "https://quackapi.com/contact"
    }
  },
  "servers": [
    {
      "url": "https://quackapi.com"
    }
  ],
  "externalDocs": {
    "description": "Full documentation",
    "url": "https://quackapi.com/docs"
  },
  "tags": [
    {
      "name": "Messages",
      "description": "Send messages from a connected device."
    }
  ],
  "paths": {
    "/v1/messages/chat": {
      "post": {
        "operationId": "sendText",
        "summary": "Send a text message",
        "description": "Queues the message on the chosen device. A successful response means the request was accepted for sending, not that the recipient received it. Delivery results arrive on your webhook.",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "deviceId",
                  "to",
                  "body"
                ],
                "properties": {
                  "deviceId": {
                    "type": "integer",
                    "description": "The connected device (WhatsApp number) that sends the message. Find it on the device page.",
                    "example": 1
                  },
                  "to": {
                    "type": "string",
                    "description": "Recipient number in international format, digits only (no plus sign or spaces).",
                    "example": "923001234567"
                  },
                  "body": {
                    "type": "string",
                    "description": "The message text.",
                    "example": "Your verification code is 482 913"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Accepted and queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Queued"
                }
              }
            }
          },
          "400": {
            "description": "Validation error. The message names the field.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API key missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Account suspended, subscription inactive, or the device is disconnected or disabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Device not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Device is not ready yet. Retry after a pause.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Daily message limit for the plan reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/messages/image": {
      "post": {
        "operationId": "sendImage",
        "summary": "Send an image",
        "description": "Queues the message on the chosen device. A successful response means the request was accepted for sending, not that the recipient received it. Delivery results arrive on your webhook.",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "deviceId",
                  "to",
                  "image"
                ],
                "properties": {
                  "deviceId": {
                    "type": "integer",
                    "description": "The connected device (WhatsApp number) that sends the message. Find it on the device page.",
                    "example": 1
                  },
                  "to": {
                    "type": "string",
                    "description": "Recipient number in international format, digits only (no plus sign or spaces).",
                    "example": "923001234567"
                  },
                  "image": {
                    "type": "string",
                    "description": "Public URL of the image.",
                    "example": "https://example.com/photo.jpg"
                  },
                  "caption": {
                    "type": "string",
                    "description": "Optional caption.",
                    "example": "Your order"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Accepted and queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Queued"
                }
              }
            }
          },
          "400": {
            "description": "Validation error. The message names the field.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API key missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Account suspended, subscription inactive, or the device is disconnected or disabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Device not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Device is not ready yet. Retry after a pause.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Daily message limit for the plan reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/messages/video": {
      "post": {
        "operationId": "sendVideo",
        "summary": "Send a video",
        "description": "Queues the message on the chosen device. A successful response means the request was accepted for sending, not that the recipient received it. Delivery results arrive on your webhook.",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "deviceId",
                  "to",
                  "video"
                ],
                "properties": {
                  "deviceId": {
                    "type": "integer",
                    "description": "The connected device (WhatsApp number) that sends the message. Find it on the device page.",
                    "example": 1
                  },
                  "to": {
                    "type": "string",
                    "description": "Recipient number in international format, digits only (no plus sign or spaces).",
                    "example": "923001234567"
                  },
                  "video": {
                    "type": "string",
                    "description": "Public URL of the video.",
                    "example": "https://example.com/clip.mp4"
                  },
                  "caption": {
                    "type": "string",
                    "description": "Optional caption."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Accepted and queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Queued"
                }
              }
            }
          },
          "400": {
            "description": "Validation error. The message names the field.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API key missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Account suspended, subscription inactive, or the device is disconnected or disabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Device not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Device is not ready yet. Retry after a pause.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Daily message limit for the plan reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/messages/audio": {
      "post": {
        "operationId": "sendAudio",
        "summary": "Send an audio message",
        "description": "Queues the message on the chosen device. A successful response means the request was accepted for sending, not that the recipient received it. Delivery results arrive on your webhook.",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "deviceId",
                  "to",
                  "audio"
                ],
                "properties": {
                  "deviceId": {
                    "type": "integer",
                    "description": "The connected device (WhatsApp number) that sends the message. Find it on the device page.",
                    "example": 1
                  },
                  "to": {
                    "type": "string",
                    "description": "Recipient number in international format, digits only (no plus sign or spaces).",
                    "example": "923001234567"
                  },
                  "audio": {
                    "type": "string",
                    "description": "Public URL of the audio file.",
                    "example": "https://example.com/note.mp3"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Accepted and queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Queued"
                }
              }
            }
          },
          "400": {
            "description": "Validation error. The message names the field.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API key missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Account suspended, subscription inactive, or the device is disconnected or disabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Device not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Device is not ready yet. Retry after a pause.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Daily message limit for the plan reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/messages/document": {
      "post": {
        "operationId": "sendDocument",
        "summary": "Send a document",
        "description": "Queues the message on the chosen device. A successful response means the request was accepted for sending, not that the recipient received it. Delivery results arrive on your webhook.",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "deviceId",
                  "to",
                  "document"
                ],
                "properties": {
                  "deviceId": {
                    "type": "integer",
                    "description": "The connected device (WhatsApp number) that sends the message. Find it on the device page.",
                    "example": 1
                  },
                  "to": {
                    "type": "string",
                    "description": "Recipient number in international format, digits only (no plus sign or spaces).",
                    "example": "923001234567"
                  },
                  "document": {
                    "type": "string",
                    "description": "Public URL of the document.",
                    "example": "https://example.com/invoice.pdf"
                  },
                  "filename": {
                    "type": "string",
                    "description": "File name shown to the recipient.",
                    "example": "invoice.pdf"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Accepted and queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Queued"
                }
              }
            }
          },
          "400": {
            "description": "Validation error. The message names the field.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API key missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Account suspended, subscription inactive, or the device is disconnected or disabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Device not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Device is not ready yet. Retry after a pause.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Daily message limit for the plan reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/messages/link": {
      "post": {
        "operationId": "sendLink",
        "summary": "Send a link",
        "description": "Queues the message on the chosen device. A successful response means the request was accepted for sending, not that the recipient received it. Delivery results arrive on your webhook.",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "deviceId",
                  "to",
                  "link"
                ],
                "properties": {
                  "deviceId": {
                    "type": "integer",
                    "description": "The connected device (WhatsApp number) that sends the message. Find it on the device page.",
                    "example": 1
                  },
                  "to": {
                    "type": "string",
                    "description": "Recipient number in international format, digits only (no plus sign or spaces).",
                    "example": "923001234567"
                  },
                  "link": {
                    "type": "string",
                    "description": "The URL to send.",
                    "example": "https://example.com/track/1042"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Accepted and queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Queued"
                }
              }
            }
          },
          "400": {
            "description": "Validation error. The message names the field.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API key missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Account suspended, subscription inactive, or the device is disconnected or disabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Device not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Device is not ready yet. Retry after a pause.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Daily message limit for the plan reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/messages/contact": {
      "post": {
        "operationId": "sendContact",
        "summary": "Send a contact",
        "description": "Queues the message on the chosen device. A successful response means the request was accepted for sending, not that the recipient received it. Delivery results arrive on your webhook.",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "deviceId",
                  "to",
                  "contact"
                ],
                "properties": {
                  "deviceId": {
                    "type": "integer",
                    "description": "The connected device (WhatsApp number) that sends the message. Find it on the device page.",
                    "example": 1
                  },
                  "to": {
                    "type": "string",
                    "description": "Recipient number in international format, digits only (no plus sign or spaces).",
                    "example": "923001234567"
                  },
                  "contact": {
                    "type": "string",
                    "description": "The contact to share.",
                    "example": "923001234567"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Accepted and queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Queued"
                }
              }
            }
          },
          "400": {
            "description": "Validation error. The message names the field.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API key missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Account suspended, subscription inactive, or the device is disconnected or disabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Device not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Device is not ready yet. Retry after a pause.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Daily message limit for the plan reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/messages/location": {
      "post": {
        "operationId": "sendLocation",
        "summary": "Send a location",
        "description": "Queues the message on the chosen device. A successful response means the request was accepted for sending, not that the recipient received it. Delivery results arrive on your webhook.",
        "tags": [
          "Messages"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "deviceId",
                  "to",
                  "lat",
                  "lng"
                ],
                "properties": {
                  "deviceId": {
                    "type": "integer",
                    "description": "The connected device (WhatsApp number) that sends the message. Find it on the device page.",
                    "example": 1
                  },
                  "to": {
                    "type": "string",
                    "description": "Recipient number in international format, digits only (no plus sign or spaces).",
                    "example": "923001234567"
                  },
                  "lat": {
                    "type": "string",
                    "description": "Latitude.",
                    "example": "24.8607"
                  },
                  "lng": {
                    "type": "string",
                    "description": "Longitude.",
                    "example": "67.0011"
                  },
                  "address": {
                    "type": "string",
                    "description": "Optional address label.",
                    "example": "Karachi"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Accepted and queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Queued"
                }
              }
            }
          },
          "400": {
            "description": "Validation error. The message names the field.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "API key missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Account suspended, subscription inactive, or the device is disconnected or disabled.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Device not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Device is not ready yet. Retry after a pause.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Daily message limit for the plan reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "Your API key from the dashboard. It starts with wa_. Call the API from your server, never from a browser."
      }
    },
    "schemas": {
      "Queued": {
        "type": "object",
        "required": [
          "success",
          "messageId",
          "status"
        ],
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "messageId": {
            "type": "integer",
            "example": 1042
          },
          "status": {
            "type": "string",
            "enum": [
              "queued"
            ],
            "example": "queued"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "message"
        ],
        "properties": {
          "message": {
            "type": "string",
            "example": "Device not found"
          },
          "code": {
            "type": "string",
            "description": "Present on some errors, for example DEVICE_NOT_READY.",
            "example": "DEVICE_NOT_READY"
          },
          "field": {
            "type": "string",
            "description": "The invalid field, on validation errors."
          }
        }
      }
    }
  }
}