ChartQuery

Label Parse

POST
/v1/label/parse

Parse printer commands into structured elements. POST source and language (tsc, zpl, epl, …).

Credit cost: 1 credit per call

Query Parameters

fields?string

Comma-separated list of response fields to return, with dot notation for nested fields (e.g. name,location.city).

is_async?boolean

Run the request as a background job: the API answers 202 with a job_id to poll on GET /v1/jobs/{id}.

Defaultfalse
soft_fail?boolean

Return HTTP 200 even when the request fails; the error is in the error field of the body.

Defaultfalse

Request Body

application/json
  1. body
source*string

Raw printer commands to parse. Also send language.

language*string

Language of the source commands. Example: tsc or zpl.

Default"tsc"
Value in"tsc""zpl""epl""cpcl""dpl""sbpl""ipl"

Response Body

Successful response

application/json
  1. response
dpi?integer
commands?array<>
elements?array<>
warnings?array<unknown>
widthDots?integer
heightDots?integer
Example Request
curl -X POST 'https://api.chartquery.com/v1/label/parse' \  -H 'Content-Type: application/json' \  -d '{  "source": "string",  "language": "tsc"}'
Example Response
{  "dpi": 203,  "commands": [    {      "cmd": "SIZE",      "unit": "mm",      "widthMM": 40,      "heightMM": 30    },    {      "cmd": "CLS"    },    {      "x": 10,      "y": 10,      "cmd": "TEXT",      "font": "2",      "xMul": 1,      "yMul": 1,      "content": "Hello",      "rotation": 0    },    {      "cmd": "PRINT",      "sets": 1    }  ],  "elements": [    {      "x": 10,      "y": 10,      "font": "2",      "size": 1,      "type": "text",      "content": "Hello",      "rotation": 0    }  ],  "warnings": [],  "widthDots": 320,  "heightDots": 240}