API Documentation

YOUR_API_KEY — this text should be replaced with your API key

Example 1. Getting a list of documents or information about a document:


// ************ Python code Example:

import requests
import json

# Prepare data
data = {
    "action": "get",
    "ids": "",     # Document IDs separated by commas (if empty — all documents)
    "status": "",  # Filter by document statuses (possible values — new, sent, revoked, completed)
    "object": "invoice"
}

# Prepare request
url = 'https://demo.sorbi.ai/userapi/ps/YOUR_API_KEY/'
headers = {'Content-Type': 'application/json'}
post_data = {'data': json.dumps(data)}

# Send POST request
response = requests.post(url, headers=headers, data=post_data)

# Handle response
if response.status_code == 200:
    try:
        result = response.json()
        print(json.dumps(result, indent=4, ensure_ascii=False))
    except json.JSONDecodeError:
        print("Error parsing JSON response:")
        print(response.text)
else:
    print(f"Error: {response.status_code}")
    print(response.text)

// ************ PHP code Example:

$data = <<<JSON
{
  "action": "get",
  "ids": "",
  "status": "",
  "object": "invoice"
}
JSON;

// ids — document id separated by commas (if the parameter is omitted, then all documents)
// status — filter by document statuses (possible values ​​- new, sent, revoked, completed)

$post = array(
'data' => $data,
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://demo.sorbi.ai/userapi/ps/YOUR_API_KEY/');
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response,true);
print_r($result);

// Example of returned data:

{
  "status": "OK",
  "documents": [
    {
      "id": "101324",
      "savetime": "1745532856",
      "transfer_type": "swift",
      "payagent": "1",
      "amount": "19200.00",
      "currency": "EUR",
      "description": "Payment for container delivery services",
      "status": "revoked",
      "from": {
        "accounttype": "Legal entity",
        "name": "QWERTY NETWORKS D.O.O.",
        "tax_id": "PIB 03173232",
        "country_code": "ME",
        "bank": {
          "name": "CRNOGORSKA KOMERCIJALNA BANKA AD PODGORICA",
          "bicswift": "CKBCMEPGXXX",
          "account": "ME25510000000012106125"
        }
      },
      "to": {
        "accounttype": "Legal entity",
        "name": "Test Company",
        "tax_id": "12345678",
        "country_code": "CZ",
        "bank": {
          "name": "Test Bank",
          "bicswift": "3746283674782",
          "account": "21847623846723846237"
        }
      }
    },
    {
      "id": "101325",
      "savetime": "1745532878",
      "transfer_type": "swift",
      "payagent": "1",
      "amount": "25000.00",
      "currency": "EUR",
      "description": "Payment for container delivery services",
      "status": "new",
      "from": {
        "accounttype": "Legal entity",
        "name": "QWERTY NETWORKS D.O.O.",
        "tax_id": "PIB 03173232",
        "country_code": "ME",
        "bank": {
          "name": "CRNOGORSKA KOMERCIJALNA BANKA AD PODGORICA",
          "bicswift": "CKBCMEPGXXX",
          "account": "ME25510000000012106125"
        }
      },
      "to": {
        "accounttype": "Legal entity",
        "name": "Test Company",
        "tax_id": "12345678",
        "country_code": "CZ",
        "bank": {
          "name": "Test Bank",
          "bicswift": "3746283674782",
          "account": "21847623846723846237"
        }
      }
    },
    {
      "id": "101326",
      "savetime": "1746720335",
      "transfer_type": "internal",
      "payagent": "1",
      "amount": "34.00",
      "currency": "EUR",
      "description": "Nice green grass",
      "status": "new",
      "from": {
        "accounttype": "Physical person",
        "name": "John Week",
        "tax_id": "",
        "country_code": "TR",
        "bank": {
          "name": "Aktif Yatırım Bankası A.Ş.",
          "bicswift": "CAYTTRIS",
          "account": "TR 4700 0100 9010 0574 2710 4505 "
        }
      },
      "to": {
        "accounttype": "Physical person",
        "name": "Peter Pen",
        "tax_id": "",
        "country_code": "NL",
        "bank": {
          "name": "ING Bank N.V.",
          "bicswift": "INGBNL2A",
          "account": "NL 1234 5457 4455 1874 1210 3245 "
        }
      }
    },
    {
      "id": "101327",
      "savetime": "1746720421",
      "transfer_type": "swift",
      "payagent": "1",
      "amount": "256.65",
      "currency": "TRY",
      "description": "Cep telefonu rebate",
      "status": "completed",
      "from": {
        "accounttype": "Physical person",
        "name": "John Week",
        "tax_id": "",
        "country_code": "TR",
        "bank": {
          "name": "Ziraat Bankası A.Ş.",
          "bicswift": "TCZBTR2A",
          "account": "TR 5800 0100 9010 1874 1210 7001 "
        }
      },
      "to": {
        "accounttype": "Legal entity",
        "name": "TURKCELL",
        "tax_id": "1234567890",
        "country_code": "TR",
        "bank": {
          "name": "Türkiye İş Bankası A.Ş.",
          "bicswift": " ISBKTRIS",
          "account": "TR 5800 0100 9010 1334 1360 5001 "
        }
      }
    }
  ]
}

Example 2. Creating a new document.


// IMPORTANT! Before using the API, the client must create 
// a directory of their own bank details, as well as 
// a directory of counterparties’ details, in the 
// “Settings” section at the following address: 
// https://ps.anahatholding.com/u_settings

// ************ Python code Example:

import requests
import json

# Prepare data
data = {
    "action": "new",              # Action type: "new" — creating a new document
    "object": "invoice",          # Document type: "invoice" or "payorder"
    "from": 1742,                 # ID of your own bank details (from settings)
    "to": 9677,                   # ID of beneficiary's bank details (from settings)
    "payagent": 1,                # Payment agent ID
    "amount": 100000,             # Document amount
    "currency": "USD",            # Document currency
    "description": "Payment by invoice for IT services"  # Payment description
}

# Prepare request
url = 'https://demo.sorbi.ai/userapi/ps/YOUR_API_KEY/'
headers = {'Content-Type': 'application/json'}
post_data = {'data': json.dumps(data)}

# Send POST request
response = requests.post(url, headers=headers, data=post_data)

# Handle response
if response.status_code == 200:
    try:
        result = response.json()
        print(json.dumps(result, indent=4, ensure_ascii=False))
    except json.JSONDecodeError:
        print("Error parsing JSON response:")
        print(response.text)
else:
    print(f"Error: {response.status_code}")
    print(response.text)

// ************ PHP code Example:

$data = <<<JSON
{
  "action": "new",
  "object": "invoice",
  "from": 1742,
  "to": 9677,
  "payagent": 1,
  "amount": 100000,
  "currency": "USD",
  "description": "Payment by invoice for IT services"
}
JSON;

// object — The type of document being created. Possible values ​​are "invoice", "payorder".
// from — ID of your own bank details (from settings)
// to — ID of beneficiary's bank details (from settings)
// payagent — Payment agent ID
// amount — document amount
// currency — document currency
// description — payment description

$post = array(
'data' => $data,
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://demo.sorbi.ai/userapi/ps/YOUR_API_KEY/');
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response,true);
print_r($result);

// Example of returned data:
//
// ["status": "OK", "id": 926632 ]
//
// If the save is successful, the system will return the ID of the new document.

Example 3. Document revocation:


// ************ Python code Example:

import requests
import json

# Prepare data
data = {
    "action": "revoke",    # Action type: "revoke" — revoking a document
    "object": "invoice",   # Document type: "invoice" or "payorder"
    "id": 711              # Document ID to be revoked
}

# Prepare request
url = 'https://demo.sorbi.ai/userapi/ps/YOUR_API_KEY/'
headers = {'Content-Type': 'application/json'}
post_data = {'data': json.dumps(data)}

# Send POST request
response = requests.post(url, headers=headers, data=post_data)

# Handle response
if response.status_code == 200:
    try:
        result = response.json()
        print(json.dumps(result, indent=4, ensure_ascii=False))
    except json.JSONDecodeError:
        print("Error parsing JSON response:")
        print(response.text)
else:
    print(f"Error: {response.status_code}")
    print(response.text)

// ************ PHP code Example:

$data = <<<JSON
{
  "action": "revoke",
  "object": "invoice",
  "id": 711
}
JSON;

// object — The type of document being created. Possible values ​​are "invoice", "payorder".
// id — Document ID

$post = array(
'data' => $data,
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://demo.sorbi.ai/userapi/ps/YOUR_API_KEY/');
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response,true);
print_r($result);

// Example of returned data:
//
// If successful: ["status": "OK" ]
//
// In case of error: ["status": "ERROR", "type": "invoice", "descr": "Error description" ]

Example 4. Submitting a document for processing:


// ************ Python code Example:

import requests
import json

# Prepare data
data = {
    "action": "sent",      # Action type: "sent" — mark document as sent
    "object": "invoice",   # Document type: "invoice" or "payorder"
    "id": 711              # Document ID to be marked as sent
}

# Prepare request
url = 'https://demo.sorbi.ai/userapi/ps/YOUR_API_KEY/'
headers = {'Content-Type': 'application/json'}
post_data = {'data': json.dumps(data)}

# Send POST request
response = requests.post(url, headers=headers, data=post_data)

# Handle response
if response.status_code == 200:
    try:
        result = response.json()
        print(json.dumps(result, indent=4, ensure_ascii=False))
    except json.JSONDecodeError:
        print("Error parsing JSON response:")
        print(response.text)
else:
    print(f"Error: {response.status_code}")
    print(response.text)

// ************ PHP code Example:

$data = <<<JSON
{
  "action": "sent",
  "object": "invoice",
  "id": 711
}
JSON;

// object — The type of document being created. Possible values ​​are "invoice", "payorder".
// id — Document ID

$post = array(
'data' => $data,
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://demo.sorbi.ai/userapi/ps/YOUR_API_KEY/');
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response,true);
print_r($result);

// Example of returned data:
//
// If successful: ["status": "OK" ]
//
// In case of error: ["status": "ERROR", "type": "invoice", "descr": "Error description" ]

Example 5. Confirmation of execution of the document:


// ************ Python code Example:

import requests
import json

# Prepare data
data = {
    "action": "done",      # Action type: "done" — mark document as completed
    "object": "invoice",   # Document type: "invoice" or "payorder"
    "id": 711              # Document ID to be marked as completed
}

# Prepare request
url = 'https://demo.sorbi.ai/userapi/ps/YOUR_API_KEY/'
headers = {'Content-Type': 'application/json'}
post_data = {'data': json.dumps(data)}

# Send POST request
response = requests.post(url, headers=headers, data=post_data)

# Handle response
if response.status_code == 200:
    try:
        result = response.json()
        print(json.dumps(result, indent=4, ensure_ascii=False))
    except json.JSONDecodeError:
        print("Error parsing JSON response:")
        print(response.text)
else:
    print(f"Error: {response.status_code}")
    print(response.text)

// ************ PHP code Example:

$data = <<<JSON
{
  "action": "done",
  "object": "invoice",
  "id": 711
}
JSON;

// object — The type of document being created. Possible values ​​are "invoice", "payorder".
// id — Document ID

$post = array(
'data' => $data,
);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://demo.sorbi.ai/userapi/ps/YOUR_API_KEY/');
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response,true);
print_r($result);

// Example of returned data:
//
// If successful: ["status": "OK" ]
//
// In case of error: ["status": "ERROR", "type": "invoice", "descr": "Error description" ]