Barcode Generation via API

How to generate barcodes using the TTA HTTP API.

Generate Barcodes via API

import axios from "axios";
  import { createFileSync } from "fs";
  
  const options = {
    method: 'GET',
    url: 'https://text-to-anything.p.rapidapi.com/generateBarcode',
    params: {
      content: '0123456789',
      type: 'code128',
      scale: '3',
      height: '10',
      includeText: 'true'
    },
    headers: {
      'x-rapidapi-key': '{Your-RapidAPI-Key}',
    }
  };
  
  const response = await axios.request(options);
  console.log(response.data);
  
  createFileSync('barcode.png', response.data, 'binary');

Inside of the operation you have the following options:

OptionTypeDescription
contentstring The content of the barcode.
typestring The type of barcode. Can be "code128", "ean13", "ean8", "upca", ect.
scalenumber The scale of the barcode. The default is "3".
heightnumber The height of the barcode. The default is "10".
includeTextboolean Should the barcode include the text? The default is "false".

Output

The endpoint will return the generated file as result.