{
  "openapi": "3.1.0",
  "info": {
    "title": "M-Box API",
    "version": "1.0.0",
    "description": "Short links, QR codes, routing, analytics and conversions for India-first businesses. See https://m-box.in/docs/api/"
  },
  "servers": [
    {
      "url": "https://m-box.in/api"
    }
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "tags": [
    {
      "name": "Links",
      "description": "Create, find, change and retire short links."
    },
    {
      "name": "Routing and scheduling",
      "description": "Send each visitor to the right place, and change destinations on a timetable."
    },
    {
      "name": "QR codes",
      "description": "Saved QR designs. Scans are counted apart from clicks."
    },
    {
      "name": "Saved templates",
      "description": "QR designs, link settings, UTM tag sets and landing pages saved once and named in any call with template."
    },
    {
      "name": "Analytics and reports",
      "description": "Clicks, unique visitors, devices, places and reports for any slice of links."
    },
    {
      "name": "Conversions",
      "description": "Leads, sign-ups and sales credited to the link that brought each visitor."
    },
    {
      "name": "Bulk and imports",
      "description": "Thousands of links at once from JSON or a CSV file."
    },
    {
      "name": "Landing pages",
      "description": "Pages built with blocks or your own code, with enquiries and taps."
    },
    {
      "name": "Dashboards and email reports",
      "description": "Read-only live dashboards and scheduled email reports."
    },
    {
      "name": "Webhooks and domains",
      "description": "Real-time events, and short links on your own domain."
    },
    {
      "name": "Account, keys and logs",
      "description": "Plan limits, API keys, audit history, request logs and failures."
    },
    {
      "name": "Notifications and preferences",
      "description": "Alerts for your account, saved templates and views, feedback and data settings."
    },
    {
      "name": "Partners and agencies",
      "description": "Affiliate programme, rewards and payouts, client accounts, branding and approvals."
    },
    {
      "name": "Sales follow-up",
      "description": "Enquiries, follow-up tasks, opt-outs, message templates and delivery reports."
    },
    {
      "name": "Insights and tools",
      "description": "Attribution, funnels, customer value, link checks, impact, GS1 product links and protected files."
    },
    {
      "name": "Teams, sign-in and apps",
      "description": "Workspaces, member access limits, agency templates, passkeys, OAuth apps, quality scores and self-optimising tests."
    },
    {
      "name": "Forecasts, tests and safety",
      "description": "Forecasts with ranges, unusual traffic, creative and device tests, journey checks, catalog links, compliance rules and approvals."
    },
    {
      "name": "Pixels, alerts, guard and certificates",
      "description": "Retargeting pixels on short links, team-chat alerts, the destination guard and verified click certificates."
    },
    {
      "name": "Public tools",
      "description": "No API key needed."
    }
  ],
  "paths": {
    "/v1/links": {
      "post": {
        "tags": [
          "Links"
        ],
        "summary": "Create a link",
        "description": "Makes one short link. Send external_id (your own ID) to make retries safe: the same ID returns the existing link with 200 and existing: true instead of a duplicate.",
        "operationId": "createALink",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "short_url": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "active_from": {
                      "type": "null"
                    },
                    "expires_at": {
                      "type": "string"
                    },
                    "max_clicks": {
                      "type": "null"
                    },
                    "clicks": {
                      "type": "integer"
                    },
                    "has_password": {
                      "type": "boolean"
                    },
                    "tags": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "campaign": {
                      "type": "string"
                    },
                    "reference": {
                      "type": "string"
                    },
                    "external_id": {
                      "type": "string"
                    },
                    "state": {
                      "type": "null"
                    },
                    "title": {
                      "type": "string"
                    },
                    "notes": {
                      "type": "null"
                    },
                    "favorite": {
                      "type": "boolean"
                    },
                    "archived": {
                      "type": "boolean"
                    },
                    "redirect_type": {
                      "type": "integer"
                    },
                    "fallback_url": {
                      "type": "null"
                    },
                    "track_conversions": {
                      "type": "boolean"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "8b0f…",
                  "code": "diwali",
                  "short_url": "https://m-bx.to/diwali",
                  "url": "https://shop.example.in/sale?utm_source=sms",
                  "status": "active",
                  "active_from": null,
                  "expires_at": "2026-12-31T18:29:59Z",
                  "max_clicks": null,
                  "clicks": 1284,
                  "has_password": false,
                  "tags": [
                    "sms",
                    "festive"
                  ],
                  "campaign": "diwali-2026",
                  "reference": "Chennai stores",
                  "external_id": "ORD-1001",
                  "state": null,
                  "title": "Diwali SMS – Chennai",
                  "notes": null,
                  "favorite": false,
                  "archived": false,
                  "redirect_type": 302,
                  "fallback_url": null,
                  "track_conversions": true,
                  "created_at": "2026-11-01T09:12:00Z",
                  "updated_at": "2026-11-02T11:00:00Z"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "Destination, http:// or https://, up to 2,048 characters."
                  },
                  "alias": {
                    "type": "string",
                    "description": "Custom back-half, 3–40 letters, digits, - or _. Free plan: 3 a month."
                  },
                  "external_id": {
                    "type": "string",
                    "description": "Your unique ID for this link (1–100 characters; no spaces, quotes, < or >)."
                  },
                  "title": {
                    "type": "string",
                    "description": "Name for you and your team."
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Up to 20 tags, each up to 40 characters: letters in any language, numbers, spaces and - _ . : only."
                  },
                  "campaign": {
                    "type": "string",
                    "description": "Campaign name, up to 60 characters: letters in any language, numbers, spaces and - _ . : only."
                  },
                  "expires_in": {
                    "type": "string",
                    "description": "Instead of expires_at: 30m, 12h, 7d or 2w."
                  },
                  "track_conversions": {
                    "type": "boolean",
                    "description": "Adds mbx_cid to the destination so conversions can be credited."
                  },
                  "template": {
                    "type": "string",
                    "description": "A saved link template: name, id or default. Fills campaign, tags, expiry, click limit, UTM tags and more; fields you send win. With a QR design it also makes the QR code (qr_code)."
                  },
                  "utm_template": {
                    "type": "string",
                    "description": "A saved UTM set; its tags are added to the destination."
                  },
                  "if_exists": {
                    "type": "string",
                    "description": "error: return 409 instead of the existing link when external_id is already used."
                  },
                  "notes": {
                    "type": "string",
                    "description": "Free text, up to 2,000 characters."
                  },
                  "reference": {
                    "type": "string",
                    "description": "Free reference, up to 200 characters; no quotes, < or >."
                  },
                  "expires_at": {
                    "type": "string",
                    "description": "When the link stops working."
                  },
                  "active_from": {
                    "type": "string",
                    "description": "When the link starts working."
                  },
                  "max_clicks": {
                    "type": "integer",
                    "description": "Stop after this many clicks (1 = one-time link)."
                  },
                  "password": {
                    "type": "string",
                    "description": "Visitors must enter it (4–72 characters)."
                  },
                  "redirect_type": {
                    "type": "integer",
                    "description": "301, 302 (default), 307 or 308."
                  },
                  "fallback_url": {
                    "type": "string",
                    "description": "Where to send visitors when the link is paused, expired, not started or outside its hours."
                  }
                },
                "required": [
                  "url"
                ]
              },
              "example": {
                "url": "https://shop.example.in/sale?utm_source=sms",
                "alias": "diwali",
                "external_id": "ORD-1001",
                "title": "Diwali SMS – Chennai",
                "tags": [
                  "sms",
                  "festive"
                ],
                "campaign": "diwali-2026",
                "expires_in": "30d",
                "track_conversions": true
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Links"
        ],
        "summary": "List links",
        "description": "Newest first, up to 200 per page. Archived links are hidden unless asked for. Pass next_cursor back as cursor for the next page.",
        "operationId": "listLinks",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "1–200, default 50.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "next_cursor from the previous page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Search code, destination, title, reference and external_id.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "campaign",
            "in": "query",
            "required": false,
            "description": "",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tag",
            "in": "query",
            "required": false,
            "description": "One tag.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tags",
            "in": "query",
            "required": false,
            "description": "Comma-separated; the link must have all of them.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "active, disabled or blocked.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "external_id",
            "in": "query",
            "required": false,
            "description": "Exact match.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "external_id_prefix",
            "in": "query",
            "required": false,
            "description": "Starts with.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "favorite",
            "in": "query",
            "required": false,
            "description": "true for favourites only.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "archived",
            "in": "query",
            "required": false,
            "description": "include or only.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "links": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "code": {
                            "type": "string"
                          },
                          "short_url": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string"
                          },
                          "active_from": {
                            "type": "null"
                          },
                          "expires_at": {
                            "type": "string"
                          },
                          "max_clicks": {
                            "type": "null"
                          },
                          "clicks": {
                            "type": "integer"
                          },
                          "has_password": {
                            "type": "boolean"
                          },
                          "tags": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "campaign": {
                            "type": "string"
                          },
                          "reference": {
                            "type": "string"
                          },
                          "external_id": {
                            "type": "string"
                          },
                          "state": {
                            "type": "null"
                          },
                          "title": {
                            "type": "string"
                          },
                          "notes": {
                            "type": "null"
                          },
                          "favorite": {
                            "type": "boolean"
                          },
                          "archived": {
                            "type": "boolean"
                          },
                          "redirect_type": {
                            "type": "integer"
                          },
                          "fallback_url": {
                            "type": "null"
                          },
                          "track_conversions": {
                            "type": "boolean"
                          },
                          "created_at": {
                            "type": "string"
                          },
                          "updated_at": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "next_cursor": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "links": [
                    {
                      "id": "8b0f…",
                      "code": "diwali",
                      "short_url": "https://m-bx.to/diwali",
                      "url": "https://shop.example.in/sale?utm_source=sms",
                      "status": "active",
                      "active_from": null,
                      "expires_at": "2026-12-31T18:29:59Z",
                      "max_clicks": null,
                      "clicks": 1284,
                      "has_password": false,
                      "tags": [
                        "sms",
                        "festive"
                      ],
                      "campaign": "diwali-2026",
                      "reference": "Chennai stores",
                      "external_id": "ORD-1001",
                      "state": null,
                      "title": "Diwali SMS – Chennai",
                      "notes": null,
                      "favorite": false,
                      "archived": false,
                      "redirect_type": 302,
                      "fallback_url": null,
                      "track_conversions": true,
                      "created_at": "2026-11-01T09:12:00Z",
                      "updated_at": "2026-11-02T11:00:00Z"
                    }
                  ],
                  "next_cursor": "2026-11-01T09:12:00Z"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/links/{code}": {
      "get": {
        "tags": [
          "Links"
        ],
        "summary": "Get a link",
        "description": "",
        "operationId": "getALink",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "diwali"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "short_url": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "active_from": {
                      "type": "null"
                    },
                    "expires_at": {
                      "type": "string"
                    },
                    "max_clicks": {
                      "type": "null"
                    },
                    "clicks": {
                      "type": "integer"
                    },
                    "has_password": {
                      "type": "boolean"
                    },
                    "tags": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "campaign": {
                      "type": "string"
                    },
                    "reference": {
                      "type": "string"
                    },
                    "external_id": {
                      "type": "string"
                    },
                    "state": {
                      "type": "null"
                    },
                    "title": {
                      "type": "string"
                    },
                    "notes": {
                      "type": "null"
                    },
                    "favorite": {
                      "type": "boolean"
                    },
                    "archived": {
                      "type": "boolean"
                    },
                    "redirect_type": {
                      "type": "integer"
                    },
                    "fallback_url": {
                      "type": "null"
                    },
                    "track_conversions": {
                      "type": "boolean"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "8b0f…",
                  "code": "diwali",
                  "short_url": "https://m-bx.to/diwali",
                  "url": "https://shop.example.in/sale?utm_source=sms",
                  "status": "active",
                  "active_from": null,
                  "expires_at": "2026-12-31T18:29:59Z",
                  "max_clicks": null,
                  "clicks": 1284,
                  "has_password": false,
                  "tags": [
                    "sms",
                    "festive"
                  ],
                  "campaign": "diwali-2026",
                  "reference": "Chennai stores",
                  "external_id": "ORD-1001",
                  "state": null,
                  "title": "Diwali SMS – Chennai",
                  "notes": null,
                  "favorite": false,
                  "archived": false,
                  "redirect_type": 302,
                  "fallback_url": null,
                  "track_conversions": true,
                  "created_at": "2026-11-01T09:12:00Z",
                  "updated_at": "2026-11-02T11:00:00Z"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Links"
        ],
        "summary": "Change a link",
        "description": "Send only what changes. The printed or shared short link keeps working. Every change is kept as a version.",
        "operationId": "changeALink",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "diwali"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "short_url": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "active_from": {
                      "type": "null"
                    },
                    "expires_at": {
                      "type": "string"
                    },
                    "max_clicks": {
                      "type": "null"
                    },
                    "clicks": {
                      "type": "integer"
                    },
                    "has_password": {
                      "type": "boolean"
                    },
                    "tags": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "campaign": {
                      "type": "string"
                    },
                    "reference": {
                      "type": "string"
                    },
                    "external_id": {
                      "type": "string"
                    },
                    "state": {
                      "type": "null"
                    },
                    "title": {
                      "type": "string"
                    },
                    "notes": {
                      "type": "null"
                    },
                    "favorite": {
                      "type": "boolean"
                    },
                    "archived": {
                      "type": "boolean"
                    },
                    "redirect_type": {
                      "type": "integer"
                    },
                    "fallback_url": {
                      "type": "null"
                    },
                    "track_conversions": {
                      "type": "boolean"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "8b0f…",
                  "code": "diwali",
                  "short_url": "https://m-bx.to/diwali",
                  "url": "https://shop.example.in/sale-extended",
                  "status": "active",
                  "active_from": null,
                  "expires_at": "2026-12-31T18:29:59Z",
                  "max_clicks": null,
                  "clicks": 1284,
                  "has_password": false,
                  "tags": [
                    "sms",
                    "festive"
                  ],
                  "campaign": "diwali-2026",
                  "reference": "Chennai stores",
                  "external_id": "ORD-1001",
                  "state": null,
                  "title": "Diwali SMS – Chennai",
                  "notes": null,
                  "favorite": false,
                  "archived": false,
                  "redirect_type": 302,
                  "fallback_url": null,
                  "track_conversions": true,
                  "created_at": "2026-11-01T09:12:00Z",
                  "updated_at": "2026-11-02T11:00:00Z"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "New destination."
                  },
                  "expires_at": {
                    "type": "string"
                  },
                  "active_from": {
                    "type": "string"
                  },
                  "max_clicks": {
                    "type": "integer"
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Replaces all tags. Same rules as when creating."
                  },
                  "campaign": {
                    "type": "string",
                    "description": "Same rules as when creating."
                  },
                  "reference": {
                    "type": "string",
                    "description": "No quotes, < or >."
                  },
                  "external_id": {
                    "type": "string",
                    "description": "No spaces, quotes, < or >."
                  },
                  "password": {
                    "type": "string",
                    "description": "null removes it."
                  },
                  "status": {
                    "type": "string",
                    "description": "active or disabled."
                  }
                }
              },
              "example": {
                "url": "https://shop.example.in/sale-extended",
                "expires_at": "2027-01-15T18:29:59Z"
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Links"
        ],
        "summary": "Disable a link",
        "description": "Switches the link off (visitors see “disabled”, or its fallback page). It can be enabled again with PATCH status: active.",
        "operationId": "disableALink",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "diwali"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "short_url": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "active_from": {
                      "type": "null"
                    },
                    "expires_at": {
                      "type": "string"
                    },
                    "max_clicks": {
                      "type": "null"
                    },
                    "clicks": {
                      "type": "integer"
                    },
                    "has_password": {
                      "type": "boolean"
                    },
                    "tags": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "campaign": {
                      "type": "string"
                    },
                    "reference": {
                      "type": "string"
                    },
                    "external_id": {
                      "type": "string"
                    },
                    "state": {
                      "type": "null"
                    },
                    "title": {
                      "type": "string"
                    },
                    "notes": {
                      "type": "null"
                    },
                    "favorite": {
                      "type": "boolean"
                    },
                    "archived": {
                      "type": "boolean"
                    },
                    "redirect_type": {
                      "type": "integer"
                    },
                    "fallback_url": {
                      "type": "null"
                    },
                    "track_conversions": {
                      "type": "boolean"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "8b0f…",
                  "code": "diwali",
                  "short_url": "https://m-bx.to/diwali",
                  "url": "https://shop.example.in/sale?utm_source=sms",
                  "status": "disabled",
                  "active_from": null,
                  "expires_at": "2026-12-31T18:29:59Z",
                  "max_clicks": null,
                  "clicks": 1284,
                  "has_password": false,
                  "tags": [
                    "sms",
                    "festive"
                  ],
                  "campaign": "diwali-2026",
                  "reference": "Chennai stores",
                  "external_id": "ORD-1001",
                  "state": null,
                  "title": "Diwali SMS – Chennai",
                  "notes": null,
                  "favorite": false,
                  "archived": false,
                  "redirect_type": 302,
                  "fallback_url": null,
                  "track_conversions": true,
                  "created_at": "2026-11-01T09:12:00Z",
                  "updated_at": "2026-11-02T11:00:00Z"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/links/lookup": {
      "get": {
        "tags": [
          "Links"
        ],
        "summary": "Find a link by your ID",
        "description": "Looks up the link you created with external_id. Add stats_days to include its numbers.",
        "operationId": "findALinkByYourID",
        "parameters": [
          {
            "name": "external_id",
            "in": "query",
            "required": true,
            "description": "",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "stats_days",
            "in": "query",
            "required": false,
            "description": "1–365.",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "short_url": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "active_from": {
                      "type": "null"
                    },
                    "expires_at": {
                      "type": "string"
                    },
                    "max_clicks": {
                      "type": "null"
                    },
                    "clicks": {
                      "type": "integer"
                    },
                    "has_password": {
                      "type": "boolean"
                    },
                    "tags": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "campaign": {
                      "type": "string"
                    },
                    "reference": {
                      "type": "string"
                    },
                    "external_id": {
                      "type": "string"
                    },
                    "state": {
                      "type": "null"
                    },
                    "title": {
                      "type": "string"
                    },
                    "notes": {
                      "type": "null"
                    },
                    "favorite": {
                      "type": "boolean"
                    },
                    "archived": {
                      "type": "boolean"
                    },
                    "redirect_type": {
                      "type": "integer"
                    },
                    "fallback_url": {
                      "type": "null"
                    },
                    "track_conversions": {
                      "type": "boolean"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "8b0f…",
                  "code": "diwali",
                  "short_url": "https://m-bx.to/diwali",
                  "url": "https://shop.example.in/sale?utm_source=sms",
                  "status": "active",
                  "active_from": null,
                  "expires_at": "2026-12-31T18:29:59Z",
                  "max_clicks": null,
                  "clicks": 1284,
                  "has_password": false,
                  "tags": [
                    "sms",
                    "festive"
                  ],
                  "campaign": "diwali-2026",
                  "reference": "Chennai stores",
                  "external_id": "ORD-1001",
                  "state": null,
                  "title": "Diwali SMS – Chennai",
                  "notes": null,
                  "favorite": false,
                  "archived": false,
                  "redirect_type": 302,
                  "fallback_url": null,
                  "track_conversions": true,
                  "created_at": "2026-11-01T09:12:00Z",
                  "updated_at": "2026-11-02T11:00:00Z"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/links/{code}/settings": {
      "patch": {
        "tags": [
          "Links"
        ],
        "summary": "Link settings",
        "description": "Title, notes, favourite, archive, redirect type, fallback page and conversion tracking. GET returns the same fields.",
        "operationId": "linkSettings",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "diwali"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "notes": {
                      "type": "null"
                    },
                    "favorite": {
                      "type": "boolean"
                    },
                    "archived": {
                      "type": "boolean"
                    },
                    "archived_at": {
                      "type": "null"
                    },
                    "redirect_type": {
                      "type": "integer"
                    },
                    "fallback_url": {
                      "type": "string"
                    },
                    "track_conversions": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "code": "diwali",
                  "title": "Diwali SMS – Chennai",
                  "notes": null,
                  "favorite": true,
                  "archived": false,
                  "archived_at": null,
                  "redirect_type": 302,
                  "fallback_url": "https://shop.example.in/offers",
                  "track_conversions": true
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "favorite": {
                    "type": "boolean"
                  },
                  "redirect_type": {
                    "type": "integer",
                    "description": "301, 302, 307 or 308."
                  },
                  "fallback_url": {
                    "type": "string"
                  },
                  "track_conversions": {
                    "type": "boolean"
                  },
                  "title": {
                    "type": "string"
                  },
                  "notes": {
                    "type": "string"
                  },
                  "archived": {
                    "type": "boolean",
                    "description": "Hides it from lists; it keeps working."
                  }
                }
              },
              "example": {
                "favorite": true,
                "redirect_type": 302,
                "fallback_url": "https://shop.example.in/offers",
                "track_conversions": true
              }
            }
          }
        }
      }
    },
    "/v1/links/{code}/duplicate": {
      "post": {
        "tags": [
          "Links"
        ],
        "summary": "Duplicate a link",
        "description": "A new link with the same destination, tags, campaign, rules and settings. Counts towards the monthly allowance.",
        "operationId": "duplicateALink",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "diwali"
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "short_url": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "active_from": {
                      "type": "null"
                    },
                    "expires_at": {
                      "type": "string"
                    },
                    "max_clicks": {
                      "type": "null"
                    },
                    "clicks": {
                      "type": "integer"
                    },
                    "has_password": {
                      "type": "boolean"
                    },
                    "tags": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "campaign": {
                      "type": "string"
                    },
                    "reference": {
                      "type": "string"
                    },
                    "external_id": {
                      "type": "string"
                    },
                    "state": {
                      "type": "null"
                    },
                    "title": {
                      "type": "string"
                    },
                    "notes": {
                      "type": "null"
                    },
                    "favorite": {
                      "type": "boolean"
                    },
                    "archived": {
                      "type": "boolean"
                    },
                    "redirect_type": {
                      "type": "integer"
                    },
                    "fallback_url": {
                      "type": "null"
                    },
                    "track_conversions": {
                      "type": "boolean"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    },
                    "duplicated_from": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "8b0f…",
                  "code": "Xk29Pa",
                  "short_url": "https://m-bx.to/Xk29Pa",
                  "url": "https://shop.example.in/sale?utm_source=sms",
                  "status": "active",
                  "active_from": null,
                  "expires_at": "2026-12-31T18:29:59Z",
                  "max_clicks": null,
                  "clicks": 0,
                  "has_password": false,
                  "tags": [
                    "sms",
                    "festive"
                  ],
                  "campaign": "diwali-2026",
                  "reference": "Chennai stores",
                  "external_id": "ORD-1001",
                  "state": null,
                  "title": "Diwali SMS – Chennai",
                  "notes": null,
                  "favorite": false,
                  "archived": false,
                  "redirect_type": 302,
                  "fallback_url": null,
                  "track_conversions": true,
                  "created_at": "2026-11-01T09:12:00Z",
                  "updated_at": "2026-11-02T11:00:00Z",
                  "duplicated_from": "diwali"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "alias": {
                    "type": "string",
                    "description": "Back-half for the copy."
                  }
                }
              },
              "example": {}
            }
          }
        }
      }
    },
    "/v1/links/{code}/versions": {
      "get": {
        "tags": [
          "Links"
        ],
        "summary": "Link versions",
        "description": "Every earlier state of the link, newest first, with who changed it.",
        "operationId": "linkVersions",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "diwali"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "versions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "version": {
                            "type": "integer"
                          },
                          "snapshot": {
                            "type": "object",
                            "properties": {
                              "url": {
                                "type": "string"
                              }
                            }
                          },
                          "changed_by": {
                            "type": "string"
                          },
                          "changed_at": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "versions": [
                    {
                      "version": 2,
                      "snapshot": {
                        "url": "https://shop.example.in/sale"
                      },
                      "changed_by": "mbx_live_Ab12…",
                      "changed_at": "2026-11-02T11:00:00Z"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/links/bulk-delete": {
      "post": {
        "tags": [
          "Links"
        ],
        "summary": "Delete links in bulk",
        "description": "Permanently deletes links matching a filter, up to 20,000 per call (repeat until done is true). Send dry_run: true first to see how many match. Owner or admin only.",
        "operationId": "deleteLinksInBulk",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deleted": {
                      "type": "integer"
                    },
                    "remaining": {
                      "type": "integer"
                    },
                    "done": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "deleted": 1840,
                  "remaining": 0,
                  "done": true
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "filter": {
                    "type": "object",
                    "properties": {
                      "campaign": {
                        "type": "string"
                      }
                    }
                  },
                  "dry_run": {
                    "type": "boolean"
                  }
                }
              },
              "example": {
                "filter": {
                  "campaign": "diwali-2025"
                },
                "dry_run": false
              }
            }
          }
        }
      }
    },
    "/v1/links/{code}/flow": {
      "put": {
        "tags": [
          "Routing and scheduling"
        ],
        "summary": "Ordered routing rules",
        "description": "Rules are checked from the top; the first whose conditions all match decides the destination. An empty condition means “any”. Values: countries (IN), regions (Tamil Nadu), langs (ta), devices (mobile, tablet, desktop), os (android, ios, windows, macos, linux), browsers (chrome, safari, firefox, edge, opera, samsung, in-app). Send flow: [] to clear.",
        "operationId": "orderedRoutingRules",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "diwali"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "flow": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "label": {
                            "type": "string"
                          },
                          "when": {
                            "type": "object",
                            "properties": {
                              "langs": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              }
                            }
                          },
                          "url": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "code": "diwali",
                  "flow": [
                    {
                      "label": "Tamil speakers",
                      "when": {
                        "langs": [
                          "ta"
                        ]
                      },
                      "url": "https://shop.example.in/ta"
                    },
                    {
                      "label": null,
                      "when": {
                        "os": [
                          "android"
                        ],
                        "countries": [
                          "IN"
                        ]
                      },
                      "url": "market://details?id=in.example.shop"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "flow": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "label": {
                          "type": "string"
                        },
                        "when": {
                          "type": "object",
                          "properties": {
                            "langs": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          }
                        },
                        "url": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              },
              "example": {
                "flow": [
                  {
                    "label": "Tamil speakers",
                    "when": {
                      "langs": [
                        "ta"
                      ]
                    },
                    "url": "https://shop.example.in/ta"
                  },
                  {
                    "when": {
                      "os": [
                        "android"
                      ],
                      "countries": [
                        "IN"
                      ]
                    },
                    "url": "market://details?id=in.example.shop"
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/v1/links/{code}/simulate": {
      "post": {
        "tags": [
          "Routing and scheduling"
        ],
        "summary": "Test a visitor",
        "description": "Shows where a visitor with these details would go. Records nothing.",
        "operationId": "testAVisitor",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "diwali"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "matched": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "url": "https://shop.example.in/ta",
                  "matched": "Rule 1: Tamil speakers"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "country": {
                    "type": "string"
                  },
                  "region": {
                    "type": "string"
                  },
                  "lang": {
                    "type": "string"
                  },
                  "device": {
                    "type": "string"
                  },
                  "os": {
                    "type": "string"
                  },
                  "browser": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "country": "IN",
                "region": "Tamil Nadu",
                "lang": "ta",
                "device": "mobile",
                "os": "android",
                "browser": "chrome"
              }
            }
          }
        }
      }
    },
    "/v1/links/{code}/rules": {
      "patch": {
        "tags": [
          "Routing and scheduling"
        ],
        "summary": "Smart rules",
        "description": "Device and app links, country destinations, A/B split, working hours and a traffic shield. GET returns them.",
        "operationId": "smartRules",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "diwali"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "rules": {
                      "type": "object",
                      "properties": {
                        "android": {
                          "type": "string"
                        },
                        "countries": {
                          "type": "object",
                          "properties": {
                            "AE": {
                              "type": "string"
                            }
                          }
                        },
                        "hours": {
                          "type": "object",
                          "properties": {
                            "start": {
                              "type": "string"
                            },
                            "end": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "code": "diwali",
                  "rules": {
                    "android": "intent://open#Intent;package=in.example.shop;end",
                    "countries": {
                      "AE": "https://ae.example.in"
                    },
                    "hours": {
                      "start": "09:00",
                      "end": "21:00"
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "rules": {
                    "type": "object",
                    "properties": {
                      "android": {
                        "type": "string"
                      },
                      "ios": {
                        "type": "string"
                      },
                      "countries": {
                        "type": "object",
                        "properties": {
                          "AE": {
                            "type": "string"
                          }
                        }
                      },
                      "ab": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "url": {
                              "type": "string"
                            },
                            "weight": {
                              "type": "integer"
                            }
                          }
                        }
                      },
                      "hours": {
                        "type": "object",
                        "properties": {
                          "start": {
                            "type": "string"
                          },
                          "end": {
                            "type": "string"
                          }
                        }
                      },
                      "max_rps": {
                        "type": "integer"
                      }
                    }
                  }
                }
              },
              "example": {
                "rules": {
                  "android": "intent://open#Intent;package=in.example.shop;end",
                  "ios": "https://apps.apple.com/in/app/id123",
                  "countries": {
                    "AE": "https://ae.example.in"
                  },
                  "ab": [
                    {
                      "url": "https://a.example.in",
                      "weight": 50
                    },
                    {
                      "url": "https://b.example.in",
                      "weight": 50
                    }
                  ],
                  "hours": {
                    "start": "09:00",
                    "end": "21:00"
                  },
                  "max_rps": 500
                }
              }
            }
          }
        }
      }
    },
    "/v1/links/{code}/schedule": {
      "post": {
        "tags": [
          "Routing and scheduling"
        ],
        "summary": "Schedule a destination change",
        "description": "Changes where the link goes at a set time. GET lists the current destination and pending changes; DELETE /schedule/{id} cancels one.",
        "operationId": "scheduleADestinationChange",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "diwali"
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "at": {
                      "type": "string"
                    },
                    "destination": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "a71c…",
                  "at": "2026-11-14T18:30:00Z",
                  "destination": "https://shop.example.in/sale-ended",
                  "status": "pending"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "at": {
                    "type": "string"
                  },
                  "url": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "at": "2026-11-15T00:00:00+05:30",
                "url": "https://shop.example.in/sale-ended"
              }
            }
          }
        }
      }
    },
    "/v1/links/{code}/state": {
      "patch": {
        "tags": [
          "Routing and scheduling"
        ],
        "summary": "Set a link's state",
        "description": "A label for where the link is in your own process (for example sent, paid). Workflows can react to it. GET /v1/links/{code}/states shows the history.",
        "operationId": "setALinkSState",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "diwali"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "state": {
                      "type": "string"
                    },
                    "previous_state": {
                      "type": "string"
                    },
                    "changed": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "code": "diwali",
                  "state": "paid",
                  "previous_state": "sent",
                  "changed": true
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "state": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "state": "paid"
              }
            }
          }
        }
      }
    },
    "/v1/qr-codes": {
      "get": {
        "tags": [
          "QR codes"
        ],
        "summary": "List QR codes",
        "description": "With this month's allowance and the design options your plan includes.",
        "operationId": "listQRCodes",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Search by name.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "description": "Period for scans_30d, 1–365.",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "limit": {
                      "type": "integer"
                    },
                    "used_this_month": {
                      "type": "integer"
                    },
                    "customization": {
                      "type": "string"
                    },
                    "bulk": {
                      "type": "boolean"
                    },
                    "days": {
                      "type": "integer"
                    },
                    "qr_codes": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "style": {
                            "type": "object",
                            "properties": {
                              "fg": {
                                "type": "string"
                              },
                              "bg": {
                                "type": "string"
                              },
                              "dots": {
                                "type": "string"
                              },
                              "corners": {
                                "type": "string"
                              },
                              "frame": {
                                "type": "string"
                              },
                              "frame_text": {
                                "type": "string"
                              }
                            }
                          },
                          "link": {
                            "type": "object",
                            "properties": {
                              "code": {
                                "type": "string"
                              },
                              "short_url": {
                                "type": "string"
                              },
                              "destination": {
                                "type": "string"
                              },
                              "campaign": {
                                "type": "null"
                              },
                              "status": {
                                "type": "string"
                              }
                            }
                          },
                          "qr_url": {
                            "type": "string"
                          },
                          "scans_30d": {
                            "type": "integer"
                          },
                          "scans_total": {
                            "type": "integer"
                          },
                          "created_at": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "limit": 10,
                  "used_this_month": 3,
                  "customization": "advanced",
                  "bulk": false,
                  "days": 30,
                  "qr_codes": [
                    {
                      "id": "4c1e…",
                      "name": "Table tent",
                      "style": {
                        "fg": "#1f4fd8",
                        "bg": "#ffffff",
                        "dots": "rounded",
                        "corners": "circle",
                        "frame": "label",
                        "frame_text": "SCAN TO ORDER"
                      },
                      "link": {
                        "code": "menu",
                        "short_url": "https://m-bx.to/menu",
                        "destination": "https://cafe.example.in/menu",
                        "campaign": null,
                        "status": "active"
                      },
                      "qr_url": "https://m-bx.to/menu?qr",
                      "scans_30d": 412,
                      "scans_total": 2310,
                      "created_at": "2026-11-03T10:00:00Z"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "QR codes"
        ],
        "summary": "Create a QR code",
        "description": "One QR code per link. Encode qr_url (the short link with ?qr) so scans are counted apart from clicks. Free: black and white; Starter: colours and frames; Growth and above: logos, gradients, dot and corner shapes.",
        "operationId": "createAQRCode",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "style": {
                      "type": "object",
                      "properties": {
                        "fg": {
                          "type": "string"
                        },
                        "bg": {
                          "type": "string"
                        },
                        "dots": {
                          "type": "string"
                        },
                        "corners": {
                          "type": "string"
                        },
                        "frame": {
                          "type": "string"
                        },
                        "frame_text": {
                          "type": "string"
                        }
                      }
                    },
                    "link": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "short_url": {
                          "type": "string"
                        },
                        "destination": {
                          "type": "string"
                        },
                        "campaign": {
                          "type": "null"
                        },
                        "status": {
                          "type": "string"
                        }
                      }
                    },
                    "qr_url": {
                      "type": "string"
                    },
                    "scans_30d": {
                      "type": "integer"
                    },
                    "scans_total": {
                      "type": "integer"
                    },
                    "created_at": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "4c1e…",
                  "name": "Table tent",
                  "style": {
                    "fg": "#1f4fd8",
                    "bg": "#ffffff",
                    "dots": "rounded",
                    "corners": "circle",
                    "frame": "label",
                    "frame_text": "SCAN TO ORDER"
                  },
                  "link": {
                    "code": "menu",
                    "short_url": "https://m-bx.to/menu",
                    "destination": "https://cafe.example.in/menu",
                    "campaign": null,
                    "status": "active"
                  },
                  "qr_url": "https://m-bx.to/menu?qr",
                  "scans_30d": 412,
                  "scans_total": 2310,
                  "created_at": "2026-11-03T10:00:00Z"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "description": "The short link's back-half."
                  },
                  "name": {
                    "type": "string"
                  },
                  "style": {
                    "type": "object",
                    "properties": {
                      "fg": {
                        "type": "string"
                      },
                      "dots": {
                        "type": "string"
                      },
                      "corners": {
                        "type": "string"
                      },
                      "frame": {
                        "type": "string"
                      },
                      "frame_text": {
                        "type": "string"
                      }
                    }
                  },
                  "template": {
                    "type": "string",
                    "description": "A saved QR design (name, id or default) or a ready-made one (preset:upi). style overrides parts of it."
                  }
                },
                "required": [
                  "code"
                ]
              },
              "example": {
                "code": "menu",
                "name": "Table tent",
                "style": {
                  "fg": "#1f4fd8",
                  "dots": "rounded",
                  "corners": "circle",
                  "frame": "label",
                  "frame_text": "SCAN TO ORDER"
                }
              }
            }
          }
        }
      }
    },
    "/v1/qr-codes/bulk": {
      "post": {
        "tags": [
          "QR codes"
        ],
        "summary": "Create QR codes in bulk",
        "description": "Business plan and above. Up to 500 links; links that already have a QR code keep it.",
        "operationId": "createQRCodesInBulk",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "created": {
                      "type": "integer"
                    },
                    "existing": {
                      "type": "integer"
                    },
                    "not_found": {
                      "type": "array",
                      "items": {}
                    }
                  }
                },
                "example": {
                  "created": 2,
                  "existing": 1,
                  "not_found": []
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "codes": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "template": {
                    "type": "string",
                    "description": "A saved or ready-made QR design for all of them."
                  },
                  "style": {
                    "type": "object",
                    "description": "Overrides parts of the template."
                  }
                },
                "required": [
                  "codes"
                ]
              },
              "example": {
                "codes": [
                  "store-001",
                  "store-002",
                  "store-003"
                ],
                "template": "Brand blue"
              }
            }
          }
        }
      }
    },
    "/v1/saved-templates": {
      "get": {
        "tags": [
          "Saved templates"
        ],
        "summary": "List saved templates",
        "description": "Shared with everyone in the account. The ★ default QR and link templates have default: true.",
        "operationId": "listSavedTemplates",
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "required": false,
            "description": "qr, link, utm or page.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "templates": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "default": {
                            "type": "boolean"
                          },
                          "data": {
                            "type": "object",
                            "properties": {
                              "campaign": {
                                "type": "string"
                              },
                              "tags": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              "expires_in": {
                                "type": "string"
                              },
                              "utm": {
                                "type": "object",
                                "properties": {
                                  "source": {
                                    "type": "string"
                                  },
                                  "medium": {
                                    "type": "string"
                                  }
                                }
                              },
                              "qr_template": {
                                "type": "string"
                              }
                            }
                          },
                          "created_by": {
                            "type": "string"
                          },
                          "created_at": {
                            "type": "string"
                          },
                          "updated_at": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "templates": [
                    {
                      "id": "6c1e…",
                      "type": "link",
                      "name": "Invoice links",
                      "default": true,
                      "data": {
                        "campaign": "Invoices",
                        "tags": [
                          "invoice"
                        ],
                        "expires_in": "30d",
                        "utm": {
                          "source": "sms",
                          "medium": "invoice"
                        },
                        "qr_template": "Brand blue"
                      },
                      "created_by": "you@company.in",
                      "created_at": "2026-11-18T09:00:00Z",
                      "updated_at": "2026-11-18T09:00:00Z"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Saved templates"
        ],
        "summary": "Save a template",
        "description": "Up to 100 of each type. Names are unique within a type.",
        "operationId": "saveATemplate",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "default": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "campaign": {
                          "type": "string"
                        },
                        "tags": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "expires_in": {
                          "type": "string"
                        },
                        "utm": {
                          "type": "object",
                          "properties": {
                            "source": {
                              "type": "string"
                            },
                            "medium": {
                              "type": "string"
                            }
                          }
                        },
                        "qr_template": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "id": "6c1e…",
                  "type": "link",
                  "name": "Invoice links",
                  "default": true,
                  "data": {
                    "campaign": "Invoices",
                    "tags": [
                      "invoice"
                    ],
                    "expires_in": "30d",
                    "utm": {
                      "source": "sms",
                      "medium": "invoice"
                    },
                    "qr_template": "Brand blue"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "description": "qr, link, utm or page."
                  },
                  "name": {
                    "type": "string",
                    "description": "Up to 60 characters."
                  },
                  "default": {
                    "type": "boolean",
                    "description": "qr and link only: the ★ default (one per type)."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "campaign": {
                        "type": "string"
                      },
                      "tags": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "expires_in": {
                        "type": "string"
                      },
                      "utm": {
                        "type": "object",
                        "properties": {
                          "source": {
                            "type": "string"
                          },
                          "medium": {
                            "type": "string"
                          }
                        }
                      },
                      "qr_template": {
                        "type": "string"
                      }
                    },
                    "description": "qr: a QR style. link: campaign, tags, expires_in, max_clicks, redirect_type, fallback_url, track_conversions, notes, utm {source, medium, campaign, term, content}, qr_template. utm: utm_source… utm_content. page: mode, blocks or code_html, design."
                  }
                },
                "required": [
                  "type",
                  "name",
                  "data"
                ]
              },
              "example": {
                "type": "link",
                "name": "Invoice links",
                "default": true,
                "data": {
                  "campaign": "Invoices",
                  "tags": [
                    "invoice"
                  ],
                  "expires_in": "30d",
                  "utm": {
                    "source": "sms",
                    "medium": "invoice"
                  },
                  "qr_template": "Brand blue"
                }
              }
            }
          }
        }
      }
    },
    "/v1/saved-templates/presets": {
      "get": {
        "tags": [
          "Saved templates"
        ],
        "summary": "Ready-made QR designs",
        "description": "The 14 ready-made designs, usable as template: preset:{id}. plan shows the lowest plan that allows each one.",
        "operationId": "readyMadeQRDesigns",
        "security": [],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "presets": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "use": {
                            "type": "string"
                          },
                          "plan": {
                            "type": "string"
                          },
                          "template": {
                            "type": "string"
                          },
                          "style": {
                            "type": "object",
                            "properties": {
                              "fg": {
                                "type": "string"
                              },
                              "frame": {
                                "type": "string"
                              },
                              "frame_text": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "presets": [
                    {
                      "id": "upi",
                      "name": "Pay with UPI",
                      "use": "Counters, bills",
                      "plan": "starter",
                      "template": "preset:upi",
                      "style": {
                        "fg": "#14532d",
                        "frame": "label",
                        "frame_text": "SCAN & PAY"
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/saved-templates/{id}": {
      "get": {
        "tags": [
          "Saved templates"
        ],
        "summary": "Get a template",
        "description": "",
        "operationId": "getATemplate",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "REPLACE_WITH_ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "default": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "fg": {
                          "type": "string"
                        },
                        "dots": {
                          "type": "string"
                        },
                        "frame": {
                          "type": "string"
                        },
                        "frame_text": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "id": "6c1e…",
                  "type": "qr",
                  "name": "Brand blue",
                  "default": true,
                  "data": {
                    "fg": "#1f4fd8",
                    "dots": "rounded",
                    "frame": "label",
                    "frame_text": "SCAN ME"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Saved templates"
        ],
        "summary": "Change a template",
        "description": "Send any of name, data (replaces it) and default. Links and QR codes already made are not changed; use Apply a template in the dashboard or PATCH /v1/qr-codes/{id} for those.",
        "operationId": "changeATemplate",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "REPLACE_WITH_ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "default": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "campaign": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "id": "6c1e…",
                  "type": "link",
                  "name": "Invoice links (SMS)",
                  "default": false,
                  "data": {
                    "campaign": "Invoices"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "default": {
                    "type": "boolean"
                  }
                }
              },
              "example": {
                "name": "Invoice links (SMS)",
                "default": false
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Saved templates"
        ],
        "summary": "Delete a template",
        "description": "Calls that name it afterwards get template_not_found.",
        "operationId": "deleteATemplate",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "REPLACE_WITH_ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deleted": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "deleted": true
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/saved-templates/{id}/duplicate": {
      "post": {
        "tags": [
          "Saved templates"
        ],
        "summary": "Duplicate a template",
        "description": "",
        "operationId": "duplicateATemplate",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "REPLACE_WITH_ID"
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "default": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "fg": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "id": "9a2b…",
                  "type": "qr",
                  "name": "Brand blue copy",
                  "default": false,
                  "data": {
                    "fg": "#1f4fd8"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Default: “… copy”."
                  }
                }
              },
              "example": {}
            }
          }
        }
      }
    },
    "/v1/qr-codes/{id}": {
      "patch": {
        "tags": [
          "QR codes"
        ],
        "summary": "Change a QR design",
        "description": "GET returns one; DELETE removes the saved design (the short link keeps working).",
        "operationId": "changeAQRDesign",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "REPLACE_WITH_ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "style": {
                      "type": "object",
                      "properties": {
                        "fg": {
                          "type": "string"
                        },
                        "bg": {
                          "type": "string"
                        },
                        "dots": {
                          "type": "string"
                        },
                        "corners": {
                          "type": "string"
                        },
                        "frame": {
                          "type": "string"
                        },
                        "frame_text": {
                          "type": "string"
                        }
                      }
                    },
                    "link": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "short_url": {
                          "type": "string"
                        },
                        "destination": {
                          "type": "string"
                        },
                        "campaign": {
                          "type": "null"
                        },
                        "status": {
                          "type": "string"
                        }
                      }
                    },
                    "qr_url": {
                      "type": "string"
                    },
                    "scans_30d": {
                      "type": "integer"
                    },
                    "scans_total": {
                      "type": "integer"
                    },
                    "created_at": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "4c1e…",
                  "name": "Table tent",
                  "style": {
                    "fg": "#1f4fd8",
                    "bg": "#ffffff",
                    "dots": "rounded",
                    "corners": "circle",
                    "frame": "label",
                    "frame_text": "SCAN TO ORDER"
                  },
                  "link": {
                    "code": "menu",
                    "short_url": "https://m-bx.to/menu",
                    "destination": "https://cafe.example.in/menu",
                    "campaign": null,
                    "status": "active"
                  },
                  "qr_url": "https://m-bx.to/menu?qr",
                  "scans_30d": 412,
                  "scans_total": 2310,
                  "created_at": "2026-11-03T10:00:00Z"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "style": {
                    "type": "object",
                    "properties": {
                      "frame": {
                        "type": "string"
                      },
                      "frame_text": {
                        "type": "string"
                      }
                    }
                  }
                }
              },
              "example": {
                "name": "Counter sticker",
                "style": {
                  "frame": "badge",
                  "frame_text": "PAY HERE"
                }
              }
            }
          }
        }
      }
    },
    "/v1/links/{code}/stats": {
      "get": {
        "tags": [
          "Analytics and reports"
        ],
        "summary": "Link stats",
        "description": "Clicks by day, country, region, city, device, OS, browser and referrer, plus QR scans.",
        "operationId": "linkStats",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "diwali"
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "description": "1–365, default 30.",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "link": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "short_url": {
                          "type": "string"
                        },
                        "url": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "active_from": {
                          "type": "null"
                        },
                        "expires_at": {
                          "type": "string"
                        },
                        "max_clicks": {
                          "type": "null"
                        },
                        "clicks": {
                          "type": "integer"
                        },
                        "has_password": {
                          "type": "boolean"
                        },
                        "tags": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "campaign": {
                          "type": "string"
                        },
                        "reference": {
                          "type": "string"
                        },
                        "external_id": {
                          "type": "string"
                        },
                        "state": {
                          "type": "null"
                        },
                        "title": {
                          "type": "string"
                        },
                        "notes": {
                          "type": "null"
                        },
                        "favorite": {
                          "type": "boolean"
                        },
                        "archived": {
                          "type": "boolean"
                        },
                        "redirect_type": {
                          "type": "integer"
                        },
                        "fallback_url": {
                          "type": "null"
                        },
                        "track_conversions": {
                          "type": "boolean"
                        },
                        "created_at": {
                          "type": "string"
                        },
                        "updated_at": {
                          "type": "string"
                        }
                      }
                    },
                    "days": {
                      "type": "integer"
                    },
                    "clicks": {
                      "type": "integer"
                    },
                    "unique_clicks": {
                      "type": "integer"
                    },
                    "bot_clicks_filtered": {
                      "type": "integer"
                    },
                    "by_day": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "day": {
                            "type": "string"
                          },
                          "clicks": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "by_city": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "clicks": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "by_region": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "clicks": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "by_device": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "clicks": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "by_os": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "clicks": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "by_referrer": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "clicks": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "qr_scans": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "link": {
                    "id": "8b0f…",
                    "code": "diwali",
                    "short_url": "https://m-bx.to/diwali",
                    "url": "https://shop.example.in/sale?utm_source=sms",
                    "status": "active",
                    "active_from": null,
                    "expires_at": "2026-12-31T18:29:59Z",
                    "max_clicks": null,
                    "clicks": 1284,
                    "has_password": false,
                    "tags": [
                      "sms",
                      "festive"
                    ],
                    "campaign": "diwali-2026",
                    "reference": "Chennai stores",
                    "external_id": "ORD-1001",
                    "state": null,
                    "title": "Diwali SMS – Chennai",
                    "notes": null,
                    "favorite": false,
                    "archived": false,
                    "redirect_type": 302,
                    "fallback_url": null,
                    "track_conversions": true,
                    "created_at": "2026-11-01T09:12:00Z",
                    "updated_at": "2026-11-02T11:00:00Z"
                  },
                  "days": 30,
                  "clicks": 1284,
                  "unique_clicks": 1033,
                  "bot_clicks_filtered": 61,
                  "by_day": [
                    {
                      "day": "2026-11-02",
                      "clicks": 312
                    }
                  ],
                  "by_city": [
                    {
                      "name": "Chennai",
                      "clicks": 640
                    }
                  ],
                  "by_region": [
                    {
                      "name": "Tamil Nadu",
                      "clicks": 910
                    }
                  ],
                  "by_device": [
                    {
                      "name": "Mobile",
                      "clicks": 1102
                    }
                  ],
                  "by_os": [
                    {
                      "name": "Android",
                      "clicks": 870
                    }
                  ],
                  "by_referrer": [
                    {
                      "name": "Direct",
                      "clicks": 1100
                    }
                  ],
                  "qr_scans": 88
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/links/{code}/insights": {
      "get": {
        "tags": [
          "Analytics and reports"
        ],
        "summary": "Link insights",
        "description": "Unique visitors, bots kept apart, hour of day, browsers and apps, languages, cities and the latest 50 clicks.",
        "operationId": "linkInsights",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "diwali"
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "description": "1–365, default 30.",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "days": {
                      "type": "integer"
                    },
                    "clicks": {
                      "type": "integer"
                    },
                    "bots": {
                      "type": "integer"
                    },
                    "unique_visitors": {
                      "type": "integer"
                    },
                    "qr_scans": {
                      "type": "integer"
                    },
                    "by_hour": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "hour": {
                            "type": "integer"
                          },
                          "clicks": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "by_browser": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "browser": {
                            "type": "string"
                          },
                          "clicks": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "by_lang": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "lang": {
                            "type": "string"
                          },
                          "clicks": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "by_city": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "city": {
                            "type": "string"
                          },
                          "region": {
                            "type": "string"
                          },
                          "clicks": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "recent": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer"
                          },
                          "at": {
                            "type": "string"
                          },
                          "country": {
                            "type": "string"
                          },
                          "region": {
                            "type": "string"
                          },
                          "city": {
                            "type": "string"
                          },
                          "device": {
                            "type": "string"
                          },
                          "os": {
                            "type": "string"
                          },
                          "browser": {
                            "type": "string"
                          },
                          "referrer": {
                            "type": "string"
                          },
                          "via": {
                            "type": "null"
                          },
                          "lang": {
                            "type": "string"
                          },
                          "is_bot": {
                            "type": "boolean"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "code": "diwali",
                  "days": 30,
                  "clicks": 1284,
                  "bots": 61,
                  "unique_visitors": 1033,
                  "qr_scans": 88,
                  "by_hour": [
                    {
                      "hour": 19,
                      "clicks": 140
                    }
                  ],
                  "by_browser": [
                    {
                      "browser": "Chrome",
                      "clicks": 820
                    }
                  ],
                  "by_lang": [
                    {
                      "lang": "ta",
                      "clicks": 512
                    }
                  ],
                  "by_city": [
                    {
                      "city": "Chennai",
                      "region": "Tamil Nadu",
                      "clicks": 640
                    }
                  ],
                  "recent": [
                    {
                      "id": 99121,
                      "at": "2026-11-02T13:31:10Z",
                      "country": "IN",
                      "region": "Tamil Nadu",
                      "city": "Chennai",
                      "device": "Mobile",
                      "os": "Android",
                      "browser": "Chrome",
                      "referrer": "",
                      "via": null,
                      "lang": "ta",
                      "is_bot": false
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/reports/summary": {
      "get": {
        "tags": [
          "Analytics and reports"
        ],
        "summary": "Account summary",
        "description": "Clicks for the whole account over a period, with the previous period for comparison.",
        "operationId": "accountSummary",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "YYYY-MM-DD",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "YYYY-MM-DD",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "range": {
                      "type": "object",
                      "properties": {
                        "from": {
                          "type": "string"
                        },
                        "to": {
                          "type": "string"
                        }
                      }
                    },
                    "clicks": {
                      "type": "integer"
                    },
                    "previous": {
                      "type": "integer"
                    },
                    "by_day": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "day": {
                            "type": "string"
                          },
                          "clicks": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "range": {
                    "from": "2026-10-04",
                    "to": "2026-11-02"
                  },
                  "clicks": 18220,
                  "previous": 15102,
                  "by_day": [
                    {
                      "day": "2026-11-02",
                      "clicks": 812
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tags/report": {
      "get": {
        "tags": [
          "Analytics and reports"
        ],
        "summary": "Report for a slice",
        "description": "The same report for links with given tags, a campaign, or IDs starting with a prefix.",
        "operationId": "reportForASlice",
        "parameters": [
          {
            "name": "tags",
            "in": "query",
            "required": false,
            "description": "Comma-separated.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "campaign",
            "in": "query",
            "required": false,
            "description": "",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "external_id_prefix",
            "in": "query",
            "required": false,
            "description": "",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "from_date": {
                      "type": "string"
                    },
                    "to_date": {
                      "type": "string"
                    },
                    "label": {
                      "type": "string"
                    },
                    "clicks": {
                      "type": "integer"
                    },
                    "previous": {
                      "type": "integer"
                    },
                    "links_in_scope": {
                      "type": "integer"
                    },
                    "by_day": {
                      "type": "array",
                      "items": {}
                    },
                    "by_tag": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "tag": {
                            "type": "string"
                          },
                          "clicks": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "from_date": "2026-10-04",
                  "to_date": "2026-11-02",
                  "label": "Tags: sms",
                  "clicks": 9120,
                  "previous": 8015,
                  "links_in_scope": 240,
                  "by_day": [],
                  "by_tag": [
                    {
                      "tag": "sms",
                      "clicks": 9120
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tags/links.csv": {
      "get": {
        "tags": [
          "Analytics and reports"
        ],
        "summary": "Links in a slice as CSV",
        "description": "Every link in the slice with its clicks, as a spreadsheet.",
        "operationId": "linksInASliceAsCSV",
        "parameters": [
          {
            "name": "tags",
            "in": "query",
            "required": false,
            "description": "",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "campaign",
            "in": "query",
            "required": false,
            "description": "",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "example": "external_id,code,short_url,destination,…\r\nORD-1001,diwali,https://m-bx.to/diwali,…"
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/campaigns": {
      "get": {
        "tags": [
          "Analytics and reports"
        ],
        "summary": "Campaigns",
        "description": "Every campaign with its links and clicks.",
        "operationId": "campaigns",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "campaigns": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "campaign": {
                            "type": "string"
                          },
                          "links": {
                            "type": "integer"
                          },
                          "active": {
                            "type": "integer"
                          },
                          "clicks": {
                            "type": "integer"
                          },
                          "last_created": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "campaigns": [
                    {
                      "campaign": "diwali-2026",
                      "links": 240,
                      "active": 236,
                      "clicks": 9120,
                      "last_created": "2026-11-01T09:12:00Z"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/campaigns/{name}/not-clicked": {
      "get": {
        "tags": [
          "Analytics and reports"
        ],
        "summary": "Who has not clicked",
        "description": "Links in a campaign with no clicks yet, for follow-ups.",
        "operationId": "whoHasNotClicked",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "diwali-2026"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "campaign": {
                      "type": "string"
                    },
                    "not_clicked": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string"
                          },
                          "reference": {
                            "type": "string"
                          },
                          "external_id": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "truncated": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "campaign": "diwali-2026",
                  "not_clicked": [
                    {
                      "code": "a1B2c3",
                      "reference": "Customer 4411",
                      "external_id": "CUST-4411"
                    }
                  ],
                  "truncated": false
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tags": {
      "get": {
        "tags": [
          "Analytics and reports"
        ],
        "summary": "Tags",
        "description": "Every tag with how many links use it, and the auto-tag rules.",
        "operationId": "tags",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "tags": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "tag": {
                            "type": "string"
                          },
                          "links": {
                            "type": "integer"
                          },
                          "clicks": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "rules": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "match_kind": {
                            "type": "string"
                          },
                          "pattern": {
                            "type": "string"
                          },
                          "tag": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "tags": [
                    {
                      "tag": "sms",
                      "links": 240,
                      "clicks": 9120
                    }
                  ],
                  "rules": [
                    {
                      "id": "c1…",
                      "match_kind": "domain",
                      "pattern": "shop.example.in",
                      "tag": "shop"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tags/rules": {
      "post": {
        "tags": [
          "Analytics and reports"
        ],
        "summary": "Add an auto-tag rule",
        "description": "New links matching the pattern get the tag. Optionally apply it to existing links.",
        "operationId": "addAnAutoTagRule",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "match_kind": {
                      "type": "string"
                    },
                    "pattern": {
                      "type": "string"
                    },
                    "tag": {
                      "type": "string"
                    },
                    "applied_to_existing": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "id": "c1…",
                  "match_kind": "domain",
                  "pattern": "shop.example.in",
                  "tag": "shop",
                  "applied_to_existing": 38
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "match_kind": {
                    "type": "string"
                  },
                  "pattern": {
                    "type": "string"
                  },
                  "tag": {
                    "type": "string"
                  },
                  "apply_to_existing": {
                    "type": "boolean"
                  }
                }
              },
              "example": {
                "match_kind": "domain",
                "pattern": "shop.example.in",
                "tag": "shop",
                "apply_to_existing": true
              }
            }
          }
        }
      }
    },
    "/v1/track": {
      "post": {
        "tags": [
          "Conversions"
        ],
        "summary": "Track from your website",
        "description": "Called by the t.js snippet (mbox.track). Uses the public tracking key, is limited to 60 events a minute per visitor, and records conversions as unverified. The same id for the same event is never counted twice.",
        "operationId": "trackFromYourWebsite",
        "security": [],
        "parameters": [],
        "responses": {
          "202": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string"
                    },
                    "id": {
                      "type": "integer"
                    },
                    "attributed": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "status": "recorded",
                  "id": 5512,
                  "attributed": true
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "description": "Tracking key mbx_pk_… from Conversions › Set up."
                  },
                  "event": {
                    "type": "string",
                    "description": "lead, signup, purchase or custom."
                  },
                  "value": {
                    "type": "integer",
                    "description": "Order value."
                  },
                  "currency": {
                    "type": "string",
                    "description": "Three letters, default INR."
                  },
                  "id": {
                    "type": "string",
                    "description": "Order or lead ID, for de-duplication."
                  },
                  "click_id": {
                    "type": "integer",
                    "description": "From mbx_cid (the snippet sends it)."
                  },
                  "first_click_id": {
                    "type": "integer",
                    "description": "First click seen (for first-click attribution)."
                  }
                },
                "required": [
                  "key",
                  "event"
                ]
              },
              "example": {
                "key": "mbx_pk_XXXXXXXXXXXXXXXXXXXXXXXX",
                "event": "purchase",
                "value": 499,
                "currency": "INR",
                "id": "ORDER-1001",
                "click_id": 99121
              }
            }
          }
        }
      }
    },
    "/v1/conversions": {
      "post": {
        "tags": [
          "Conversions"
        ],
        "summary": "Record conversions from your server",
        "description": "Verified conversions from your back end, CRM or offline sales. Send one event, or events: [...] for up to 1,000. Credit them with click_id (best) or link (the back-half).",
        "operationId": "recordConversionsFromYourServer",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "status": {
                            "type": "string"
                          },
                          "id": {
                            "type": "integer"
                          },
                          "attributed": {
                            "type": "boolean"
                          }
                        }
                      }
                    },
                    "recorded": {
                      "type": "integer"
                    },
                    "duplicates": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "results": [
                    {
                      "status": "recorded",
                      "id": 5513,
                      "attributed": true
                    },
                    {
                      "status": "recorded",
                      "id": 5514,
                      "attributed": true
                    }
                  ],
                  "recorded": 2,
                  "duplicates": 0
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "event": {
                          "type": "string"
                        },
                        "value": {
                          "type": "integer"
                        },
                        "currency": {
                          "type": "string"
                        },
                        "id": {
                          "type": "string"
                        },
                        "click_id": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              },
              "example": {
                "events": [
                  {
                    "event": "purchase",
                    "value": 1299,
                    "currency": "INR",
                    "id": "ORDER-1002",
                    "click_id": 99140
                  },
                  {
                    "event": "lead",
                    "id": "ENQ-77",
                    "link": "diwali"
                  }
                ]
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Conversions"
        ],
        "summary": "Conversion report",
        "description": "Totals, by link, by campaign (with spend, CAC and ROAS) and per day, plus the latest 100 events.",
        "operationId": "conversionReport",
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "required": false,
            "description": "1–400, default 30.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "model",
            "in": "query",
            "required": false,
            "description": "last (default) or first click.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "days": {
                      "type": "integer"
                    },
                    "model": {
                      "type": "string"
                    },
                    "clicks": {
                      "type": "integer"
                    },
                    "totals": {
                      "type": "object",
                      "properties": {
                        "leads": {
                          "type": "integer"
                        },
                        "signups": {
                          "type": "integer"
                        },
                        "purchases": {
                          "type": "integer"
                        },
                        "custom": {
                          "type": "integer"
                        },
                        "revenue": {
                          "type": "integer"
                        },
                        "unattributed": {
                          "type": "integer"
                        }
                      }
                    },
                    "by_link": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "campaign": {
                            "type": "string"
                          },
                          "clicks": {
                            "type": "integer"
                          },
                          "leads": {
                            "type": "integer"
                          },
                          "signups": {
                            "type": "integer"
                          },
                          "purchases": {
                            "type": "integer"
                          },
                          "revenue": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "by_campaign": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "campaign": {
                            "type": "string"
                          },
                          "leads": {
                            "type": "integer"
                          },
                          "signups": {
                            "type": "integer"
                          },
                          "purchases": {
                            "type": "integer"
                          },
                          "revenue": {
                            "type": "integer"
                          },
                          "budget": {
                            "type": "integer"
                          },
                          "cac": {
                            "type": "integer"
                          },
                          "roas": {
                            "type": "number"
                          }
                        }
                      }
                    },
                    "by_day": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "day": {
                            "type": "string"
                          },
                          "conversions": {
                            "type": "integer"
                          },
                          "revenue": {
                            "type": "integer"
                          }
                        }
                      }
                    },
                    "recent": {
                      "type": "array",
                      "items": {}
                    }
                  }
                },
                "example": {
                  "days": 30,
                  "model": "last",
                  "clicks": 18220,
                  "totals": {
                    "leads": 210,
                    "signups": 96,
                    "purchases": 64,
                    "custom": 0,
                    "revenue": 48210,
                    "unattributed": 3
                  },
                  "by_link": [
                    {
                      "code": "diwali",
                      "title": "Diwali SMS – Chennai",
                      "campaign": "diwali-2026",
                      "clicks": 1284,
                      "leads": 41,
                      "signups": 12,
                      "purchases": 18,
                      "revenue": 15402
                    }
                  ],
                  "by_campaign": [
                    {
                      "campaign": "diwali-2026",
                      "leads": 120,
                      "signups": 60,
                      "purchases": 40,
                      "revenue": 30110,
                      "budget": 12000,
                      "cac": 120,
                      "roas": 2.51
                    }
                  ],
                  "by_day": [
                    {
                      "day": "2026-11-02",
                      "conversions": 22,
                      "revenue": 3210
                    }
                  ],
                  "recent": []
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/conversions/export": {
      "get": {
        "tags": [
          "Conversions"
        ],
        "summary": "Conversions as CSV",
        "description": "",
        "operationId": "conversionsAsCSV",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "example": "at,event,name,value,currency,order_id,source,verified,click_id,link,campaign\r\n2026-11-02T13:40:00Z,purchase,,499,INR,ORDER-1001,web,false,99121,diwali,diwali-2026"
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/conversions/setup": {
      "get": {
        "tags": [
          "Conversions"
        ],
        "summary": "Tracking key and snippet",
        "description": "Creates the key the first time. POST /v1/conversions/setup/rotate replaces it.",
        "operationId": "trackingKeyAndSnippet",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "tracking_key": {
                      "type": "string"
                    },
                    "snippet": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "tracking_key": "mbx_pk_XXXXXXXXXXXXXXXXXXXXXXXX",
                  "snippet": "<script src=\"https://m-box.in/t.js\" data-key=\"mbx_pk_…\" defer></script>"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/campaign-budgets": {
      "put": {
        "tags": [
          "Conversions"
        ],
        "summary": "Campaign spend",
        "description": "What you spent on a campaign, for CAC and ROAS. GET lists them.",
        "operationId": "campaignSpend",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "org_id": {
                      "type": "string"
                    },
                    "campaign": {
                      "type": "string"
                    },
                    "budget": {
                      "type": "integer"
                    },
                    "currency": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "org_id": "…",
                  "campaign": "diwali-2026",
                  "budget": 12000,
                  "currency": "INR"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "campaign": {
                    "type": "string"
                  },
                  "budget": {
                    "type": "integer"
                  },
                  "currency": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "campaign": "diwali-2026",
                "budget": 12000,
                "currency": "INR"
              }
            }
          }
        }
      }
    },
    "/v1/links/bulk": {
      "post": {
        "tags": [
          "Bulk and imports"
        ],
        "summary": "Create links in bulk",
        "description": "Up to 1,000 links in one call. Each row can have the same fields as Create a link; shared fields apply to all. A top-level template applies to every row; a row's own template or utm_template wins.",
        "operationId": "createLinksInBulk",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "created": {
                      "type": "integer"
                    },
                    "existing": {
                      "type": "integer"
                    },
                    "failed": {
                      "type": "integer"
                    },
                    "links": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "code": {
                            "type": "string"
                          },
                          "short_url": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string"
                          },
                          "active_from": {
                            "type": "null"
                          },
                          "expires_at": {
                            "type": "string"
                          },
                          "max_clicks": {
                            "type": "null"
                          },
                          "clicks": {
                            "type": "integer"
                          },
                          "has_password": {
                            "type": "boolean"
                          },
                          "tags": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "campaign": {
                            "type": "string"
                          },
                          "reference": {
                            "type": "string"
                          },
                          "external_id": {
                            "type": "string"
                          },
                          "state": {
                            "type": "null"
                          },
                          "title": {
                            "type": "string"
                          },
                          "notes": {
                            "type": "null"
                          },
                          "favorite": {
                            "type": "boolean"
                          },
                          "archived": {
                            "type": "boolean"
                          },
                          "redirect_type": {
                            "type": "integer"
                          },
                          "fallback_url": {
                            "type": "null"
                          },
                          "track_conversions": {
                            "type": "boolean"
                          },
                          "created_at": {
                            "type": "string"
                          },
                          "updated_at": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "created": 2,
                  "existing": 0,
                  "failed": 0,
                  "links": [
                    {
                      "id": "8b0f…",
                      "code": "diwali",
                      "short_url": "https://m-bx.to/diwali",
                      "url": "https://shop.example.in/sale?utm_source=sms",
                      "status": "active",
                      "active_from": null,
                      "expires_at": "2026-12-31T18:29:59Z",
                      "max_clicks": null,
                      "clicks": 1284,
                      "has_password": false,
                      "tags": [
                        "sms",
                        "festive"
                      ],
                      "campaign": "diwali-2026",
                      "reference": "Chennai stores",
                      "external_id": "ORD-1001",
                      "state": null,
                      "title": "Diwali SMS – Chennai",
                      "notes": null,
                      "favorite": false,
                      "archived": false,
                      "redirect_type": 302,
                      "fallback_url": null,
                      "track_conversions": true,
                      "created_at": "2026-11-01T09:12:00Z",
                      "updated_at": "2026-11-02T11:00:00Z"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "campaign": {
                    "type": "string"
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "expires_in": {
                    "type": "string"
                  },
                  "links": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "url": {
                          "type": "string"
                        },
                        "external_id": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "template": {
                    "type": "string",
                    "description": "A saved link template for every row."
                  }
                }
              },
              "example": {
                "campaign": "diwali-2026",
                "tags": [
                  "sms"
                ],
                "expires_in": "30d",
                "links": [
                  {
                    "url": "https://shop.example.in/p/1",
                    "external_id": "CUST-1"
                  },
                  {
                    "url": "https://shop.example.in/p/2",
                    "external_id": "CUST-2"
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/v1/imports": {
      "post": {
        "tags": [
          "Bulk and imports"
        ],
        "summary": "Import a file",
        "description": "multipart/form-data with a CSV file (field file), or JSON rows. CSV only: an Excel file is refused with csv_only (save it as CSV UTF-8). Sample file: https://m-box.in/downloads/mbox-sample-import.csv. Add ?format=csv to get your file back with a short_url column.",
        "operationId": "importAFile",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "job_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "total": {
                      "type": "integer"
                    },
                    "created": {
                      "type": "integer"
                    },
                    "existing": {
                      "type": "integer"
                    },
                    "failed": {
                      "type": "integer"
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "row": {
                            "type": "integer"
                          },
                          "error": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "row": {
                            "type": "integer"
                          },
                          "external_id": {
                            "type": "string"
                          },
                          "short_url": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "job_id": "f2a0…",
                  "status": "completed",
                  "total": 5000,
                  "created": 4995,
                  "existing": 3,
                  "failed": 2,
                  "errors": [
                    {
                      "row": 18,
                      "error": "invalid_url"
                    }
                  ],
                  "results": [
                    {
                      "row": 2,
                      "external_id": "CUST-1",
                      "short_url": "https://m-bx.to/a1B2c3"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "A .csv file with a header row (UTF-8)."
                  },
                  "url_column": {
                    "type": "string",
                    "description": "Default url."
                  },
                  "external_id_column": {
                    "type": "string",
                    "description": ""
                  },
                  "campaign": {
                    "type": "string",
                    "description": "Applied to every row."
                  }
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Bulk and imports"
        ],
        "summary": "Import history",
        "description": "GET /v1/imports/{id} returns one, with the first 500 row errors.",
        "operationId": "importHistory",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "imports": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "filename": {
                            "type": "string"
                          },
                          "total": {
                            "type": "integer"
                          },
                          "created": {
                            "type": "integer"
                          },
                          "failed": {
                            "type": "integer"
                          },
                          "status": {
                            "type": "string"
                          },
                          "created_at": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "imports": [
                    {
                      "id": "f2a0…",
                      "filename": "customers.csv",
                      "total": 5000,
                      "created": 4995,
                      "failed": 2,
                      "status": "completed",
                      "created_at": "2026-11-02T10:00:00Z"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/imports/async": {
      "post": {
        "tags": [
          "Bulk and imports"
        ],
        "summary": "Background import (recommended)",
        "description": "Answers at once (202) and imports on the server, any size up to 2 GB. Give file_url (a public https CSV), or size to get upload links (then PUT each piece and call Start), or send the file as multipart (up to 25 MB). Rows are read in order and written in parts of 5,000; parts are idempotent and missing parts are written again before the import closes. Every step is in the log. With callback_url, a signed POST is sent when it ends (import.completed, import.stopped or import.failed), retried after 1 min, 5 min, 30 min and 2 h. Check x-mbox-signature: t=<unix time>,v1=HMAC-SHA256(callback_secret, \"<t>.<raw body>\"). The SDKs do all of this: imports.async() and import_async().",
        "operationId": "backgroundImportRecommended",
        "parameters": [],
        "responses": {
          "202": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "job_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "filename": {
                      "type": "string"
                    },
                    "total": {
                      "type": "integer"
                    },
                    "created": {
                      "type": "integer"
                    },
                    "existing": {
                      "type": "integer"
                    },
                    "failed": {
                      "type": "integer"
                    },
                    "reason": {
                      "type": "null"
                    },
                    "progress": {
                      "type": "object",
                      "properties": {
                        "rows_done": {
                          "type": "integer"
                        },
                        "bytes_done": {
                          "type": "integer"
                        },
                        "bytes": {
                          "type": "integer"
                        },
                        "percent": {
                          "type": "number"
                        }
                      }
                    },
                    "callback": {
                      "type": "object",
                      "properties": {
                        "url": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "attempts": {
                          "type": "integer"
                        },
                        "next_attempt_at": {
                          "type": "null"
                        }
                      }
                    },
                    "links": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string"
                        },
                        "log": {
                          "type": "string"
                        },
                        "results_csv": {
                          "type": "string"
                        },
                        "errors_csv": {
                          "type": "string"
                        }
                      }
                    },
                    "callback_secret": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "job_id": "3c9e…",
                  "status": "running",
                  "filename": "customers.csv",
                  "total": 40000,
                  "created": 39960,
                  "existing": 0,
                  "failed": 40,
                  "reason": null,
                  "progress": {
                    "rows_done": 40000,
                    "bytes_done": 2531840,
                    "bytes": 6320953,
                    "percent": 40.1
                  },
                  "callback": {
                    "url": "https://yourapp.in/hooks/m-box",
                    "status": "waiting",
                    "attempts": 0,
                    "next_attempt_at": null
                  },
                  "links": {
                    "status": "https://m-box.in/api/v1/imports/async/3c9e…",
                    "log": "https://m-box.in/api/v1/imports/jobs/3c9e…/events",
                    "results_csv": "https://m-box.in/api/v1/imports/jobs/3c9e…/results.csv",
                    "errors_csv": "https://m-box.in/api/v1/imports/jobs/3c9e…/errors.csv"
                  },
                  "callback_secret": "whsec_9f2c…"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "file_url": {
                    "type": "string",
                    "description": "A public https:// CSV. Range requests are used when the server supports them; otherwise the file is copied first."
                  },
                  "callback_url": {
                    "type": "string",
                    "description": "Public https:// address to call when the import ends."
                  },
                  "campaign": {
                    "type": "string"
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "size": {
                    "type": "integer",
                    "description": "Instead of file_url: the file size in bytes; the answer has upload.pieces (url, from_byte, to_byte)."
                  },
                  "columns": {
                    "type": "object",
                    "description": "Column names if not url, reference, alias, external_id, title: { url: \"Link\" }."
                  },
                  "expires_in": {
                    "type": "string",
                    "description": "30m, 12h, 7d or 4w."
                  },
                  "template": {
                    "type": "string",
                    "description": "A saved link template for campaign, tags and expiry."
                  }
                }
              },
              "example": {
                "file_url": "https://files.yourshop.in/exports/customers.csv",
                "callback_url": "https://yourapp.in/hooks/m-box",
                "campaign": "diwali-2026",
                "tags": [
                  "sms"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/imports/async/{id}/start": {
      "post": {
        "tags": [
          "Bulk and imports"
        ],
        "summary": "Start after uploading",
        "description": "After PUTting every piece from upload.pieces. Checks the pieces are there and starts the import.",
        "operationId": "startAfterUploading",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "REPLACE_WITH_ID"
          }
        ],
        "responses": {
          "202": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "job_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "filename": {
                      "type": "string"
                    },
                    "total": {
                      "type": "integer"
                    },
                    "created": {
                      "type": "integer"
                    },
                    "existing": {
                      "type": "integer"
                    },
                    "failed": {
                      "type": "integer"
                    },
                    "reason": {
                      "type": "null"
                    },
                    "progress": {
                      "type": "object",
                      "properties": {
                        "rows_done": {
                          "type": "integer"
                        },
                        "bytes_done": {
                          "type": "integer"
                        },
                        "bytes": {
                          "type": "integer"
                        },
                        "percent": {
                          "type": "number"
                        }
                      }
                    },
                    "callback": {
                      "type": "object",
                      "properties": {
                        "url": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "attempts": {
                          "type": "integer"
                        },
                        "next_attempt_at": {
                          "type": "null"
                        }
                      }
                    },
                    "links": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string"
                        },
                        "log": {
                          "type": "string"
                        },
                        "results_csv": {
                          "type": "string"
                        },
                        "errors_csv": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "job_id": "3c9e…",
                  "status": "running",
                  "filename": "customers.csv",
                  "total": 40000,
                  "created": 39960,
                  "existing": 0,
                  "failed": 40,
                  "reason": null,
                  "progress": {
                    "rows_done": 40000,
                    "bytes_done": 2531840,
                    "bytes": 6320953,
                    "percent": 40.1
                  },
                  "callback": {
                    "url": "https://yourapp.in/hooks/m-box",
                    "status": "waiting",
                    "attempts": 0,
                    "next_attempt_at": null
                  },
                  "links": {
                    "status": "https://m-box.in/api/v1/imports/async/3c9e…",
                    "log": "https://m-box.in/api/v1/imports/jobs/3c9e…/events",
                    "results_csv": "https://m-box.in/api/v1/imports/jobs/3c9e…/results.csv",
                    "errors_csv": "https://m-box.in/api/v1/imports/jobs/3c9e…/errors.csv"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {}
              },
              "example": {}
            }
          }
        }
      }
    },
    "/v1/imports/async/{id}": {
      "get": {
        "tags": [
          "Bulk and imports"
        ],
        "summary": "Background import status",
        "description": "Status, counts, progress (rows and bytes done) and the callback's state.",
        "operationId": "backgroundImportStatus",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "REPLACE_WITH_ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "job_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "filename": {
                      "type": "string"
                    },
                    "total": {
                      "type": "integer"
                    },
                    "created": {
                      "type": "integer"
                    },
                    "existing": {
                      "type": "integer"
                    },
                    "failed": {
                      "type": "integer"
                    },
                    "reason": {
                      "type": "null"
                    },
                    "progress": {
                      "type": "object",
                      "properties": {
                        "rows_done": {
                          "type": "integer"
                        },
                        "bytes_done": {
                          "type": "integer"
                        },
                        "bytes": {
                          "type": "integer"
                        },
                        "percent": {
                          "type": "number"
                        }
                      }
                    },
                    "callback": {
                      "type": "object",
                      "properties": {
                        "url": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "attempts": {
                          "type": "integer"
                        },
                        "next_attempt_at": {
                          "type": "null"
                        }
                      }
                    },
                    "links": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string"
                        },
                        "log": {
                          "type": "string"
                        },
                        "results_csv": {
                          "type": "string"
                        },
                        "errors_csv": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "job_id": "3c9e…",
                  "status": "running",
                  "filename": "customers.csv",
                  "total": 40000,
                  "created": 39960,
                  "existing": 0,
                  "failed": 40,
                  "reason": null,
                  "progress": {
                    "rows_done": 40000,
                    "bytes_done": 2531840,
                    "bytes": 6320953,
                    "percent": 40.1
                  },
                  "callback": {
                    "url": "https://yourapp.in/hooks/m-box",
                    "status": "waiting",
                    "attempts": 0,
                    "next_attempt_at": null
                  },
                  "links": {
                    "status": "https://m-box.in/api/v1/imports/async/3c9e…",
                    "log": "https://m-box.in/api/v1/imports/jobs/3c9e…/events",
                    "results_csv": "https://m-box.in/api/v1/imports/jobs/3c9e…/results.csv",
                    "errors_csv": "https://m-box.in/api/v1/imports/jobs/3c9e…/errors.csv"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/imports/jobs/{id}/events": {
      "get": {
        "tags": [
          "Bulk and imports"
        ],
        "summary": "Import log",
        "description": "Every step of any import (created, file received, started, parts written with speed, repairs, finished or stopped and why) and every callback attempt with its HTTP answer and time.",
        "operationId": "importLog",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "REPLACE_WITH_ID"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Up to 2,000 steps; default 500.",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "job": {
                      "type": "object",
                      "properties": {
                        "job_id": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "filename": {
                          "type": "string"
                        },
                        "total": {
                          "type": "integer"
                        },
                        "created": {
                          "type": "integer"
                        },
                        "existing": {
                          "type": "integer"
                        },
                        "failed": {
                          "type": "integer"
                        },
                        "reason": {
                          "type": "null"
                        },
                        "progress": {
                          "type": "object",
                          "properties": {
                            "rows_done": {
                              "type": "integer"
                            },
                            "bytes_done": {
                              "type": "integer"
                            },
                            "bytes": {
                              "type": "integer"
                            },
                            "percent": {
                              "type": "number"
                            }
                          }
                        },
                        "callback": {
                          "type": "object",
                          "properties": {
                            "url": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string"
                            },
                            "attempts": {
                              "type": "integer"
                            },
                            "next_attempt_at": {
                              "type": "null"
                            }
                          }
                        },
                        "links": {
                          "type": "object",
                          "properties": {
                            "status": {
                              "type": "string"
                            },
                            "log": {
                              "type": "string"
                            },
                            "results_csv": {
                              "type": "string"
                            },
                            "errors_csv": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer"
                          },
                          "at": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "detail": {
                            "type": "object",
                            "properties": {
                              "columns": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              "delimiter": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "job": {
                    "job_id": "3c9e…",
                    "status": "running",
                    "filename": "customers.csv",
                    "total": 40000,
                    "created": 39960,
                    "existing": 0,
                    "failed": 40,
                    "reason": null,
                    "progress": {
                      "rows_done": 40000,
                      "bytes_done": 2531840,
                      "bytes": 6320953,
                      "percent": 40.1
                    },
                    "callback": {
                      "url": "https://yourapp.in/hooks/m-box",
                      "status": "waiting",
                      "attempts": 0,
                      "next_attempt_at": null
                    },
                    "links": {
                      "status": "https://m-box.in/api/v1/imports/async/3c9e…",
                      "log": "https://m-box.in/api/v1/imports/jobs/3c9e…/events",
                      "results_csv": "https://m-box.in/api/v1/imports/jobs/3c9e…/results.csv",
                      "errors_csv": "https://m-box.in/api/v1/imports/jobs/3c9e…/errors.csv"
                    }
                  },
                  "events": [
                    {
                      "id": 1,
                      "at": "2026-11-18T09:00:01Z",
                      "kind": "started",
                      "detail": {
                        "columns": [
                          "url",
                          "reference",
                          "unique_id"
                        ],
                        "delimiter": ","
                      }
                    },
                    {
                      "id": 2,
                      "at": "2026-11-18T09:00:12Z",
                      "kind": "progress",
                      "detail": {
                        "parts": [
                          1,
                          2,
                          3,
                          4,
                          5,
                          6,
                          7,
                          8
                        ],
                        "rows": 40000,
                        "created": 39960,
                        "failed": 40,
                        "ms": 10748,
                        "rows_per_second": 3721
                      }
                    },
                    {
                      "id": 3,
                      "at": "2026-11-18T09:00:13Z",
                      "kind": "callback_delivered",
                      "detail": {
                        "attempt": 1,
                        "status_code": 200,
                        "ms": 182
                      }
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/imports/jobs/{id}/callback": {
      "post": {
        "tags": [
          "Bulk and imports"
        ],
        "summary": "Set or resend an import callback",
        "description": "Works for every import. On a finished import the callback is sent again now. callback_url: null removes it. new_secret: true makes a new signing secret.",
        "operationId": "setOrResendAnImportCallback",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "REPLACE_WITH_ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "job_id": {
                      "type": "string"
                    },
                    "callback_url": {
                      "type": "string"
                    },
                    "sending": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "job_id": "3c9e…",
                  "callback_url": "https://yourapp.in/hooks/m-box",
                  "sending": true
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "callback_url": {
                    "type": "string"
                  },
                  "new_secret": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "callback_url"
                ]
              },
              "example": {
                "callback_url": "https://yourapp.in/hooks/m-box"
              }
            }
          }
        }
      }
    },
    "/v1/imports/jobs": {
      "post": {
        "tags": [
          "Bulk and imports"
        ],
        "summary": "Start a very large import",
        "description": "For files of lakhs of rows (up to 1 crore on Enterprise). Starts a job and reserves the month's allowance once; what is not used is given back when the job finishes, or after 2 hours without new parts. Then send the rows in numbered parts of 5,000, up to 6 at a time.",
        "operationId": "startAVeryLargeImport",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "job_id": {
                      "type": "string"
                    },
                    "part_rows": {
                      "type": "integer"
                    },
                    "parts": {
                      "type": "integer"
                    },
                    "parallel": {
                      "type": "integer"
                    },
                    "host": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "job_id": "7c1e…",
                  "part_rows": 5000,
                  "parts": 400,
                  "parallel": 6,
                  "host": "m-bx.to"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "filename": {
                    "type": "string"
                  },
                  "total": {
                    "type": "integer"
                  },
                  "campaign": {
                    "type": "string"
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "expires_in": {
                    "type": "string"
                  },
                  "template": {
                    "type": "string",
                    "description": "A saved link template: its campaign, tags and expiry apply to every row."
                  },
                  "callback_url": {
                    "type": "string",
                    "description": "Called (signed) when the job is finished; the answer includes callback_secret."
                  }
                }
              },
              "example": {
                "filename": "customers.csv",
                "total": 2000000,
                "campaign": "diwali-2026",
                "tags": [
                  "sms"
                ],
                "expires_in": "30d"
              }
            }
          }
        }
      }
    },
    "/v1/imports/jobs/{job_id}/parts/{n}": {
      "put": {
        "tags": [
          "Bulk and imports"
        ],
        "summary": "Send a part",
        "description": "Rows as [row, url, reference, alias, unique_id, title]. Compress the body with gzip and add the header x-mbox-encoding: gzip to send about 8 times less. Sending a part again returns its first answer and never creates links twice, so retry freely after a timeout. codes follows your row order: a short code, =host/code when the unique ID already had a link, or !reason.",
        "operationId": "sendAPart",
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "n",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "seq": {
                      "type": "integer"
                    },
                    "created": {
                      "type": "integer"
                    },
                    "existing": {
                      "type": "integer"
                    },
                    "failed": {
                      "type": "integer"
                    },
                    "ms": {
                      "type": "integer"
                    },
                    "codes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                },
                "example": {
                  "seq": 1,
                  "created": 1,
                  "existing": 0,
                  "failed": 1,
                  "ms": 1350,
                  "codes": [
                    "a1B2c3D",
                    "!invalid_url"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "rows": {
                    "type": "array",
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "integer"
                      }
                    }
                  }
                }
              },
              "example": {
                "rows": [
                  [
                    0,
                    "https://shop.example.in/p/1",
                    "Asha",
                    null,
                    "CUST-1",
                    null
                  ],
                  [
                    1,
                    "not a url",
                    null,
                    null,
                    null,
                    null
                  ]
                ]
              }
            }
          }
        }
      }
    },
    "/v1/imports/jobs/{job_id}": {
      "get": {
        "tags": [
          "Bulk and imports"
        ],
        "summary": "Import progress",
        "description": "Rows done so far. GET /v1/imports/jobs/{job_id}/parts/{n} returns a part's answer again (kept 14 days).",
        "operationId": "importProgress",
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "job_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "total": {
                      "type": "integer"
                    },
                    "done": {
                      "type": "integer"
                    },
                    "created": {
                      "type": "integer"
                    },
                    "existing": {
                      "type": "integer"
                    },
                    "failed": {
                      "type": "integer"
                    },
                    "parts": {
                      "type": "integer"
                    },
                    "parts_done": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "job_id": "7c1e…",
                  "status": "running",
                  "total": 2000000,
                  "done": 1250000,
                  "created": 1249870,
                  "existing": 100,
                  "failed": 30,
                  "parts": 400,
                  "parts_done": 250
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/imports/jobs/{job_id}/finish": {
      "post": {
        "tags": [
          "Bulk and imports"
        ],
        "summary": "Finish an import",
        "description": "Closes the job and gives back the allowance for rows not created. Send {\"stopped\": true} when you stop early.",
        "operationId": "finishAnImport",
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "job_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "total": {
                      "type": "integer"
                    },
                    "created": {
                      "type": "integer"
                    },
                    "existing": {
                      "type": "integer"
                    },
                    "failed": {
                      "type": "integer"
                    },
                    "returned_allowance": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "job_id": "7c1e…",
                  "status": "completed",
                  "total": 2000000,
                  "created": 1999870,
                  "existing": 100,
                  "failed": 30,
                  "returned_allowance": 130
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/pages": {
      "get": {
        "tags": [
          "Landing pages"
        ],
        "summary": "List pages",
        "description": "",
        "operationId": "listPages",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "limit": {
                      "type": "integer"
                    },
                    "pages": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "slug": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "published": {
                            "type": "boolean"
                          },
                          "mode": {
                            "type": "string"
                          },
                          "views_30d": {
                            "type": "integer"
                          },
                          "clicks_30d": {
                            "type": "integer"
                          },
                          "leads": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "limit": 10,
                  "pages": [
                    {
                      "id": "9d2…",
                      "slug": "lakshmi-stores",
                      "url": "https://m-box.in/p/lakshmi-stores",
                      "title": "Sri Lakshmi Stores",
                      "published": true,
                      "mode": "blocks",
                      "views_30d": 812,
                      "clicks_30d": 233,
                      "leads": 14
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Landing pages"
        ],
        "summary": "Create a page",
        "description": "mode blocks (with blocks) or code (with code_html). Block types: profile, heading, text, button, image, video, social, whatsapp, contact, upi, countdown, faq, form, map, divider, html.",
        "operationId": "createAPage",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "slug": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "published": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "id": "9d2…",
                  "slug": "lakshmi-stores",
                  "url": "https://m-box.in/p/lakshmi-stores",
                  "published": true
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "slug": {
                    "type": "string"
                  },
                  "mode": {
                    "type": "string"
                  },
                  "published": {
                    "type": "boolean"
                  },
                  "blocks": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "subtitle": {
                          "type": "string"
                        }
                      }
                    }
                  },
                  "design": {
                    "type": "object",
                    "properties": {
                      "theme": {
                        "type": "string"
                      }
                    }
                  }
                }
              },
              "example": {
                "title": "Sri Lakshmi Stores",
                "slug": "lakshmi-stores",
                "mode": "blocks",
                "published": true,
                "blocks": [
                  {
                    "id": "p1",
                    "type": "profile",
                    "name": "Sri Lakshmi Stores",
                    "subtitle": "Wholesale textiles"
                  },
                  {
                    "id": "b1",
                    "type": "whatsapp",
                    "phone": "919876543210",
                    "label": "Order on WhatsApp"
                  }
                ],
                "design": {
                  "theme": "saffron"
                }
              }
            }
          }
        }
      }
    },
    "/v1/pages/{id}": {
      "patch": {
        "tags": [
          "Landing pages"
        ],
        "summary": "Change a page",
        "description": "GET returns it; DELETE removes it; POST /duplicate copies it.",
        "operationId": "changeAPage",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "REPLACE_WITH_ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "published": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "id": "9d2…",
                  "published": false
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "published": {
                    "type": "boolean"
                  }
                }
              },
              "example": {
                "published": false
              }
            }
          }
        }
      }
    },
    "/v1/pages/{id}/stats": {
      "get": {
        "tags": [
          "Landing pages"
        ],
        "summary": "Page stats",
        "description": "",
        "operationId": "pageStats",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "REPLACE_WITH_ID"
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "description": "",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "days": {
                      "type": "integer"
                    },
                    "views": {
                      "type": "integer"
                    },
                    "clicks": {
                      "type": "integer"
                    },
                    "leads": {
                      "type": "integer"
                    },
                    "click_rate": {
                      "type": "number"
                    },
                    "by_day": {
                      "type": "array",
                      "items": {}
                    },
                    "by_block": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "clicks": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "days": 30,
                  "views": 812,
                  "clicks": 233,
                  "leads": 14,
                  "click_rate": 28.7,
                  "by_day": [],
                  "by_block": [
                    {
                      "id": "b1",
                      "type": "whatsapp",
                      "label": "Order on WhatsApp",
                      "clicks": 120
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/pages/{id}/leads": {
      "get": {
        "tags": [
          "Landing pages"
        ],
        "summary": "Enquiries",
        "description": "Form submissions. Add ?format=csv for a spreadsheet.",
        "operationId": "enquiries",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "REPLACE_WITH_ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "leads": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer"
                          },
                          "block_id": {
                            "type": "string"
                          },
                          "data": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string"
                              },
                              "phone": {
                                "type": "string"
                              }
                            }
                          },
                          "created_at": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "leads": [
                    {
                      "id": 41,
                      "block_id": "f1",
                      "data": {
                        "name": "Priya",
                        "phone": "98xxxxxx10"
                      },
                      "created_at": "2026-11-02T08:00:00Z"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/uploads": {
      "post": {
        "tags": [
          "Landing pages"
        ],
        "summary": "Upload an image",
        "description": "multipart/form-data, field file: PNG, JPEG, WebP or GIF up to 2 MB. Use the URL in pages or as a QR logo.",
        "operationId": "uploadAnImage",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "bytes": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "url": "https://…/page-assets/…/a1b2.png",
                  "bytes": 48210
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/shares": {
      "post": {
        "tags": [
          "Dashboards and email reports"
        ],
        "summary": "Create a live dashboard",
        "description": "A read-only page anyone with the link can open. Destinations and references are never shown.",
        "operationId": "createALiveDashboard",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "active": {
                      "type": "boolean"
                    },
                    "views": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "id": "b81…",
                  "name": "Diwali for the client",
                  "url": "https://m-box.in/r/Abc…",
                  "active": true,
                  "views": 0
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "campaign": {
                    "type": "string"
                  },
                  "days": {
                    "type": "integer"
                  },
                  "expires_in_days": {
                    "type": "integer"
                  }
                }
              },
              "example": {
                "name": "Diwali for the client",
                "campaign": "diwali-2026",
                "days": 30,
                "expires_in_days": 60
              }
            }
          }
        }
      }
    },
    "/v1/shared/{token}": {
      "get": {
        "tags": [
          "Dashboards and email reports"
        ],
        "summary": "Open a dashboard's data",
        "description": "",
        "operationId": "openADashboardSData",
        "security": [],
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "REPLACE_WITH_TOKEN"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "clicks": {
                      "type": "integer"
                    },
                    "by_day": {
                      "type": "array",
                      "items": {}
                    }
                  }
                },
                "example": {
                  "name": "Diwali for the client",
                  "clicks": 9120,
                  "by_day": []
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/report-schedules": {
      "post": {
        "tags": [
          "Dashboards and email reports"
        ],
        "summary": "Schedule an email report",
        "description": "Daily, weekly or monthly at 9:00 in your account's time zone. POST /{id}/send sends one now.",
        "operationId": "scheduleAnEmailReport",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "frequency": {
                      "type": "string"
                    },
                    "next_run_at": {
                      "type": "string"
                    },
                    "scope_label": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "e4…",
                  "name": "Weekly SMS report",
                  "frequency": "weekly",
                  "next_run_at": "2026-11-09T03:30:00Z",
                  "scope_label": "Tags: sms"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "recipients": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "frequency": {
                    "type": "string"
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              },
              "example": {
                "name": "Weekly SMS report",
                "recipients": [
                  "owner@example.in"
                ],
                "frequency": "weekly",
                "tags": [
                  "sms"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/webhooks": {
      "post": {
        "tags": [
          "Webhooks and domains"
        ],
        "summary": "Add a webhook",
        "description": "M-Box POSTs link.clicked events to your https address within seconds. Check X-Mbox-Signature: HMAC-SHA256 of the raw body with your secret. Up to 5 per account. POST /{id}/test sends a test; GET /v1/webhooks/deliveries shows results.",
        "operationId": "addAWebhook",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "active": {
                      "type": "boolean"
                    },
                    "secret": {
                      "type": "string"
                    },
                    "note": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "7a…",
                  "url": "https://hooks.example.in/mbox",
                  "events": [
                    "link.clicked"
                  ],
                  "active": true,
                  "secret": "whsec_…",
                  "note": "Store this signing secret now. It is shown only once."
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "url": "https://hooks.example.in/mbox"
              }
            }
          }
        }
      }
    },
    "/v1/domains": {
      "post": {
        "tags": [
          "Webhooks and domains"
        ],
        "summary": "Add a custom domain",
        "description": "Then create the CNAME record shown. GET lists domains; DELETE /{id} removes one.",
        "operationId": "addACustomDomain",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "hostname": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "dns": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "value": {
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "id": "d1…",
                  "hostname": "go.yourbrand.in",
                  "status": "pending",
                  "dns": {
                    "type": "CNAME",
                    "name": "go.yourbrand.in",
                    "value": "m-box-xq1x.netlify.app"
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "hostname": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "hostname": "go.yourbrand.in"
              }
            }
          }
        }
      }
    },
    "/v1/me": {
      "get": {
        "tags": [
          "Account, keys and logs"
        ],
        "summary": "Who am I",
        "description": "The account, your role, plan limits and this month's usage.",
        "operationId": "whoAmI",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "organisation": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "plan": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        }
                      }
                    },
                    "role": {
                      "type": "string"
                    },
                    "limits": {
                      "type": "object",
                      "properties": {
                        "links_per_month": {
                          "type": "integer"
                        },
                        "rows_per_import": {
                          "type": "integer"
                        },
                        "qr_codes_per_month": {
                          "type": "integer"
                        },
                        "custom_back_halves_per_month": {
                          "type": "null"
                        }
                      }
                    },
                    "usage": {
                      "type": "object",
                      "properties": {
                        "links_created": {
                          "type": "integer"
                        },
                        "clicks": {
                          "type": "integer"
                        },
                        "qr_codes": {
                          "type": "integer"
                        },
                        "custom_back_halves": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "organisation": {
                    "id": "…",
                    "name": "Lakshmi Stores",
                    "plan": "growth",
                    "status": "active"
                  },
                  "role": "developer",
                  "limits": {
                    "links_per_month": 50000,
                    "rows_per_import": 50000,
                    "qr_codes_per_month": 10,
                    "custom_back_halves_per_month": null
                  },
                  "usage": {
                    "links_created": 1840,
                    "clicks": 18220,
                    "qr_codes": 3,
                    "custom_back_halves": 12
                  }
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/usage": {
      "get": {
        "tags": [
          "Account, keys and logs"
        ],
        "summary": "Usage by month",
        "description": "",
        "operationId": "usageByMonth",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "plan": {
                      "type": "string"
                    },
                    "limits": {
                      "type": "object",
                      "properties": {
                        "links": {
                          "type": "integer"
                        },
                        "rows": {
                          "type": "integer"
                        },
                        "qr_codes": {
                          "type": "integer"
                        },
                        "custom_back_halves": {
                          "type": "null"
                        }
                      }
                    },
                    "months": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "month": {
                            "type": "string"
                          },
                          "links_created": {
                            "type": "integer"
                          },
                          "clicks": {
                            "type": "integer"
                          },
                          "qr_codes": {
                            "type": "integer"
                          },
                          "aliases": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "plan": "growth",
                  "limits": {
                    "links": 50000,
                    "rows": 50000,
                    "qr_codes": 10,
                    "custom_back_halves": null
                  },
                  "months": [
                    {
                      "month": "2026-11-01",
                      "links_created": 1840,
                      "clicks": 18220,
                      "qr_codes": 3,
                      "aliases": 12
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/failures": {
      "get": {
        "tags": [
          "Account, keys and logs"
        ],
        "summary": "Failures and reasons",
        "description": "Failed API calls, imports, webhook deliveries, workflow runs, scheduled changes and email reports, each with the reason.",
        "operationId": "failuresAndReasons",
        "parameters": [
          {
            "name": "days",
            "in": "query",
            "required": false,
            "description": "1–90, default 7.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "description": "api, import, webhook, workflow, schedule or report.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "days": {
                      "type": "integer"
                    },
                    "counts": {
                      "type": "object",
                      "properties": {
                        "api": {
                          "type": "integer"
                        },
                        "webhook": {
                          "type": "integer"
                        }
                      }
                    },
                    "failures": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string"
                          },
                          "at": {
                            "type": "string"
                          },
                          "what": {
                            "type": "string"
                          },
                          "code": {
                            "type": "string"
                          },
                          "reason": {
                            "type": "string"
                          },
                          "detail": {
                            "type": "null"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "days": 7,
                  "counts": {
                    "api": 2,
                    "webhook": 1
                  },
                  "failures": [
                    {
                      "kind": "webhook",
                      "at": "2026-11-02T13:31:12Z",
                      "what": "link.clicked → https://hooks.example.in/mbox",
                      "code": "http_500",
                      "reason": "The receiving server answered 500",
                      "detail": null
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/logs/api": {
      "get": {
        "tags": [
          "Account, keys and logs"
        ],
        "summary": "API request log",
        "description": "Calls made with your API keys: method, path, status, time taken and IP.",
        "operationId": "aPIRequestLog",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Up to 500.",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "requests": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "at": {
                            "type": "string"
                          },
                          "key": {
                            "type": "string"
                          },
                          "method": {
                            "type": "string"
                          },
                          "path": {
                            "type": "string"
                          },
                          "status": {
                            "type": "integer"
                          },
                          "duration_ms": {
                            "type": "integer"
                          },
                          "ip": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "requests": [
                    {
                      "at": "2026-11-02T13:31:10Z",
                      "key": "Server (mbx_live_Ab12)",
                      "method": "POST",
                      "path": "/v1/links",
                      "status": 201,
                      "duration_ms": 84,
                      "ip": "203.0.113.4"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/audit-events": {
      "get": {
        "tags": [
          "Account, keys and logs"
        ],
        "summary": "Audit history",
        "description": "Every change, with who made it and before/after values. Page with before (the last id).",
        "operationId": "auditHistory",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Up to 500.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "description": "",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "action",
            "in": "query",
            "required": false,
            "description": "e.g. link.updated",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer"
                          },
                          "at": {
                            "type": "string"
                          },
                          "actor_type": {
                            "type": "string"
                          },
                          "actor_label": {
                            "type": "string"
                          },
                          "action": {
                            "type": "string"
                          },
                          "target_type": {
                            "type": "string"
                          },
                          "target_id": {
                            "type": "string"
                          },
                          "before": {
                            "type": "object",
                            "properties": {
                              "url": {
                                "type": "string"
                              }
                            }
                          },
                          "after": {
                            "type": "object",
                            "properties": {
                              "url": {
                                "type": "string"
                              }
                            }
                          },
                          "ip": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "events": [
                    {
                      "id": 88121,
                      "at": "2026-11-02T11:00:00Z",
                      "actor_type": "api_key",
                      "actor_label": "mbx_live_Ab12…",
                      "action": "link.updated",
                      "target_type": "link",
                      "target_id": "8b0f…",
                      "before": {
                        "url": "https://shop.example.in/sale"
                      },
                      "after": {
                        "url": "https://shop.example.in/sale-extended"
                      },
                      "ip": "203.0.113.4"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/keys": {
      "post": {
        "tags": [
          "Account, keys and logs"
        ],
        "summary": "Create an API key",
        "description": "Dashboard sign-in as owner or admin. scope read or write. GET lists keys; DELETE /{id} revokes one at once.",
        "operationId": "createAnAPIKey",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "prefix": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "key": {
                      "type": "string"
                    },
                    "note": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "k1…",
                  "name": "Server",
                  "prefix": "mbx_live_Ab12",
                  "scope": "write",
                  "key": "mbx_live_…",
                  "note": "Store this key now. It is shown only once."
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "scope": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "name": "Server",
                "scope": "write"
              }
            }
          }
        }
      }
    },
    "/v1/settings/destinations": {
      "put": {
        "tags": [
          "Account, keys and logs"
        ],
        "summary": "Approved destinations",
        "description": "When set, links may only point to these domains and their subdomains. Empty list allows any. Owner or admin.",
        "operationId": "approvedDestinations",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "allowed_domains": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                },
                "example": {
                  "allowed_domains": [
                    "yourbrand.in",
                    "yourbrand.com"
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "allowed_domains": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              },
              "example": {
                "allowed_domains": [
                  "yourbrand.in",
                  "yourbrand.com"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/notifications": {
      "get": {
        "tags": [
          "Notifications and preferences"
        ],
        "summary": "List notifications",
        "description": "Destination changes, blocked links, 80% and 100% of monthly links, failed imports, failing webhooks, unusual traffic and deletion requests. Repeats within a minute are counted on one item.",
        "operationId": "listNotifications",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "1–200, default 50.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "unread",
            "in": "query",
            "required": false,
            "description": "true for unread only.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "before",
            "in": "query",
            "required": false,
            "description": "Page back: the last id you saw.",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "unread": {
                      "type": "integer"
                    },
                    "notifications": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "level": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "body": {
                            "type": "string"
                          },
                          "link": {
                            "type": "string"
                          },
                          "count": {
                            "type": "integer"
                          },
                          "created_at": {
                            "type": "string"
                          },
                          "read_at": {
                            "type": "null"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "unread": 1,
                  "notifications": [
                    {
                      "id": 41,
                      "kind": "destination_changed",
                      "level": "warn",
                      "title": "Link destination changed",
                      "body": "diwali now opens https://shop.example.in/sale (was https://shop.example.in/)",
                      "link": "/app/#links",
                      "count": 1,
                      "created_at": "2026-11-16T09:00:00Z",
                      "read_at": null
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/notifications/read": {
      "post": {
        "tags": [
          "Notifications and preferences"
        ],
        "summary": "Mark notifications read",
        "description": "",
        "operationId": "markNotificationsRead",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "marked": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "marked": 3
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "all": {
                    "type": "boolean",
                    "description": "true marks every unread one."
                  },
                  "ids": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    },
                    "description": "Ids to mark."
                  }
                }
              },
              "example": {
                "all": true
              }
            }
          }
        }
      }
    },
    "/v1/prefs": {
      "get": {
        "tags": [
          "Notifications and preferences"
        ],
        "summary": "List saved templates and views",
        "description": "Shared with everyone in the account.",
        "operationId": "listSavedTemplatesAndViews",
        "parameters": [
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "description": "utm_template, qr_template or saved_view.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "data": {
                            "type": "object",
                            "properties": {
                              "utm_source": {
                                "type": "string"
                              },
                              "utm_medium": {
                                "type": "string"
                              }
                            }
                          },
                          "created_by": {
                            "type": "string"
                          },
                          "created_at": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "items": [
                    {
                      "id": "6c1…",
                      "kind": "utm_template",
                      "name": "WhatsApp broadcast",
                      "data": {
                        "utm_source": "whatsapp",
                        "utm_medium": "broadcast"
                      },
                      "created_by": "you@company.in",
                      "created_at": "2026-11-16T09:00:00Z"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Notifications and preferences"
        ],
        "summary": "Save a template or view",
        "description": "Saving with an existing name replaces it. Up to 100 of each kind.",
        "operationId": "saveATemplateOrView",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "description": "utm_template, qr_template or saved_view."
                  },
                  "name": {
                    "type": "string",
                    "description": "Up to 60 characters."
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "utm_source": {
                        "type": "string"
                      },
                      "utm_medium": {
                        "type": "string"
                      },
                      "utm_campaign": {
                        "type": "string"
                      }
                    },
                    "description": "Tags, QR style or link filters."
                  }
                },
                "required": [
                  "kind",
                  "name",
                  "data"
                ]
              },
              "example": {
                "kind": "utm_template",
                "name": "WhatsApp broadcast",
                "data": {
                  "utm_source": "whatsapp",
                  "utm_medium": "broadcast",
                  "utm_campaign": "diwali"
                }
              }
            }
          }
        }
      }
    },
    "/v1/prefs/{id}": {
      "delete": {
        "tags": [
          "Notifications and preferences"
        ],
        "summary": "Delete a template or view",
        "description": "",
        "operationId": "deleteATemplateOrView",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "REPLACE_WITH_ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "deleted": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "deleted": true
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/terms": {
      "get": {
        "tags": [
          "Notifications and preferences"
        ],
        "summary": "Suggest campaigns, tags or states",
        "description": "Names already used in this account, most used first, for pick-lists. Campaigns and tags are matched without regard to case, so \"diwali sale\" is saved as the existing \"Diwali Sale\".",
        "operationId": "suggestCampaignsTagsOrStates",
        "parameters": [
          {
            "name": "kind",
            "in": "query",
            "required": true,
            "description": "campaign, tag or state.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Text to match anywhere in the name.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "1 to 50; default 20.",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string"
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "value": {
                            "type": "string"
                          },
                          "uses": {
                            "type": "integer"
                          },
                          "last_used": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "kind": "campaign",
                  "items": [
                    {
                      "value": "Diwali Sale",
                      "uses": 412,
                      "last_used": "2026-11-15T18:20:00Z"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/check": {
      "get": {
        "tags": [
          "Notifications and preferences"
        ],
        "summary": "Check a value before saving",
        "description": "Checks format, reserved words and uniqueness while someone types. Always returns 200; ok tells you whether saving would succeed.",
        "operationId": "checkAValueBeforeSaving",
        "parameters": [
          {
            "name": "field",
            "in": "query",
            "required": true,
            "description": "alias, external_id, page_slug, hostname, campaign, tag or state.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "value",
            "in": "query",
            "required": true,
            "description": "The value to check.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "except",
            "in": "query",
            "required": false,
            "description": "When editing: the link code or page id that already owns this value.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "field": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    },
                    "ok": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "taken": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "field": "alias",
                  "value": "diwali",
                  "ok": false,
                  "message": "m-bx.to/diwali is taken. Try another.",
                  "taken": true
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/feedback": {
      "post": {
        "tags": [
          "Notifications and preferences"
        ],
        "summary": "Send feedback",
        "description": "",
        "operationId": "sendFeedback",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "received": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "id": 12,
                  "received": true
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "description": "idea, problem, praise or other."
                  },
                  "message": {
                    "type": "string",
                    "description": "Up to 4,000 characters."
                  },
                  "page": {
                    "type": "string",
                    "description": "Where it happened."
                  }
                },
                "required": [
                  "message"
                ]
              },
              "example": {
                "kind": "idea",
                "message": "Let me export QR codes as PDF in bulk"
              }
            }
          }
        }
      }
    },
    "/v1/settings/retention": {
      "get": {
        "tags": [
          "Notifications and preferences"
        ],
        "summary": "Click history setting",
        "description": "Keep clicks for less than the plan allows. PUT { days } (7 to the plan's days) as an owner or admin; days: null keeps the plan's full history. Older clicks are removed within the hour and cannot be recovered.",
        "operationId": "clickHistorySetting",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "plan_days": {
                      "type": "integer"
                    },
                    "chosen_days": {
                      "type": "integer"
                    },
                    "effective_days": {
                      "type": "integer"
                    },
                    "min_days": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "plan_days": 365,
                  "chosen_days": 90,
                  "effective_days": 90,
                  "min_days": 7
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/account/deletion": {
      "post": {
        "tags": [
          "Notifications and preferences"
        ],
        "summary": "Request account deletion",
        "description": "Owner only. Everything is erased after a 14-day waiting period; DELETE the same path to cancel, GET to see the request.",
        "operationId": "requestAccountDeletion",
        "security": [],
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "delete_after": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "a1…",
                  "status": "pending",
                  "delete_after": "2026-11-30T09:00:00Z"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "confirm": {
                    "type": "string",
                    "description": "The account name, exactly."
                  },
                  "reason": {
                    "type": "string"
                  }
                },
                "required": [
                  "confirm"
                ]
              },
              "example": {
                "confirm": "Sri Lakshmi Stores",
                "reason": "Moving to another tool"
              }
            }
          }
        }
      }
    },
    "/v1/webhooks/deliveries/{id}/retry": {
      "post": {
        "tags": [
          "Webhooks and domains"
        ],
        "summary": "Retry a webhook delivery",
        "description": "Sends the same body and signature again now. Failed deliveries are also retried automatically after 1 minute, 5 minutes, 30 minutes and 2 hours; X-Mbox-Attempt says which try it is.",
        "operationId": "retryAWebhookDelivery",
        "security": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "REPLACE_WITH_ID"
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "retried": {
                      "type": "boolean"
                    },
                    "delivery_id": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "retried": true,
                  "delivery_id": 88
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/domains/{id}/pages": {
      "put": {
        "tags": [
          "Webhooks and domains"
        ],
        "summary": "Domain home and not-found pages",
        "description": "Where the bare domain (https://go.yourbrand.in/) and unknown codes on it send visitors. Empty values show the standard M-Box page.",
        "operationId": "domainHomeAndNotFoundPages",
        "security": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "REPLACE_WITH_ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "hostname": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "root_url": {
                      "type": "string"
                    },
                    "not_found_url": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "d1…",
                  "hostname": "go.yourbrand.in",
                  "status": "active",
                  "root_url": "https://yourbrand.in",
                  "not_found_url": "https://yourbrand.in/offers"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "root_url": {
                    "type": "string"
                  },
                  "not_found_url": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "root_url": "https://yourbrand.in",
                "not_found_url": "https://yourbrand.in/offers"
              }
            }
          }
        }
      }
    },
    "/v1/health": {
      "get": {
        "tags": [
          "Public tools"
        ],
        "summary": "Health",
        "description": "",
        "operationId": "health",
        "security": [],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/sms-fit": {
      "post": {
        "tags": [
          "Public tools"
        ],
        "summary": "SMS length check",
        "description": "How many SMS parts a message takes, GSM-7 or Unicode.",
        "operationId": "sMSLengthCheck",
        "security": [],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "encoding": {
                      "type": "string"
                    },
                    "characters": {
                      "type": "integer"
                    },
                    "segments": {
                      "type": "integer"
                    },
                    "remaining_in_segment": {
                      "type": "integer"
                    }
                  }
                },
                "example": {
                  "encoding": "GSM-7",
                  "characters": 55,
                  "segments": 1,
                  "remaining_in_segment": 105
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "message": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "message": "Diwali sale is live! Shop now: https://m-bx.to/diwali"
              }
            }
          }
        }
      }
    },
    "/v1/abuse": {
      "post": {
        "tags": [
          "Public tools"
        ],
        "summary": "Report a link",
        "description": "",
        "operationId": "reportALink",
        "security": [],
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": "r1…",
                  "status": "received"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string"
                  },
                  "reason": {
                    "type": "string"
                  },
                  "details": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "url": "https://m-bx.to/abc123",
                "reason": "phishing",
                "details": "Asks for bank details"
              }
            }
          }
        }
      }
    },
    "/v1/partner-program": {
      "get": {
        "tags": [
          "Partners and agencies"
        ],
        "summary": "Partner programme settings",
        "description": "Reward type and amount, events that earn, holding days, auto-approval and the public application link. PUT to change (owner or admin).",
        "operationId": "partnerProgrammeSettings",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/partners": {
      "get": {
        "tags": [
          "Partners and agencies"
        ],
        "summary": "List partners",
        "description": "Each partner with links, clicks and pending, approved and paid rewards. POST adds one; PATCH /{id} edits or approves; DELETE /{id} removes.",
        "operationId": "listPartners",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/partners/{id}/links": {
      "post": {
        "tags": [
          "Partners and agencies"
        ],
        "summary": "Credit links to a partner",
        "description": "Send url (and optional alias, campaign) to make a new tracked link, or codes: [...] to credit existing links.",
        "operationId": "creditLinksToAPartner",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "REPLACE_WITH_ID"
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/partners/report": {
      "get": {
        "tags": [
          "Partners and agencies"
        ],
        "summary": "Partner results",
        "description": "Clicks, sales, sales value, rewards, cost per sale and return per partner over 90 days.",
        "operationId": "partnerResults",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/commissions": {
      "get": {
        "tags": [
          "Partners and agencies"
        ],
        "summary": "List rewards",
        "description": "Filter by status, partner or flagged=true. Rewards are created automatically from conversions; refunds reverse them.",
        "operationId": "listRewards",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/commissions/decide": {
      "post": {
        "tags": [
          "Partners and agencies"
        ],
        "summary": "Approve, reject or pay rewards",
        "description": "Send ids and action: approve, reject, paid or reopen. Paid needs the holding period to have passed unless force: true.",
        "operationId": "approveRejectOrPayRewards",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/commissions/payout.csv": {
      "get": {
        "tags": [
          "Partners and agencies"
        ],
        "summary": "Payout file",
        "description": "Approved rewards ready to pay, totalled per partner, as CSV.",
        "operationId": "payoutFile",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/clients": {
      "get": {
        "tags": [
          "Partners and agencies"
        ],
        "summary": "Client accounts",
        "description": "Agency view: each client account with links this month, its allowance and clicks. POST creates one; PATCH/DELETE /{id}.",
        "operationId": "clientAccounts",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/accounts/switch": {
      "post": {
        "tags": [
          "Partners and agencies"
        ],
        "summary": "Switch account",
        "description": "Send org_id of an account you belong to. GET /v1/accounts lists them.",
        "operationId": "switchAccount",
        "security": [],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/branding": {
      "put": {
        "tags": [
          "Partners and agencies"
        ],
        "summary": "Branding (white label)",
        "description": "name, logo_url, color, support_email, hide_mbox, report_footer. Applies to client accounts too.",
        "operationId": "brandingWhiteLabel",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/change-requests": {
      "post": {
        "tags": [
          "Forecasts, tests and safety"
        ],
        "summary": "Ask for approval",
        "description": "kind is link.create, link.update, link.delete or api.call. An owner or admin approves with POST /v1/change-requests/{id}/approve, which makes the change.",
        "operationId": "askForApproval",
        "security": [],
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string"
                  },
                  "payload": {
                    "type": "object",
                    "properties": {
                      "method": {
                        "type": "string"
                      },
                      "path": {
                        "type": "string"
                      }
                    }
                  }
                }
              },
              "example": {
                "kind": "api.call",
                "payload": {
                  "method": "POST",
                  "path": "/workflows/12/send"
                }
              }
            }
          }
        }
      }
    },
    "/v1/organisation/transfer": {
      "post": {
        "tags": [
          "Partners and agencies"
        ],
        "summary": "Hand over ownership",
        "description": "Owner only. Send user_id and confirm (the account name).",
        "operationId": "handOverOwnership",
        "security": [],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/leads": {
      "get": {
        "tags": [
          "Sales follow-up"
        ],
        "summary": "List leads",
        "description": "Every lead: landing pages, link forms, downloads, WhatsApp and call taps, website forms, the API and leads added by hand. Company comes from the work email domain; score is 0-100 (70+ is hot). Add format=csv for a spreadsheet.",
        "operationId": "listLeads",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "new, contacted, qualified, won or lost",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "source",
            "in": "query",
            "required": false,
            "description": "page, link, download, whatsapp, call, embed, api or manual",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "company",
            "in": "query",
            "required": false,
            "description": "Company domain, for example tatasteel.com",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "email_kind",
            "in": "query",
            "required": false,
            "description": "business, personal or disposable",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "min_score",
            "in": "query",
            "required": false,
            "description": "Only leads with at least this score",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Search name, email, phone, company and notes",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Received on or after (ISO date)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "Received on or before (ISO date)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Up to 2000, default 200",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "description": "csv",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "leads": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "integer"
                          },
                          "source": {
                            "type": "string"
                          },
                          "origin": {
                            "type": "string"
                          },
                          "data": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string"
                              },
                              "email": {
                                "type": "string"
                              },
                              "phone": {
                                "type": "string"
                              },
                              "job": {
                                "type": "string"
                              }
                            }
                          },
                          "company": {
                            "type": "string"
                          },
                          "company_domain": {
                            "type": "string"
                          },
                          "email_kind": {
                            "type": "string"
                          },
                          "score": {
                            "type": "integer"
                          },
                          "status": {
                            "type": "string"
                          },
                          "assigned_to": {
                            "type": "null"
                          },
                          "tags": {
                            "type": "array",
                            "items": {}
                          },
                          "notes": {
                            "type": "null"
                          },
                          "consent_at": {
                            "type": "string"
                          },
                          "duplicate_of": {
                            "type": "null"
                          },
                          "created_at": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "leads": [
                    {
                      "id": 812,
                      "source": "download",
                      "origin": "m-bx.to/pricelist",
                      "data": {
                        "name": "Anita Rao",
                        "email": "anita@tatasteel.com",
                        "phone": "9876543210",
                        "job": "Purchase manager"
                      },
                      "company": "Tatasteel",
                      "company_domain": "tatasteel.com",
                      "email_kind": "business",
                      "score": 70,
                      "status": "new",
                      "assigned_to": null,
                      "tags": [],
                      "notes": null,
                      "consent_at": "2026-11-23T09:12:00Z",
                      "duplicate_of": null,
                      "created_at": "2026-11-23T09:12:00Z"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Sales follow-up"
        ],
        "summary": "Add a lead",
        "description": "Send leads from your CRM, chatbot or own forms. Fields: name, email, phone, company, job, city, website, message. Company and score are filled in for you.",
        "operationId": "addALead",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "source": {
                      "type": "string"
                    },
                    "origin": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "email": {
                          "type": "string"
                        },
                        "phone": {
                          "type": "string"
                        },
                        "job": {
                          "type": "string"
                        }
                      }
                    },
                    "company": {
                      "type": "string"
                    },
                    "company_domain": {
                      "type": "string"
                    },
                    "email_kind": {
                      "type": "string"
                    },
                    "score": {
                      "type": "integer"
                    },
                    "status": {
                      "type": "string"
                    },
                    "assigned_to": {
                      "type": "null"
                    },
                    "tags": {
                      "type": "array",
                      "items": {}
                    },
                    "notes": {
                      "type": "null"
                    },
                    "consent_at": {
                      "type": "string"
                    },
                    "duplicate_of": {
                      "type": "null"
                    },
                    "created_at": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "id": 812,
                  "source": "download",
                  "origin": "m-bx.to/pricelist",
                  "data": {
                    "name": "Anita Rao",
                    "email": "anita@tatasteel.com",
                    "phone": "9876543210",
                    "job": "Purchase manager"
                  },
                  "company": "Tatasteel",
                  "company_domain": "tatasteel.com",
                  "email_kind": "business",
                  "score": 70,
                  "status": "new",
                  "assigned_to": null,
                  "tags": [],
                  "notes": null,
                  "consent_at": "2026-11-23T09:12:00Z",
                  "duplicate_of": null,
                  "created_at": "2026-11-23T09:12:00Z"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "data": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "email": {
                        "type": "string"
                      },
                      "phone": {
                        "type": "string"
                      },
                      "message": {
                        "type": "string"
                      }
                    }
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "notes": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "data": {
                  "name": "Anita Rao",
                  "email": "anita@tatasteel.com",
                  "phone": "9876543210",
                  "message": "Need 500 QR codes for packaging"
                },
                "tags": [
                  "packaging"
                ],
                "notes": "From the trade fair"
              }
            }
          }
        }
      }
    },
    "/v1/leads/{id}": {
      "get": {
        "tags": [
          "Sales follow-up"
        ],
        "summary": "Get a lead",
        "description": "One lead with the same person's earlier leads (same email or phone) and its follow-ups.",
        "operationId": "getALead",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "REPLACE_WITH_ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "lead": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "integer"
                        },
                        "source": {
                          "type": "string"
                        },
                        "origin": {
                          "type": "string"
                        },
                        "data": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "email": {
                              "type": "string"
                            },
                            "phone": {
                              "type": "string"
                            },
                            "job": {
                              "type": "string"
                            }
                          }
                        },
                        "company": {
                          "type": "string"
                        },
                        "company_domain": {
                          "type": "string"
                        },
                        "email_kind": {
                          "type": "string"
                        },
                        "score": {
                          "type": "integer"
                        },
                        "status": {
                          "type": "string"
                        },
                        "assigned_to": {
                          "type": "null"
                        },
                        "tags": {
                          "type": "array",
                          "items": {}
                        },
                        "notes": {
                          "type": "null"
                        },
                        "consent_at": {
                          "type": "string"
                        },
                        "duplicate_of": {
                          "type": "null"
                        },
                        "created_at": {
                          "type": "string"
                        }
                      }
                    },
                    "history": {
                      "type": "array",
                      "items": {}
                    },
                    "tasks": {
                      "type": "array",
                      "items": {}
                    }
                  }
                },
                "example": {
                  "lead": {
                    "id": 812,
                    "source": "download",
                    "origin": "m-bx.to/pricelist",
                    "data": {
                      "name": "Anita Rao",
                      "email": "anita@tatasteel.com",
                      "phone": "9876543210",
                      "job": "Purchase manager"
                    },
                    "company": "Tatasteel",
                    "company_domain": "tatasteel.com",
                    "email_kind": "business",
                    "score": 70,
                    "status": "new",
                    "assigned_to": null,
                    "tags": [],
                    "notes": null,
                    "consent_at": "2026-11-23T09:12:00Z",
                    "duplicate_of": null,
                    "created_at": "2026-11-23T09:12:00Z"
                  },
                  "history": [],
                  "tasks": []
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Sales follow-up"
        ],
        "summary": "Update a lead",
        "description": "Set status, assigned_to, notes, tags, or correct data fields (send an empty string to clear one).",
        "operationId": "updateALead",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "REPLACE_WITH_ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string"
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "data": {
                    "type": "object",
                    "properties": {
                      "company": {
                        "type": "string"
                      }
                    }
                  }
                }
              },
              "example": {
                "status": "qualified",
                "tags": [
                  "enterprise"
                ],
                "data": {
                  "company": "Tata Steel"
                }
              }
            }
          }
        }
      }
    },
    "/v1/leads/companies": {
      "get": {
        "tags": [
          "Sales follow-up"
        ],
        "summary": "Companies",
        "description": "Leads grouped by work email domain, with counts, best score, open and won.",
        "operationId": "companies",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "companies": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "domain": {
                            "type": "string"
                          },
                          "company": {
                            "type": "string"
                          },
                          "leads": {
                            "type": "integer"
                          },
                          "best_score": {
                            "type": "integer"
                          },
                          "open": {
                            "type": "integer"
                          },
                          "won": {
                            "type": "integer"
                          },
                          "last_at": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "companies": [
                    {
                      "domain": "tatasteel.com",
                      "company": "Tatasteel",
                      "leads": 3,
                      "best_score": 70,
                      "open": 2,
                      "won": 1,
                      "last_at": "2026-11-23T09:12:00Z"
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/leads/link-form/{link_id}": {
      "put": {
        "tags": [
          "Sales follow-up"
        ],
        "summary": "Lead form on a link",
        "description": "Show a short form before the link opens (kind form) or before a file downloads (kind download). GET returns the current form. Not for links with a password.",
        "operationId": "leadFormOnALink",
        "parameters": [
          {
            "name": "link_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "on": {
                    "type": "boolean"
                  },
                  "kind": {
                    "type": "string"
                  },
                  "required": {
                    "type": "boolean"
                  },
                  "fields": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "need": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "business_only": {
                    "type": "boolean"
                  },
                  "title": {
                    "type": "string"
                  },
                  "consent": {
                    "type": "string"
                  },
                  "whatsapp": {
                    "type": "string"
                  },
                  "remember_days": {
                    "type": "integer"
                  }
                }
              },
              "example": {
                "on": true,
                "kind": "download",
                "required": true,
                "fields": [
                  "name",
                  "email",
                  "phone",
                  "company"
                ],
                "need": [
                  "email"
                ],
                "business_only": true,
                "title": "Get our 2027 price list",
                "consent": "I agree that Acme may contact me about this.",
                "whatsapp": "919876543210",
                "remember_days": 30
              }
            }
          }
        }
      }
    },
    "/v1/leads/forms": {
      "get": {
        "tags": [
          "Sales follow-up"
        ],
        "summary": "Website forms",
        "description": "Forms for your own website. POST to create (name, fields, need, business_only, consent, thanks, redirect_url, origins), PATCH /{id}, DELETE /{id}. Embed with <div data-mbox-form=\"KEY\"></div><script src=\"https://m-box.in/embed/leads.js\" async></script>.",
        "operationId": "websiteForms",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "forms": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "key": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "fields": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "need": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "business_only": {
                            "type": "boolean"
                          },
                          "origins": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "active": {
                            "type": "boolean"
                          },
                          "submissions": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "forms": [
                    {
                      "id": "6a2…",
                      "key": "3f9c1a7b2e4d8c0f1a2b",
                      "name": "Contact page",
                      "fields": [
                        "name",
                        "email",
                        "phone",
                        "message"
                      ],
                      "need": [
                        "email"
                      ],
                      "business_only": false,
                      "origins": [
                        "acme.in"
                      ],
                      "active": true,
                      "submissions": 42
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/tasks": {
      "get": {
        "tags": [
          "Sales follow-up"
        ],
        "summary": "Follow-up tasks",
        "description": "POST to add (title, due_at, assignee, lead_id); PATCH /{id} to complete.",
        "operationId": "followUpTasks",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/optouts": {
      "post": {
        "tags": [
          "Sales follow-up"
        ],
        "summary": "Add opt-outs",
        "description": "Send contact or contacts: [...] (emails or mobile numbers). Stored scrambled. POST /v1/optouts/check returns which of a list opted out.",
        "operationId": "addOptOuts",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/message-templates": {
      "get": {
        "tags": [
          "Sales follow-up"
        ],
        "summary": "Message templates",
        "description": "SMS, WhatsApp and email wording with DLT ids and SMS part counts. POST, PATCH /{id}, DELETE /{id}.",
        "operationId": "messageTemplates",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/deliveries/import": {
      "post": {
        "tags": [
          "Sales follow-up"
        ],
        "summary": "Import delivery reports",
        "description": "rows: [{ message_id, status, phone, link, campaign, at }]. GET /v1/deliveries/report compares delivered with clicked.",
        "operationId": "importDeliveryReports",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/attribution": {
      "get": {
        "tags": [
          "Insights and tools"
        ],
        "summary": "Attribution",
        "description": "First-touch, last-touch and shared credit by campaign or link (by=link), with the rules used. from, to as dates.",
        "operationId": "attribution",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/funnel": {
      "get": {
        "tags": [
          "Insights and tools"
        ],
        "summary": "Funnel",
        "description": "Clicks, enquiries, sign-ups and purchases, with the share kept at each step. Optional campaign.",
        "operationId": "funnel",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/customer-value": {
      "get": {
        "tags": [
          "Insights and tools"
        ],
        "summary": "Customer value",
        "description": "Customers by first campaign, repeat buyers, value per customer, cost per customer and return on spend.",
        "operationId": "customerValue",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/conversions/import": {
      "post": {
        "tags": [
          "Insights and tools"
        ],
        "summary": "Import offline sales",
        "description": "rows: [{ event, value, order_id, customer_id, link, at }], up to 5,000. Repeats are skipped.",
        "operationId": "importOfflineSales",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/url-check": {
      "post": {
        "tags": [
          "Insights and tools"
        ],
        "summary": "Check an address",
        "description": "Follows redirects safely, reports problems, Safe Browsing status and the sharing preview.",
        "operationId": "checkAnAddress",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/links/{code}/impact": {
      "get": {
        "tags": [
          "Insights and tools"
        ],
        "summary": "What depends on a link",
        "description": "QR codes, pages, workflows, partners and scheduled changes that use the link, and its visits this week.",
        "operationId": "whatDependsOnALink",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "diwali"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/links/{code}/preview": {
      "put": {
        "tags": [
          "Insights and tools"
        ],
        "summary": "Sharing preview",
        "description": "title, description and image shown by WhatsApp, LinkedIn, X and Facebook.",
        "operationId": "sharingPreview",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "diwali"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/action-centre": {
      "get": {
        "tags": [
          "Insights and tools"
        ],
        "summary": "Action centre",
        "description": "What needs attention now, each with the reason.",
        "operationId": "actionCentre",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/gs1": {
      "post": {
        "tags": [
          "Insights and tools"
        ],
        "summary": "GS1 product links",
        "description": "gtin, default_url, optional batches and host. Scans of https://host/01/{gtin} open the page.",
        "operationId": "gS1ProductLinks",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/documents": {
      "post": {
        "tags": [
          "Insights and tools"
        ],
        "summary": "Protected files",
        "description": "multipart/form-data with file and a password and/or email_domain. Returns the share address.",
        "operationId": "protectedFiles",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/domains/{id}/check": {
      "post": {
        "tags": [
          "Insights and tools"
        ],
        "summary": "Domain set-up check",
        "description": "Checks DNS, ownership (TXT) and HTTPS, and turns the domain on when ready.",
        "operationId": "domainSetUpCheck",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "REPLACE_WITH_ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/export": {
      "get": {
        "tags": [
          "Insights and tools"
        ],
        "summary": "Export everything",
        "description": "Owner or admin. A ZIP of every record the account holds.",
        "operationId": "exportEverything",
        "security": [],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/workspaces": {
      "get": {
        "tags": [
          "Teams, sign-in and apps"
        ],
        "summary": "Workspaces",
        "description": "Workspaces with their link counts. POST to create one (name, color); POST /v1/workspaces/{id}/links with codes to move links in.",
        "operationId": "workspaces",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/member-access/{user_id}": {
      "put": {
        "tags": [
          "Teams, sign-in and apps"
        ],
        "summary": "Member access limits",
        "description": "Owner or admin. workspaces, campaigns, domains and can_delete limit what a developer or analyst may change. Checked before every link change.",
        "operationId": "memberAccessLimits",
        "security": [],
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/agency-templates/{id}/apply": {
      "post": {
        "tags": [
          "Teams, sign-in and apps"
        ],
        "summary": "Agency templates",
        "description": "Copies a saved set of UTM templates, QR styles and settings into a client account.",
        "operationId": "agencyTemplates",
        "security": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "REPLACE_WITH_ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/passkeys/register/options": {
      "post": {
        "tags": [
          "Teams, sign-in and apps"
        ],
        "summary": "Passkeys",
        "description": "Starts adding a passkey (fingerprint, face or security key) to the signed-in person.",
        "operationId": "passkeys",
        "security": [],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/oauth-apps": {
      "post": {
        "tags": [
          "Teams, sign-in and apps"
        ],
        "summary": "OAuth apps",
        "description": "Register a third-party app (name, website, redirect_uris). Returns client_id and a one-time client_secret.",
        "operationId": "oAuthApps",
        "security": [],
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/quality": {
      "get": {
        "tags": [
          "Teams, sign-in and apps"
        ],
        "summary": "Conversion quality",
        "description": "Quality score per source and campaign: refunds, duplicates and repeat buyers.",
        "operationId": "conversionQuality",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/experiments/{code}": {
      "put": {
        "tags": [
          "Teams, sign-in and apps"
        ],
        "summary": "Self-optimising A/B test",
        "description": "goal, min_clicks, floor_pct. Every night the split moves toward the variant that converts best.",
        "operationId": "selfOptimisingABTest",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "diwali"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/forecast": {
      "get": {
        "tags": [
          "Forecasts, tests and safety"
        ],
        "summary": "Forecast",
        "description": "Expected clicks per day with a low and high (8 in 10 range), the weekly trend and the busiest weekday.",
        "operationId": "forecast",
        "parameters": [
          {
            "name": "code",
            "in": "query",
            "required": false,
            "description": "One link; empty for the whole account",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "description": "1 to 90, default 14",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "enough_data": {
                      "type": "boolean"
                    },
                    "total": {
                      "type": "object",
                      "properties": {
                        "expected": {
                          "type": "integer"
                        },
                        "low": {
                          "type": "integer"
                        },
                        "high": {
                          "type": "integer"
                        }
                      }
                    },
                    "trend_per_week_pct": {
                      "type": "number"
                    },
                    "busiest_weekday": {
                      "type": "string"
                    },
                    "forecast": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "day": {
                            "type": "string"
                          },
                          "expected": {
                            "type": "integer"
                          },
                          "low": {
                            "type": "integer"
                          },
                          "high": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "enough_data": true,
                  "total": {
                    "expected": 4210,
                    "low": 3650,
                    "high": 4770
                  },
                  "trend_per_week_pct": 3.4,
                  "busiest_weekday": "Saturday",
                  "forecast": [
                    {
                      "day": "2026-11-17",
                      "expected": 290,
                      "low": 240,
                      "high": 340
                    }
                  ]
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/anomalies/explain": {
      "post": {
        "tags": [
          "Forecasts, tests and safety"
        ],
        "summary": "Explain unusual traffic",
        "description": "Finds the most unusual day in the last 14 (or the day you send) and the countries, sources, devices, links or QR placements behind it. Plain-language explanation when AI is on.",
        "operationId": "explainUnusualTraffic",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "code": "diwali"
              }
            }
          }
        }
      }
    },
    "/v1/creative-compare": {
      "get": {
        "tags": [
          "Forecasts, tests and safety"
        ],
        "summary": "Compare two creatives",
        "description": "Conversion rate of each side, the lift, and a significance test (p-value) with a verdict.",
        "operationId": "compareTwoCreatives",
        "parameters": [
          {
            "name": "a",
            "in": "query",
            "required": true,
            "description": "Back-half, or tag:name",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "b",
            "in": "query",
            "required": true,
            "description": "Back-half, or tag:name",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "goal",
            "in": "query",
            "required": false,
            "description": "any, lead, signup or purchase",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "days",
            "in": "query",
            "required": false,
            "description": "Default 30",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/device-test/{code}": {
      "put": {
        "tags": [
          "Forecasts, tests and safety"
        ],
        "summary": "Mobile vs desktop test",
        "description": "Sends phones and computers to different pages. GET the same path for conversion rates by device and a significance test.",
        "operationId": "mobileVsDesktopTest",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "diwali"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "mobile": {
                    "type": "string"
                  },
                  "desktop": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "mobile": "https://m.example.in/offer",
                "desktop": "https://example.in/offer"
              }
            }
          }
        }
      }
    },
    "/v1/journey/{code}": {
      "get": {
        "tags": [
          "Forecasts, tests and safety"
        ],
        "summary": "Journey check",
        "description": "Checks every step from click to sale: link status, domain, safety, destination page and redirects, UTM tags, clicks and conversion tracking, with what to fix.",
        "operationId": "journeyCheck",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "diwali"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/catalog": {
      "put": {
        "tags": [
          "Forecasts, tests and safety"
        ],
        "summary": "Product catalog",
        "description": "Links tagged sku:CODE follow the product page. POST /v1/catalog/import with rows; POST /v1/catalog/apply (optional fallback) updates the links.",
        "operationId": "productCatalog",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sku": {
                    "type": "string"
                  },
                  "url": {
                    "type": "string"
                  },
                  "status": {
                    "type": "string"
                  },
                  "replaced_by": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "sku": "KURTA-RED-M",
                "url": "https://shop.example.in/p/red-kurta",
                "status": "discontinued",
                "replaced_by": "KURTA-RED-M2"
              }
            }
          }
        }
      }
    },
    "/v1/compliance": {
      "put": {
        "tags": [
          "Forecasts, tests and safety"
        ],
        "summary": "Compliance rules",
        "description": "Owner or admin. New links and destination changes that break the rules are refused with compliance_blocked. POST /v1/compliance/check tries an address.",
        "operationId": "complianceRules",
        "security": [],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "rules": {
                    "type": "object",
                    "properties": {
                      "allowed_domains": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "blocked_words": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "require_https": {
                        "type": "boolean"
                      },
                      "require_utm": {
                        "type": "boolean"
                      },
                      "require_campaign": {
                        "type": "boolean"
                      },
                      "max_phishing_score": {
                        "type": "integer"
                      }
                    }
                  }
                }
              },
              "example": {
                "rules": {
                  "allowed_domains": [
                    "example.in"
                  ],
                  "blocked_words": [
                    "guaranteed returns"
                  ],
                  "require_https": true,
                  "require_utm": true,
                  "require_campaign": false,
                  "max_phishing_score": 60
                }
              }
            }
          }
        }
      }
    },
    "/v1/risk-check": {
      "post": {
        "tags": [
          "Forecasts, tests and safety"
        ],
        "summary": "Risk check",
        "description": "Phishing risk score (0 to 100) for an address, with the reasons.",
        "operationId": "riskCheck",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "url": "https://example.in/login"
              }
            }
          }
        }
      }
    },
    "/v1/starter-kits": {
      "get": {
        "tags": [
          "Forecasts, tests and safety"
        ],
        "summary": "Starter kits",
        "description": "Ready-made campaigns, UTM templates, QR places and ideas by industry. POST /v1/starter-kits/{id} adds one; POST /v1/starter-kits/ai with business suggests a custom kit.",
        "operationId": "starterKits",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/optimiser/run": {
      "post": {
        "tags": [
          "Forecasts, tests and safety"
        ],
        "summary": "Optimiser",
        "description": "Proposes fixes (pause broken pages, move A/B traffic to a clear winner, add UTM tags, extend busy links) as approval requests. Nothing changes until approved.",
        "operationId": "optimiser",
        "security": [],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/links-config/export": {
      "get": {
        "tags": [
          "Forecasts, tests and safety"
        ],
        "summary": "Export link settings",
        "description": "Every link's settings including routing rules, as JSON. POST /v1/links-config/import with links and mode (skip or update) brings them back or into another account.",
        "operationId": "exportLinkSettings",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/domain-transfer": {
      "post": {
        "tags": [
          "Forecasts, tests and safety"
        ],
        "summary": "Move a domain",
        "description": "Owner or admin of both accounts. The domain and its links, with their history, move to the other account.",
        "operationId": "moveADomain",
        "security": [],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "domain_id": {
                    "type": "string"
                  },
                  "to_org": {
                    "type": "string"
                  },
                  "confirm": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "domain_id": "…",
                "to_org": "…",
                "confirm": "go.brand.in"
              }
            }
          }
        }
      }
    },
    "/v1/reputation-centre": {
      "get": {
        "tags": [
          "Forecasts, tests and safety"
        ],
        "summary": "Reputation centre",
        "description": "Health score for this account and the client accounts it manages: domains, risky links, blocked links and failing pages.",
        "operationId": "reputationCentre",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/pixels": {
      "post": {
        "tags": [
          "Pixels, alerts, guard and certificates"
        ],
        "summary": "Add a retargeting pixel",
        "description": "kind is meta, google (AW-… or G-…) or linkedin. Pixels fire when a person opens a link, never for bots or browsers that ask not to be tracked.",
        "operationId": "addARetargetingPixel",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string"
                  },
                  "pixel_id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "all_links": {
                    "type": "boolean"
                  }
                }
              },
              "example": {
                "kind": "meta",
                "pixel_id": "1234567890123456",
                "name": "Diwali retargeting",
                "all_links": false
              }
            }
          }
        }
      }
    },
    "/v1/pixels/{id}/links": {
      "put": {
        "tags": [
          "Pixels, alerts, guard and certificates"
        ],
        "summary": "Choose links for a pixel",
        "description": "Replaces the list of links that fire this pixel. Answers with not_found for back-halves that do not exist.",
        "operationId": "chooseLinksForAPixel",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "REPLACE_WITH_ID"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "codes": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              },
              "example": {
                "codes": [
                  "diwali-sale",
                  "menu"
                ]
              }
            }
          }
        }
      }
    },
    "/v1/alerts": {
      "put": {
        "tags": [
          "Pixels, alerts, guard and certificates"
        ],
        "summary": "Team chat alerts",
        "description": "Owner or admin. Slack, Google Chat, Microsoft Teams or Discord incoming webhook. level: bad, warn or info. POST /v1/alerts/test sends a test message.",
        "operationId": "teamChatAlerts",
        "security": [],
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "webhook": {
                    "type": "string"
                  },
                  "level": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "webhook": "https://hooks.slack.com/services/…",
                "level": "warn"
              }
            }
          }
        }
      }
    },
    "/v1/guard": {
      "get": {
        "tags": [
          "Pixels, alerts, guard and certificates"
        ],
        "summary": "Destination guard",
        "description": "Links whose website looks parked, expired or suspended, and the renewal date of every website your links point to. PUT with mode off, alert or pause.",
        "operationId": "destinationGuard",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/certificates": {
      "post": {
        "tags": [
          "Pixels, alerts, guard and certificates"
        ],
        "summary": "Issue a click certificate",
        "description": "A public, verifiable page with the number of real people who opened the link in a finished period. DELETE /v1/certificates/{token} withdraws it.",
        "operationId": "issueAClickCertificate",
        "parameters": [],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "undefined"
                }
              }
            }
          },
          "default": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "from": {
                    "type": "string"
                  },
                  "to": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  }
                }
              },
              "example": {
                "code": "diwali-sale",
                "from": "2026-10-01",
                "to": "2026-10-31",
                "title": "Instagram campaign, October"
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "An API key (mbx_live_…) from Developers › API keys."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "too_many_imports",
                  "file_url_unreachable",
                  "file_too_large",
                  "size_required",
                  "already_started",
                  "name_taken",
                  "invalid_data",
                  "invalid_style",
                  "unauthorized",
                  "invalid_key",
                  "second_step_required",
                  "read_only_key",
                  "forbidden",
                  "ip_not_allowed",
                  "account_restricted",
                  "plan_feature",
                  "csv_only",
                  "rate_limited",
                  "quota_exceeded",
                  "storage_full",
                  "alias_quota_exceeded",
                  "qr_quota_exceeded",
                  "page_limit",
                  "invalid_url",
                  "destination_blocked",
                  "destination_not_approved",
                  "alias_taken",
                  "external_id_taken",
                  "link_not_found",
                  "not_found",
                  "invalid_flow",
                  "invalid_tracking_key",
                  "invalid_kind",
                  "confirm_required",
                  "invalid_days",
                  "compliance_blocked",
                  "invalid_tag",
                  "invalid_campaign",
                  "invalid_reference",
                  "details_required",
                  "invalid_email",
                  "password_link",
                  "fields_required",
                  "invalid_phone",
                  "invalid_external_id",
                  "internal_error"
                ]
              },
              "message": {
                "type": "string"
              },
              "docs": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}