Aspose.BarCode.Cloud v4 API explorer

Welcome to the Aspose.BarCode.Cloud API Explorer Page! This API allows you to high-quality generate and recognize barcodes. Below, you’ll find the available endpoints along with their descriptions, parameters, and example requests.All examples are given for curl and can be executed in bash, sh, cmd, powershell and many other command line interpreters on various operating systems. You also can see API references here and full swagger specification here.

Authentication

The first thing you need to do to get started with Aspose for Cloud is sign up for a free account. Next create a Storage for your Application. Go to the Storages page. Click the “Create New Storage” button and follow the required steps. Before you can make any requests to Aspose for Cloud API you need to create an API client app. This will give you client_id and client_secret which you can use to get JWT Bearer token.

All requests must include a JWT authentication token in the Authorization header, formatted as follows:

Authorization: Bearer ACCESS_TOKEN_VALUE

To obtain an access token, send a request to the authentication endpoint. Replace XXXXX with your actual client_id and client_secret values:

curl "https://id.aspose.cloud/connect/token" -X POST \
        -d "grant_type=client_credentials&client_id=XXXXX&client_secret=XXXXX" \
        -H "Content-Type: application/x-www-form-urlencoded" \
        -H "Accept: application/json"

This request will return a JSON response containing the access token like following. Use this token in the Authorization header for your API requests.

{ "access_token": "eyJhbGciOi......", "expires_in": 28800, "token_type": "Bearer" }

API Overview

API Version: v4.0
Base URL: https://api.aspose.cloud/v4.0/barcode

Endpoints

1. Generate Barcode

Generate Barcode using GET Request

  • Endpoint: /generate/{barcodeType}
  • Method: GET
  • Summary: Generate a barcode using parameters in the route and query string.

Parameters:

  • barcodeType (path, required): Type of barcode to generate.
  • DataType (query, optional): Type of data to encode. Default: StringData.
  • Data (query, required): String representing data to encode.
  • ImageFormat (query, optional): Output image format. Default: png.
  • Additional parameters related to display text, colors, dimensions, and resolution.

Responses:

  • 200 OK: Returns the generated barcode image in various formats (PNG, BMP, GIF, JPEG, SVG, TIFF).
  • 400 Bad Request: Invalid request parameters.
  • 401 Unauthorized: Authentication failed.
  • 403 Forbidden: Reach free request limit.
  • 500 Internal Server Error: Server error.

Request Example:

curl -X GET "https://api.aspose.cloud/v4.0/barcode/generate/QR?data=Aspose.BarCode" \
     -H  "Authorization: Bearer ACCESS_TOKEN_VALUE" \
     --output QR.png

Generate Barcode using POST Request (Form Encoded)

  • Endpoint: /generate-multipart
  • Method: POST
  • Summary: Generate a barcode using POST request with parameters in a URL-encoded form.

Request Body:

  • Required fields: barcodeType, Data.
  • Optional fields include DataType, ImageFormat, and others related to display settings.

Responses: Same as the GET request.

Request Example:

curl -X POST "https://api.aspose.cloud/v4.0/barcode/generate-multipart" \
     -H  "Authorization: Bearer ACCESS_TOKEN_VALUE"  \
     -H  "Content-Type: multipart/form-data" \
     --form 'Data="Aspsose.BarCode.Cloud"' --form BarcodeType=QR  --output QR.png

Generate Barcode using POST Request (Body in JSON/XML Format)

  • Endpoint: /generate-body
  • Method: POST
  • Summary: Generate a barcode using parameters in the body in JSON or XML format.

Request Body:

{
  "barcodeType": "EncodeBarcodeType",
  "encodeData": {
    "dataType": "EncodeDataType",
    "data": "String representing data to encode"
  },
  "barcodeImageParams": {
    "imageFormat": "BarcodeImageFormat",
    "textLocation": "CodeLocation",
    "foregroundColor": "Color name or ARGB value",
    "backgroundColor": "Color name or ARGB value",
    "units": "GraphicsUnit",
    "resolution": 96.0,
    "imageHeight": 100.0,
    "imageWidth": 200.0,
    "rotationAngle": 0
  }
}

Request Body (XML):

<GenerateParams>
  <BarcodeType>EncodeBarcodeType</BarcodeType>
  <EncodeData>
    <DataType>EncodeDataType</DataType>
    <Data>String representing data to encode</Data>
  </EncodeData>
  <BarcodeImageParams>
    <ImageFormat>BarcodeImageFormat</ImageFormat>
    <TextLocation>CodeLocation</TextLocation>
    <ForegroundColor>Color name or ARGB value</ForegroundColor>
    <BackgroundColor>Color name or ARGB value</BackgroundColor>
    <Units>GraphicsUnit</Units>
    <Resolution>96.0</Resolution>
    <ImageHeight>100.0</ImageHeight>
    <ImageWidth>200.0</ImageWidth>
    <RotationAngle>0</RotationAngle>
  </BarcodeImageParams>
</GenerateParams>

Parameters:

  • barcodeType (required): Specifies the type of barcode to generate. It should be one of the values from the EncodeBarcodeType enumeration (e.g., Code128, QR, etc.).

  • encodeData (required): An object containing:

    • dataType: The type of data being encoded. Should be one of the values from EncodeDataType (e.g., StringData, Base64Bytes).
    • data: A string that represents the actual data you want to encode in the barcode. This field is mandatory.
  • barcodeImageParams (optional): An object containing optional parameters for customizing the barcode image:

    • imageFormat: The desired output image format (e.g., PNG, JPEG, etc.), specified in BarcodeImageFormat.
    • textLocation: Specifies where the text is displayed in relation to the barcode (e.g., above, below, or none).
    • foregroundColor: The color of the barcode (can be specified as a color name or an ARGB value).
    • backgroundColor: The background color of the barcode image (can be specified as a color name or an ARGB value).
    • units: The unit of measurement for the barcode dimensions (e.g., pixels, inches).
    • resolution: The resolution of the barcode image in DPI (dots per inch).
    • imageHeight: The height of the barcode image in the specified units.
    • imageWidth: The width of the barcode image in the specified units.
    • rotationAngle: The angle of rotation for the barcode image.

    Responses: Same as the GET request.

Request Example:

curl -X POST "https://api.aspose.cloud/v4.0/barcode/generate-body" \
      -H "Authorization: Bearer ACCESS_TOKEN_VALUE" \
      -H "Content-Type: application/json"  \
      -d "{\"barcodeType\":\"QR\",\"encodeData\":{\"dataType\":\"StringData\",\"data\":\"Aspose.BarCode.Cloud\"},\"barcodeImageParams\":{\"imageFormat\":\"Png\"}}" \
      --output QR.png

Request Example (XML):

curl -X POST "https://api.aspose.cloud/v4.0/barcode/generate-body" \
      -H "Authorization: Bearer ACCESS_TOKEN_VALUE" \
      -H "Content-Type: application/xml" \
      -d "<?xml version=\"1.0\" encoding=\"UTF-8\"?><GenerateParams><BarcodeType>QR</BarcodeType><EncodeData><DataType>StringData</DataType><Data>Aspose.BarCode.Cloud</Data></EncodeData><BarcodeImageParams><ImageFormat>Png</ImageFormat></BarcodeImageParams></GenerateParams>" \
      --output QR.png

2. Recognize Barcode

Recognize Barcode from File using GET Request

  • Endpoint: /recognize/{barcodeType}
  • Method: GET
  • Summary: Recognize a barcode from a file on the server using parameters in the route and query string.

Parameters:

  • barcodeType (path, required): Type of barcode to recognize.
  • fileUrl (query, required): URL to the barcode image.
  • Optional fields: recognitionMode, recognitionImageKind.

Responses:

  • 200 OK: Returns recognized barcode data.
  • 400 Bad Request
  • 401 Unauthorized
  • 403 Forbidden
  • 500 Internal Server Error: Similar to previous endpoints.

Request Example: Format of returned value depends on accept header value: “accept: application/json” for response in json format, “accept: application/xml” for response in XML format.

curl -X GET "https://api.aspose.cloud/v4.0/barcode/recognize?barcodeType=MostCommonlyUsed&fileUrl=https%3A%2F%2Fproducts.aspose.app%2Fbarcode%2Fscan%2Fimg%2Fhow-to%2Fscan%2Fstep2.png&recognitionMode=Fast" \
    -H "accept: application/json" \
    -H "Authorization: Bearer ACCESS_TOKEN_VALUE" 

Recognize Barcode from File using POST Request (JSON/XML Body)

  • Endpoint: /recognize-body
  • Method: POST
  • Summary: Recognize a barcode from a file in the request body (JSON or XML format).

Request Body:

{
  "barcodeTypes": [
    "DecodeBarcodeType"
  ],
  "fileBase64": "Base64 encoded barcode image bytes",
  "recognitionMode": "RecognitionMode",
  "recognitionImageKind": "RecognitionImageKind"
}

Request Body (XML):

<RecognizeBase64Request>
  <BarcodeTypes>
    <DecodeBarcodeType>TypeOfBarcode1</DecodeBarcodeType>
    <DecodeBarcodeType>TypeOfBarcode2</DecodeBarcodeType>
  </BarcodeTypes>
  <FileBase64>Base64 encoded barcode image bytes</FileBase64>
  <RecognitionMode>RecognitionMode</RecognitionMode>
  <RecognitionImageKind>RecognitionImageKind</RecognitionImageKind>
</RecognizeBase64Request>

Parameters:

  • barcodeTypes (required): An array of strings specifying the types of barcodes to recognize. Each value should be one of the types from the DecodeBarcodeType enumeration (e.g., QR, Code128, etc.).

  • fileBase64 (required): A string containing the barcode image encoded as a Base64 string. This is the actual image data that will be processed for recognition.

  • recognitionMode (optional): Specifies the mode of recognition, which can be one of the values from the RecognitionMode enumeration (e.g., Fast, Normal, Excellent).

  • recognitionImageKind (optional): Specifies the kind of image being recognized, selected from the RecognitionImageKind enumeration (e.g., Photo, ScannedDocument, ClearImage).

Responses: Same as above.

Request Example: Format of returned value depends on accept header value: “accept: application/json” for response in json format, “accept: application/xml” for response in XML format.

curl -X POST "https://api.aspose.cloud/v4.0/barcode/recognize-body" \
    -H "accept: application/json" \
    -H "Authorization: Bearer ACCESS_TOKEN_VALUE" \
    -H "Content-Type: application/json" \
    -d "{\"barcodeTypes\":[\"MostCommonlyUsed\"],\"fileBase64\":\"iVBORw0KGgoAAAANSUhEUgAAAC4AAAAuAQAAAAB/whaaAAAAmElEQVR4nFXQMQrDMAyF4WcrSyGQHqKrwZCOhuaIPZIzFhwSyEVS6CjhDI2iVtuHzG+QqwAgHt/J4IL2UNMxoU6HvFynOEIF9At+9BlMtEl8wJrFmqi11MrnLreZTTT3UV/69LrJ2UShQpRUW04xsTUzs+786GhdF1XHEoJWXBkyzmYD9HdcTKPgqc2ZZ/vPvxsJQZvu72Y7kik76l8G0hIAAAAASUVORK5CYII=\",\"recognitionMode\":\"Fast\"}"

Request Example (XML): Format of returned value depends on accept header value: “accept: application/json” for response in json format, “accept: application/xml” for response in XML format.

curl -X POST "https://api.aspose.cloud/v4.0/barcode/recognize-body" \
      -H "accept: application/xml" \
      -H "Authorization: Bearer ACCESS_TOKEN_VALUE" \
      -H "Content-Type: application/xml" \
      -d "<?xml version=\"1.0\" encoding=\"UTF-8\"?><RecognizeBase64Request>\t<BarcodeTypes>MostCommonlyUsed</BarcodeTypes>\t<FileBase64>iVBORw0KGgoAAAANSUhEUgAAAC4AAAAuAQAAAAB/whaaAAAAmElEQVR4nFXQMQrDMAyF4WcrSyGQHqKrwZCOhuaIPZIzFhwSyEVS6CjhDI2iVtuHzG+QqwAgHt/J4IL2UNMxoU6HvFynOEIF9At+9BlMtEl8wJrFmqi11MrnLreZTTT3UV/69LrJ2UShQpRUW04xsTUzs+786GhdF1XHEoJWXBkyzmYD9HdcTKPgqc2ZZ/vPvxsJQZvu72Y7kik76l8G0hIAAAAASUVORK5CYII=</FileBase64>\t<RecognitionMode>Fast</RecognitionMode>\t<RecognitionImageKind>ClearImage</RecognitionImageKind></RecognizeBase64Request>"

Recognize Barcode from File using POST Request (MultipartForm)

  • Endpoint: /recognize-multipart
  • Method: POST
  • Summary: Recognize a barcode from a file using multipart form.

Request Body:

  • Required fields include barcodeType, file, with optional recognitionMode, recognitionImageKind.

Responses: Same as above.

Request Example: Format of returned value depends on accept header value: “accept: application/json” for response in json format, “accept: application/xml” for response in XML format.

curl -X POST "https://api.aspose.cloud/v4.0/barcode/recognize-multipart" \
      -H "accept: application/json" \
      -H "Authorization: Bearer ACCESS_TOKEN_VALUE" \
      -H "Content-Type: multipart/form-data" \
      --form barcodeType=MostCommonlyUsed --form recognitionMode=Fast --form file=@QR.png

3. Scan Barcode

Scan Barcode from File using GET Request

  • Endpoint: /scan
  • Method: GET
  • Summary: Scan a barcode from a file on the server using a query string parameter.

Parameters:

  • fileUrl (query, required): URL to the barcode image.

Responses: Same as previous endpoints.

Request Example: Format of returned value depends on accept header value: “accept: application/json” for response in json format, “accept: application/xml” for response in XML format.

curl -X GET "https://api.aspose.cloud/v4.0/barcode/scan?fileUrl=https%3A%2F%2Fproducts.aspose.app%2Fbarcode%2Fscan%2Fimg%2Fhow-to%2Fscan%2Fstep2.png" \
     -H "accept: application/json" \
     -H "Authorization: Bearer ACCESS_TOKEN_VALUE" 

Scan Barcode from File using POST Request (JSON/XML Body)

  • Endpoint: /scan-body
  • Method: POST
  • Summary: Scan a barcode from a file in the request body (JSON or XML format).

Request Body:

  • Required: { "fileBase64": "..." }.

Responses: Same as above.

curl -X POST "https://api.aspose.cloud/v4.0/barcode/scan-body" \
      -H "accept: application/json" \
      -H "Authorization: Bearer ACCESS_TOKEN_VALUE" \
      -H "Content-Type: application/json" \
      -d "{\"fileBase64\":\"iVBORw0KGgoAAAANSUhEUgAAAC4AAAAuAQAAAAB/whaaAAAAmElEQVR4nFXQMQrDMAyF4WcrSyGQHqKrwZCOhuaIPZIzFhwSyEVS6CjhDI2iVtuHzG+QqwAgHt/J4IL2UNMxoU6HvFynOEIF9At+9BlMtEl8wJrFmqi11MrnLreZTTT3UV/69LrJ2UShQpRUW04xsTUzs+786GhdF1XHEoJWXBkyzmYD9HdcTKPgqc2ZZ/vPvxsJQZvu72Y7kik76l8G0hIAAAAASUVORK5CYII=\"}"

Request Example (XML): Format of returned value depends on accept header value: “accept: application/json” for response in json format, “accept: application/xml” for response in XML format.

curl -X POST "https://api.aspose.cloud/v4.0/barcode/scan-body" \
      -H "accept: application/xml" \
      -H "Authorization: Bearer ACCESS_TOKEN_VALUE" \
      -H "Content-Type: application/xml" \
      -d "<?xml version=\"1.0\" encoding=\"UTF-8\"?><ScanBase64Request><FileBase64>iVBORw0KGgoAAAANSUhEUgAAAC4AAAAuAQAAAAB/whaaAAAAmElEQVR4nFXQMQrDMAyF4WcrSyGQHqKrwZCOhuaIPZIzFhwSyEVS6CjhDI2iVtuHzG+QqwAgHt/J4IL2UNMxoU6HvFynOEIF9At+9BlMtEl8wJrFmqi11MrnLreZTTT3UV/69LrJ2UShQpRUW04xsTUzs+786GhdF1XHEoJWXBkyzmYD9HdcTKPgqc2ZZ/vPvxsJQZvu72Y7kik76l8G0hIAAAAASUVORK5CYII=</FileBase64></ScanBase64Request>"

Scan Barcode from File using POST Request (Form Encoded)

  • Endpoint: /scan-multipart
  • Method: POST
  • Summary: Scan a barcode from a file using multipart form.

Request Body:

  • Required: file.

Responses: Same as above.

Request Example: Format of returned value depends on accept header value: “accept: application/json” for response in json format, “accept: application/xml” for response in XML format.

curl -X POST "https://api.aspose.cloud/v4.0/barcode/scan-multipart" \
      -H "accept: application/json" \
      -H "Authorization: Bearer ACCESS_TOKEN_VALUE" \
      -H "Content-Type: multipart/form-data" \
      --form file=@QR.png

Feel free to explore the endpoints on API references page and try out the barcode generation and recognition features!