{
  "openapi": "3.0.3",
  "info": {
    "title": "Barcode Generator API",
    "version": "1.0.0",
    "description": "Generate EAN-13, UPC-A, Code 128, QR Code, Data Matrix and 50+ other barcode formats as PNG or SVG images. Powered by bwip-js — no external service calls. GET endpoint returns the image directly (binary), POST endpoint supports extended options (scale, height), and batch endpoint returns up to 20 barcodes as base64 in a single request.\n",
    "contact": {
      "name": "Barcode Generator API Support",
      "email": "api@hiroapp.cc"
    }
  },
  "servers": [
    {
      "url": "https://api.sprytools.com/v1/barcode",
      "description": "Production (SpryTools API Gateway)"
    }
  ],
  "tags": [
    {
      "name": "Generate",
      "description": "Generate barcode images"
    },
    {
      "name": "Info",
      "description": "List supported barcode types"
    }
  ],
  "security": [
    {
      "ApiKeyHeader": []
    },
    {
      "RapidApiProxy": []
    }
  ],
  "paths": {
    "/api/v1/types": {
      "get": {
        "operationId": "listBarcodeTypes",
        "summary": "List supported barcode types",
        "description": "Returns all barcode format identifiers with labels and descriptions.",
        "tags": [
          "Info"
        ],
        "responses": {
          "200": {
            "description": "Supported barcode types",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TypesResult"
                },
                "example": {
                  "count": 5,
                  "types": [
                    {
                      "id": "EAN13",
                      "label": "EAN-13",
                      "description": "Standard European Article Number"
                    },
                    {
                      "id": "UPCA",
                      "label": "UPC-A",
                      "description": "Universal Product Code"
                    },
                    {
                      "id": "CODE128",
                      "label": "Code 128",
                      "description": "High-density alphanumeric barcode"
                    },
                    {
                      "id": "QRCODE",
                      "label": "QR Code",
                      "description": "2D matrix barcode"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/barcode": {
      "get": {
        "operationId": "generateBarcodeGet",
        "summary": "Generate a barcode image (GET)",
        "description": "Returns the barcode image directly as binary PNG or SVG. Ideal for use in `<img src=\"...\">` tags.\n",
        "tags": [
          "Generate"
        ],
        "parameters": [
          {
            "name": "data",
            "in": "query",
            "required": true,
            "description": "Data to encode",
            "schema": {
              "type": "string"
            },
            "example": "012345678905"
          },
          {
            "name": "type",
            "in": "query",
            "required": true,
            "description": "Barcode type identifier (e.g. EAN13, CODE128, QRCODE)",
            "schema": {
              "type": "string"
            },
            "example": "EAN13"
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "description": "Output format",
            "schema": {
              "type": "string",
              "enum": [
                "png",
                "svg"
              ],
              "default": "png"
            }
          },
          {
            "name": "scale",
            "in": "query",
            "required": false,
            "description": "Scale factor (1–5)",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 5
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Barcode image (binary)",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/svg+xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "operationId": "generateBarcodePost",
        "summary": "Generate a barcode image (POST, extended options)",
        "description": "Same as GET but accepts a JSON body with additional options like scale and height.",
        "tags": [
          "Generate"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BarcodeRequest"
              },
              "example": {
                "data": "012345678905",
                "type": "EAN13",
                "format": "png",
                "scale": 3,
                "height": 50
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Barcode image (binary)",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/svg+xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/api/v1/barcode/batch": {
      "post": {
        "operationId": "generateBarcodeBatch",
        "summary": "Generate multiple barcodes in batch",
        "description": "Generate up to 20 barcodes in a single request. Results are returned as base64-encoded image data. Each item includes the original input, success/failure flag, and the image.\n",
        "tags": [
          "Generate"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "items"
                ],
                "properties": {
                  "items": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 20,
                    "items": {
                      "$ref": "#/components/schemas/BarcodeRequest"
                    }
                  }
                }
              },
              "example": {
                "items": [
                  {
                    "data": "012345678905",
                    "type": "EAN13",
                    "format": "png"
                  },
                  {
                    "data": "Hello World",
                    "type": "CODE128",
                    "format": "svg"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Batch barcode results",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BatchBarcodeResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      },
      "RapidApiProxy": {
        "type": "apiKey",
        "in": "header",
        "name": "x-rapidapi-proxy-secret"
      }
    },
    "schemas": {
      "BarcodeTypeInfo": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "description": {
            "type": "string"
          }
        }
      },
      "TypesResult": {
        "type": "object",
        "properties": {
          "count": {
            "type": "integer"
          },
          "types": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BarcodeTypeInfo"
            }
          }
        }
      },
      "BarcodeRequest": {
        "type": "object",
        "required": [
          "data",
          "type"
        ],
        "properties": {
          "data": {
            "type": "string",
            "description": "Data to encode"
          },
          "type": {
            "type": "string",
            "description": "Barcode type identifier"
          },
          "format": {
            "type": "string",
            "enum": [
              "png",
              "svg"
            ],
            "default": "png"
          },
          "scale": {
            "type": "integer",
            "description": "Scale factor (1–5)",
            "minimum": 1,
            "maximum": 5
          },
          "height": {
            "type": "integer",
            "description": "Barcode height in pixels",
            "minimum": 10
          }
        }
      },
      "BatchBarcodeResultItem": {
        "type": "object",
        "properties": {
          "input": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "success": {
            "type": "boolean"
          },
          "image": {
            "type": "string",
            "description": "Base64-encoded image data",
            "nullable": true
          },
          "contentType": {
            "type": "string",
            "nullable": true
          },
          "error": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "BatchBarcodeResult": {
        "type": "object",
        "properties": {
          "count": {
            "type": "integer"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BatchBarcodeResultItem"
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          }
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Bad request — missing or invalid parameters",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "'data' query parameter is required"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "API key missing",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "API key required"
            }
          }
        }
      },
      "RateLimited": {
        "description": "Rate limit exceeded (100 requests per minute)",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "Rate limit exceeded"
            }
          }
        }
      },
      "InternalError": {
        "description": "Barcode generation failed",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "Barcode generation failed"
            }
          }
        }
      }
    }
  }
}