# General Barcode Generation API Documentation


# General Barcode Generation API

> **Category**: QR Code & Barcode  
> **Endpoint**: POST [https://api.gugudata.io/v1/barcode?appkey={{appkey}}](https://api.gugudata.io/v1/barcode?appkey={{appkey}})  
> **Description**: A general barcode generation API

## Overview

The **General Barcode Generation API** from [GuGuData](https://gugudata.io/) enables you to **create barcodes** from a wide array of **40 supported barcode types**. With **customizable width and height**, you can generate images tailored to your specific needs—be it for inventory, retail, library systems, or any application requiring standard barcode formats. The API also provides a **CDN link** to the generated barcode, ensuring seamless distribution and quick retrieval.

**Key highlights**:
- **Support for 40 barcode types** – From UPC and EAN to CODE128, ITF14, CODE39, and more.  
- **Customizable dimensions** – Set specific width and height in pixels.  
- **CDN-based hosting** – Easily reference or display the barcode image using a provided URL.  
- **HTTPS compliance** – Fully compatible with Apple ATS requirements.  

## Demo URL

[https://api.gugudata.io/v1/barcode/demo](https://api.gugudata.io/v1/barcode/demo)

## Request Parameters

Send a **POST** request to the endpoint, passing the following parameters (JSON or form-data body):

| **Parameter** | **Type**  | **Required** | **Default Value** | **Description**                                                                                                                                         |
|:------------:|:---------:|:------------:|:-----------------:|:--------------------------------------------------------------------------------------------------------------------------------------------------------|
| `type`       | `string`  | Yes          | `YOUR_VALUE`      | The barcode format. Options include `UPCA`, `EAN13`, `CODE128`, etc. (see the full list in the remark).                                                 |
| `content`    | `string`  | Yes          | `YOUR_VALUE`      | The data to encode in the barcode. Must comply with length restrictions of the chosen format.                                                           |
| `width`      | `int`     | Yes          | `YOUR_VALUE`      | The barcode's width in pixels (e.g., `300`).                                                                                                            |
| `height`     | `int`     | Yes          | `YOUR_VALUE`      | The barcode's height in pixels (e.g., `100`).                                                                                                           |

**Example**:  
POST [https://api.gugudata.io/v1/barcode?appkey=YOUR_APPKEY](https://api.gugudata.io/v1/barcode?appkey=YOUR_APPKEY)

Request Body (JSON): { "type": "EAN13", "content": "1234567890123", "width": 300, "height": 100 }


## Response Parameters

On success, the API returns a JSON object with status details and a CDN link to the generated barcode image. Key fields include:

| **Parameter**                    | **Type**  | **Required** | **Description**                                                  |
|:--------------------------------:|:--------: |:------------:|:-----------------------------------------------------------------|
| `DataStatus.StatusCode`         | `int`     | Yes          | HTTP status code (e.g., `200`).                                  |
| `DataStatus.StatusDescription`   | `string`  | Yes          | A brief description of the request status.                       |
| `DataStatus.ResponseDateTime`    | `string`  | Yes          | Timestamp when the response was generated.                       |
| `DataStatus.DataTotalCount`      | `int`     | Yes          | Total data count, typically `1` for a single barcode response.   |
| `Data.Content`                   | `string`  | Yes          | `BarcodeType:content` reflecting your request.                   |
| `Data.Url`                       | `string`  | Yes          | A CDN link for retrieving or displaying the generated barcode.   |

## Error Codes

Here are some common error codes and their meaning:

| **Error Code** | **Error Content**         | **Notes**                                                                        |
|:-------------:|:-------------------------:|:---------------------------------------------------------------------------------|
| `100`         | Normal return            | The request succeeded and a barcode was generated.                               |
| `101`         | Parameter error          | Missing or invalid parameters (e.g., `content` or `type`).                      |
| `102`         | Request rate limited     | Over 100 requests per second.                                                   |
| `103`         | Account in arrears       | Payment or subscription issue; account not in good standing.                    |
| `104`         | APPKEY error             | Verify your APPKEY from the developer center.                                   |
| `110`         | API response error       | A server-side problem occurred; try again or contact support.                   |

## Features

1. **Supports 40 types of barcodes** – Create everything from UPC/EAN to CODE39, CODE128, and more.  
2. **Customizable sizes** – Adjust width and height to fit your UI, printing, or scanning needs.  
3. **Direct CDN link** – Quickly embed or reference the generated barcode in your apps and documents.  
4. **HTTPS (TLS 1.0–1.3)** – Secure data exchange, meeting Apple ATS standards.  
5. **Nationwide CDN** – Fast and consistent performance for barcode retrieval.  
6. **Load-balanced environment** – Ensures minimal latency and high availability.

## Additional Notes for Developers

- **Barcode type specifics**: Some formats require numeric content only; others, like CODE128, can handle alphanumeric.  
- **Dimension choices**: Consider the scanning distance and resolution of the device reading the barcode.  
- **Content validation**: Always ensure your `content` adheres to the chosen barcode's length/format rules.

## Getting Started

1. **Register at [GuGuData.io](https://gugudata.io/)** – Acquire your `appkey`.  
2. **Construct a POST request** – Include `type`, `content`, `width`, and `height` in the body.  
3. **Review the response** – Extract `Data.Url` to access or display the generated barcode.  
4. **Integrate** – Incorporate barcodes into your POS systems, warehouse apps, or e-commerce platforms.

## About GuGuData

[**GuGuData**](https://gugudata.io/) specializes in **data-centric APIs**, offering services like [QR Code Generation](https://gugudata.io/) and [SSL Certificate Parsing](https://gugudata.io/). Our solutions underscore **scalability**, **ease of use**, and **speed**—helping developers bring advanced functionalities to market faster.

**Key Highlights**:  
- **Nine years in business** – Reliable solutions trusted by global clients.  
- **4.2k+ APIs** – A rapidly expanding portfolio catering to diverse data needs.  
- **95% happy customers** – Backed by strong performance and excellent support.

Harness the **General Barcode Generation API** to **enhance** your product labeling, inventory management, or retail operations. Visit our [official site](https://gugudata.io/) for more data-driven services from GuGuData.
