{
 "openapi": "3.1.0",
 "info": {
  "title": "OpenZPL API",
  "version": "1",
  "description": "Render ZPL labels to PNG and PDF. Compatible with Labelary's v1 API.\n\n- Free, no sign-up and no key: 3 requests per second and 5,000 labels per UTC day, per IP address.\n- Labels, not requests, count against the daily allowance: every label rendered, `^PQ` copies and PDF pages included. A 10-label PDF is 1 request and 10 labels.\n- Every request: up to 50 labels, a 1 MB body, 15 inches per side, and 10 seconds of render time.\n- Paid plans (Starter $9/month: 10 requests/s and 25,000 labels/day, Pro $29/month: 10 requests/s and 100,000 labels/day, Business $99/month: 20 requests/s and 500,000 labels/day) are announced but billing isn't live yet. API keys work today; a workspace stays on the Free plan until billing opens.\n- Over a limit the API answers `429` with `Retry-After` (seconds) and a body that names the limit, e.g. `ERROR: Daily limit reached: 5000 labels per UTC day on this plan (^PQ copies and PDF pages count)`.",
  "contact": {
   "url": "https://openzpl.com/docs/api/"
  }
 },
 "servers": [
  {
   "url": "https://api.openzpl.com"
  }
 ],
 "externalDocs": {
  "url": "https://openzpl.com/docs/api/"
 },
 "components": {
  "securitySchemes": {
   "apiKey": {
    "type": "apiKey",
    "in": "header",
    "name": "X-API-Key"
   }
  }
 },
 "security": [
  {},
  {
   "apiKey": []
  }
 ],
 "paths": {
  "/v1/printers/{dpmm}/labels/{size}/{index}/": {
   "post": {
    "operationId": "renderLabel",
    "summary": "Render one label to PNG or PDF",
    "parameters": [
     {
      "name": "dpmm",
      "in": "path",
      "required": true,
      "description": "Print density in dots per millimetre.",
      "schema": {
       "type": "string",
       "enum": [
        "6dpmm",
        "8dpmm",
        "12dpmm",
        "24dpmm"
       ]
      }
     },
     {
      "name": "size",
      "in": "path",
      "required": true,
      "description": "Label width x height in inches, e.g. 4x6. Up to 15 per side.",
      "schema": {
       "type": "string",
       "pattern": "^\\d+(\\.\\d+)?x\\d+(\\.\\d+)?$"
      },
      "example": "4x6"
     },
     {
      "name": "index",
      "in": "path",
      "required": true,
      "description": "Label to render, from 0.",
      "schema": {
       "type": "integer",
       "minimum": 0
      }
     },
     {
      "name": "Accept",
      "in": "header",
      "schema": {
       "type": "string",
       "enum": [
        "image/png",
        "application/pdf"
       ],
       "default": "image/png"
      }
     },
     {
      "name": "X-Quality",
      "in": "header",
      "schema": {
       "type": "string",
       "enum": [
        "Grayscale",
        "Bitonal"
       ],
       "default": "Grayscale"
      }
     },
     {
      "name": "X-Rotation",
      "in": "header",
      "schema": {
       "type": "integer",
       "enum": [
        0,
        90,
        180,
        270
       ],
       "default": 0
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "string"
       },
       "example": "^XA^FO50,50^A0N,40,40^FDHello^FS^XZ"
      },
      "text/plain": {
       "schema": {
        "type": "string"
       }
      },
      "multipart/form-data": {
       "schema": {
        "type": "object",
        "properties": {
         "file": {
          "type": "string",
          "format": "binary"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The rendered label(s).",
      "headers": {
       "X-Total-Count": {
        "description": "Labels the ZPL produces, ^PQ copies included.",
        "schema": {
         "type": "integer"
        }
       }
      },
      "content": {
       "image/png": {
        "schema": {
         "type": "string",
         "format": "binary"
        }
       },
       "application/pdf": {
        "schema": {
         "type": "string",
         "format": "binary"
        }
       }
      }
     },
     "400": {
      "description": "Plain-text error starting with `ERROR: `.",
      "content": {
       "text/plain": {
        "schema": {
         "type": "string"
        },
        "example": "ERROR: Label index 3 is out of range; the ZPL produces 1 label(s)"
       }
      }
     },
     "401": {
      "description": "Plain-text error starting with `ERROR: `.",
      "content": {
       "text/plain": {
        "schema": {
         "type": "string"
        },
        "example": "ERROR: Label index 3 is out of range; the ZPL produces 1 label(s)"
       }
      }
     },
     "406": {
      "description": "Plain-text error starting with `ERROR: `.",
      "content": {
       "text/plain": {
        "schema": {
         "type": "string"
        },
        "example": "ERROR: Label index 3 is out of range; the ZPL produces 1 label(s)"
       }
      }
     },
     "413": {
      "description": "Plain-text error starting with `ERROR: `.",
      "content": {
       "text/plain": {
        "schema": {
         "type": "string"
        },
        "example": "ERROR: Label index 3 is out of range; the ZPL produces 1 label(s)"
       }
      }
     },
     "429": {
      "description": "Plain-text error starting with `ERROR: `.",
      "content": {
       "text/plain": {
        "schema": {
         "type": "string"
        },
        "example": "ERROR: Label index 3 is out of range; the ZPL produces 1 label(s)"
       }
      },
      "headers": {
       "Retry-After": {
        "description": "Seconds to wait.",
        "schema": {
         "type": "integer"
        }
       }
      }
     },
     "503": {
      "description": "Plain-text error starting with `ERROR: `.",
      "content": {
       "text/plain": {
        "schema": {
         "type": "string"
        },
        "example": "ERROR: Label index 3 is out of range; the ZPL produces 1 label(s)"
       }
      }
     }
    }
   }
  },
  "/v1/printers/{dpmm}/labels/{size}/": {
   "post": {
    "operationId": "renderAllLabels",
    "summary": "Render every label (PDF, one page per label; PNG returns the first)",
    "parameters": [
     {
      "name": "dpmm",
      "in": "path",
      "required": true,
      "description": "Print density in dots per millimetre.",
      "schema": {
       "type": "string",
       "enum": [
        "6dpmm",
        "8dpmm",
        "12dpmm",
        "24dpmm"
       ]
      }
     },
     {
      "name": "size",
      "in": "path",
      "required": true,
      "description": "Label width x height in inches, e.g. 4x6. Up to 15 per side.",
      "schema": {
       "type": "string",
       "pattern": "^\\d+(\\.\\d+)?x\\d+(\\.\\d+)?$"
      },
      "example": "4x6"
     },
     {
      "name": "Accept",
      "in": "header",
      "schema": {
       "type": "string",
       "enum": [
        "image/png",
        "application/pdf"
       ],
       "default": "image/png"
      }
     },
     {
      "name": "X-Quality",
      "in": "header",
      "schema": {
       "type": "string",
       "enum": [
        "Grayscale",
        "Bitonal"
       ],
       "default": "Grayscale"
      }
     },
     {
      "name": "X-Rotation",
      "in": "header",
      "schema": {
       "type": "integer",
       "enum": [
        0,
        90,
        180,
        270
       ],
       "default": 0
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/x-www-form-urlencoded": {
       "schema": {
        "type": "string"
       },
       "example": "^XA^FO50,50^A0N,40,40^FDHello^FS^XZ"
      },
      "text/plain": {
       "schema": {
        "type": "string"
       }
      },
      "multipart/form-data": {
       "schema": {
        "type": "object",
        "properties": {
         "file": {
          "type": "string",
          "format": "binary"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "The rendered label(s).",
      "headers": {
       "X-Total-Count": {
        "description": "Labels the ZPL produces, ^PQ copies included.",
        "schema": {
         "type": "integer"
        }
       }
      },
      "content": {
       "image/png": {
        "schema": {
         "type": "string",
         "format": "binary"
        }
       },
       "application/pdf": {
        "schema": {
         "type": "string",
         "format": "binary"
        }
       }
      }
     },
     "400": {
      "description": "Plain-text error starting with `ERROR: `.",
      "content": {
       "text/plain": {
        "schema": {
         "type": "string"
        },
        "example": "ERROR: Label index 3 is out of range; the ZPL produces 1 label(s)"
       }
      }
     },
     "401": {
      "description": "Plain-text error starting with `ERROR: `.",
      "content": {
       "text/plain": {
        "schema": {
         "type": "string"
        },
        "example": "ERROR: Label index 3 is out of range; the ZPL produces 1 label(s)"
       }
      }
     },
     "406": {
      "description": "Plain-text error starting with `ERROR: `.",
      "content": {
       "text/plain": {
        "schema": {
         "type": "string"
        },
        "example": "ERROR: Label index 3 is out of range; the ZPL produces 1 label(s)"
       }
      }
     },
     "413": {
      "description": "Plain-text error starting with `ERROR: `.",
      "content": {
       "text/plain": {
        "schema": {
         "type": "string"
        },
        "example": "ERROR: Label index 3 is out of range; the ZPL produces 1 label(s)"
       }
      }
     },
     "429": {
      "description": "Plain-text error starting with `ERROR: `.",
      "content": {
       "text/plain": {
        "schema": {
         "type": "string"
        },
        "example": "ERROR: Label index 3 is out of range; the ZPL produces 1 label(s)"
       }
      },
      "headers": {
       "Retry-After": {
        "description": "Seconds to wait.",
        "schema": {
         "type": "integer"
        }
       }
      }
     },
     "503": {
      "description": "Plain-text error starting with `ERROR: `.",
      "content": {
       "text/plain": {
        "schema": {
         "type": "string"
        },
        "example": "ERROR: Label index 3 is out of range; the ZPL produces 1 label(s)"
       }
      }
     }
    }
   }
  },
  "/v1/printers/{dpmm}/labels/{size}/{index}/{zpl}": {
   "get": {
    "operationId": "renderLabelGet",
    "summary": "Render a short URL-encoded ZPL",
    "parameters": [
     {
      "name": "dpmm",
      "in": "path",
      "required": true,
      "description": "Print density in dots per millimetre.",
      "schema": {
       "type": "string",
       "enum": [
        "6dpmm",
        "8dpmm",
        "12dpmm",
        "24dpmm"
       ]
      }
     },
     {
      "name": "size",
      "in": "path",
      "required": true,
      "description": "Label width x height in inches, e.g. 4x6. Up to 15 per side.",
      "schema": {
       "type": "string",
       "pattern": "^\\d+(\\.\\d+)?x\\d+(\\.\\d+)?$"
      },
      "example": "4x6"
     },
     {
      "name": "index",
      "in": "path",
      "required": true,
      "description": "Label to render, from 0.",
      "schema": {
       "type": "integer",
       "minimum": 0
      }
     },
     {
      "name": "zpl",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "Accept",
      "in": "header",
      "schema": {
       "type": "string",
       "enum": [
        "image/png",
        "application/pdf"
       ],
       "default": "image/png"
      }
     },
     {
      "name": "X-Quality",
      "in": "header",
      "schema": {
       "type": "string",
       "enum": [
        "Grayscale",
        "Bitonal"
       ],
       "default": "Grayscale"
      }
     },
     {
      "name": "X-Rotation",
      "in": "header",
      "schema": {
       "type": "integer",
       "enum": [
        0,
        90,
        180,
        270
       ],
       "default": 0
      }
     }
    ],
    "responses": {
     "200": {
      "description": "The rendered label(s).",
      "headers": {
       "X-Total-Count": {
        "description": "Labels the ZPL produces, ^PQ copies included.",
        "schema": {
         "type": "integer"
        }
       }
      },
      "content": {
       "image/png": {
        "schema": {
         "type": "string",
         "format": "binary"
        }
       },
       "application/pdf": {
        "schema": {
         "type": "string",
         "format": "binary"
        }
       }
      }
     },
     "400": {
      "description": "Plain-text error starting with `ERROR: `.",
      "content": {
       "text/plain": {
        "schema": {
         "type": "string"
        },
        "example": "ERROR: Label index 3 is out of range; the ZPL produces 1 label(s)"
       }
      }
     },
     "401": {
      "description": "Plain-text error starting with `ERROR: `.",
      "content": {
       "text/plain": {
        "schema": {
         "type": "string"
        },
        "example": "ERROR: Label index 3 is out of range; the ZPL produces 1 label(s)"
       }
      }
     },
     "406": {
      "description": "Plain-text error starting with `ERROR: `.",
      "content": {
       "text/plain": {
        "schema": {
         "type": "string"
        },
        "example": "ERROR: Label index 3 is out of range; the ZPL produces 1 label(s)"
       }
      }
     },
     "413": {
      "description": "Plain-text error starting with `ERROR: `.",
      "content": {
       "text/plain": {
        "schema": {
         "type": "string"
        },
        "example": "ERROR: Label index 3 is out of range; the ZPL produces 1 label(s)"
       }
      }
     },
     "429": {
      "description": "Plain-text error starting with `ERROR: `.",
      "content": {
       "text/plain": {
        "schema": {
         "type": "string"
        },
        "example": "ERROR: Label index 3 is out of range; the ZPL produces 1 label(s)"
       }
      },
      "headers": {
       "Retry-After": {
        "description": "Seconds to wait.",
        "schema": {
         "type": "integer"
        }
       }
      }
     },
     "503": {
      "description": "Plain-text error starting with `ERROR: `.",
      "content": {
       "text/plain": {
        "schema": {
         "type": "string"
        },
        "example": "ERROR: Label index 3 is out of range; the ZPL produces 1 label(s)"
       }
      }
     }
    }
   }
  }
 }
}