{
 "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- Without a key: 3 requests per second and 3 labels per UTC day, per IP address. With a free key from the dashboard: 20 labels per UTC day.\n- Labels, not requests, count against the allowance (per UTC day on Free, per UTC calendar month on paid plans): every label rendered, `^PQ` copies and PDF pages included. A 10-label PDF is 1 request and 10 labels.\n- Watermark: without a key, labels carry \"openzpl.com \u00b7 preview\" across the label (`X-OpenZPL-Watermark: preview`). With a Free key they carry a small \"openzpl.com \u00b7 free plan\" badge in the corner (`X-OpenZPL-Watermark: free-plan`). Paid keys render without either.\n- Every request: up to 50 labels, a 1 MB body, 15 inches per side, and 10 seconds of render time.\n- Paid plans (Pro $29/month: 10 requests/s and 100,000 labels/month, Business $99/month: 20 requests/s and 1,000,000 labels/month): subscriptions, monthly or yearly, from the dashboard's Billing page (card, through Stripe), and you can cancel at any time. The workspace's API keys move to the plan's limits as soon as the payment is approved.\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: 20 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
      }
     },
     {
      "name": "X-Language",
      "in": "header",
      "schema": {
       "type": "string",
       "enum": [
        "zpl",
        "epl",
        "tspl",
        "auto"
       ],
       "default": "zpl"
      }
     }
    ],
    "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"
        }
       },
       "X-OpenZPL-Watermark": {
        "description": "free-plan when the label carries the free plan's openzpl.com mark (no key or a Free key).",
        "schema": {
         "type": "string"
        }
       }
      },
      "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
      }
     },
     {
      "name": "X-Language",
      "in": "header",
      "schema": {
       "type": "string",
       "enum": [
        "zpl",
        "epl",
        "tspl",
        "auto"
       ],
       "default": "zpl"
      }
     }
    ],
    "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"
        }
       },
       "X-OpenZPL-Watermark": {
        "description": "free-plan when the label carries the free plan's openzpl.com mark (no key or a Free key).",
        "schema": {
         "type": "string"
        }
       }
      },
      "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
      }
     },
     {
      "name": "X-Language",
      "in": "header",
      "schema": {
       "type": "string",
       "enum": [
        "zpl",
        "epl",
        "tspl",
        "auto"
       ],
       "default": "zpl"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "The rendered label(s).",
      "headers": {
       "X-Total-Count": {
        "description": "Labels the ZPL produces, ^PQ copies included.",
        "schema": {
         "type": "integer"
        }
       },
       "X-OpenZPL-Watermark": {
        "description": "free-plan when the label carries the free plan's openzpl.com mark (no key or a Free key).",
        "schema": {
         "type": "string"
        }
       }
      },
      "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)"
       }
      }
     }
    }
   }
  }
 }
}