Background supergraphic

Faktur Pajak (Tax Invoice)

Faktur Pajak (Tax Invoice).

Tax Invoice Object

  • Name
    status
    Type
    string
    Description

    Enum code indicating the status of the reading result.

    1. SUCCESS
    2. NO_FILE
    3. FILE_INVALID_FORMAT
    4. FAILED
  • Name
    reason
    Type
    string
    Description

    A human-readable message providing more details about the reading result.

  • Name
    read
    Type
    object
    Description

    Contains the reading for each Tax Invoice fields.

    • Name
      nomor_faktur
      Type
      string
      Description

      Tax invoice number

    • Name
      nama_pengusaha
      Type
      string
      Description

      Name of the seller

    • Name
      alamat_pengusaha
      Type
      string
      Description

      Address of the seller

    • Name
      npwp_pengusaha
      Type
      string
      Description

      Tax identification number of the seller

    • Name
      nama_pembeli
      Type
      string
      Description

      Name of the buyer

    • Name
      alamat_pembeli
      Type
      string
      Description

      Address of the buyer

    • Name
      npwp_pembeli
      Type
      string
      Description

      Tax identification number of the buyer

    • Name
      nama_barang_jasa_1
      Type
      string
      Description

      Name of the product or service

    • Name
      harga_jual_1
      Type
      string
      Description

      Price of the product or service

    • Name
      harga_jual_penggantian
      Type
      string
      Description

      Sum of price of all products or services

    • Name
      potongan_harga
      Type
      string
      Description

      Discount

    • Name
      uang_muka
      Type
      string
      Description

      Down payment for the products or services

    • Name
      dasar_pengenaan_pajak
      Type
      string
      Description

      Base value to be taxed

    • Name
      total_ppn
      Type
      string
      Description

      Total of value added tax

    • Name
      total_ppnbm
      Type
      string
      Description

      Total of value added tax for luxurious products

    • Name
      tanggal_faktur
      Type
      string
      Description

      Date of the invoice

    • Name
      nomor_invoice
      Type
      string
      Description

      Invoice number


POST/ocr/v1/tax-invoice

Read Tax Invoice

Detects a valid tax invoice image and returns the information as text.

Required parameter

  • Name
    image
    Type
    file (.png, .jpg, .jpeg, .tiff, .pdf)
    Description

    The image file for the tax invoice.

Sample Request

POST
/ocr/v1/tax-invoice
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Minimum Node 18. Save the code as 'index.mjs' and run it by executing 'node index.mjs' import { readFileSync } from "fs"; const url = 'https://api.vision.glair.ai/ocr/v1/tax-invoice'; const basicAuth = 'Basic ' + Buffer.from('USERNAME' + ':' + 'PASSWORD').toString('base64'); const apiKey = 'API_KEY'; const formData = new FormData(); formData.append('image', new Blob([readFileSync('/path/to/image/tax-invoice.jpeg')])); const config = { method: 'POST', headers: { Authorization: basicAuth, 'x-api-key': apiKey, }, body: formData, }; const response = await fetch(url, config); console.log(await response.json());

Sample Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{ "status": "SUCCESS", "reason": "File Successfully Read", "read": { "nomor_faktur": "070.000-22.12345678", "nama_pengusaha": "PT ABC", "alamat_pengusaha": "Jalan Gatot Subroto No. 40A, Senayan, Kebayoran Baru, Jakarta Selatan 12910", "npwp_pengusaha": "01.234.567.8-012.000", "nama_pembeli": "PT XYZ", "alamat_pembeli": "Jalan Kuda Laut No. 1. Sungai Jodoh, Batu Ampar, Batam 29444", "npwp_pembeli": "02.345.678.9-217.000", "nama_barang_jasa_1": "KOMPUTER MERK ABC, HS Code 84714110", "harga_jual_1": "15.000.000,00", "harga_jual_penggantian": "15.000.000,00", "potongan_harga": "0,00", "uang_muka": "0,00", "dasar_pengenaan_pajak": "15.000.000,00", "total_ppn": "1.650.000,00", "total_ppnbm": "0,00", "tanggal_faktur": "1 APRIL 2022", "nomor_invoice": "123/ABC/IV/2022" } }

Request ID

An associated request identifier is generated for every request made to this endpoint. This value can be found in the response headers under Request-Id


Responses

Various responses for this endpoint, in addition to general responses specified in Errors.

200 - OK

Request with readable tax invoice image

Response

1
2
3
4
5
{ "status": "SUCCESS", "reason": "File Successfully Read", //..., }

400 - Bad Request

Request without form-data image

Response

1
2
3
4
5
{ "status": "NO_FILE", "reason": "No file in request body", //..., }

415 - Unsupported Media Type

Request with non-image file format

Response

1
2
3
4
5
{ "status": "FILE_INVALID_FORMAT", "reason": "Failed to process invalid file format. Please upload the correct file format", //..., }