MENU navbar-image

Introduction

This documentation aims to provide all the information you need to work with our API.

Authenticating requests

To authenticate requests, include an Authorization header with the value "Bearer {YOUR_AUTH_TOKEN}".

All authenticated endpoints are marked with a requires authentication badge in the documentation below.

You can retrieve your token by visiting your dashboard and clicking Tokens in API menu.

API V1 - Couriers

Couriers Endpoints

GET Allowed Couriers and SubAccounts

requires authentication

List all allowed couriers and their sub accounts, if exists.

Throttling: Max 60 requests per minute. (60/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/couriers/allowed';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/couriers/allowed"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/couriers/allowed" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/couriers/allowed'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 59
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/couriers/allowed

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

API V1 - Entries

Entries Endpoints

GET All Entries

requires authentication

List all product entries.

Throttling: Max 40 requests per minute. (40/1)

Presents the result with page size and pagination.

Default page size : 200 records per page.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/entries';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'page' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/entries"
);

const params = {
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/entries?page=1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/entries'
params = {
  'page': '1',
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers, params=params)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 40
x-ratelimit-remaining: 39
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/entries

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

Which page to show. Example: 1

GET Filtered Entries

requires authentication

List sumOf product entries that match filters with product information.

Presents the result with page size and simple pagination (without showing the total number of records and last page).

Throttling: Max 20 requests per minute. (20/1) Max 100 requests per hour. (100/60)

Default page size : 250 records per page. (Maximum 1000 records per page)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/entries/filter';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'page' => '1',
        ],
        'json' => [
            'ids' => '47860,47859',
            'productIds' => '184737,184738',
            'type' => 'imports',
            'startDate' => '2025-06-01',
            'endDate' => '2025-07-07',
            'sortDate' => 'DESC',
            'perPage' => 250,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/entries/filter"
);

const params = {
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "ids": "47860,47859",
    "productIds": "184737,184738",
    "type": "imports",
    "startDate": "2025-06-01",
    "endDate": "2025-07-07",
    "sortDate": "DESC",
    "perPage": 250
};

fetch(url, {
    method: "GET",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/entries/filter?page=1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"ids\": \"47860,47859\",
    \"productIds\": \"184737,184738\",
    \"type\": \"imports\",
    \"startDate\": \"2025-06-01\",
    \"endDate\": \"2025-07-07\",
    \"sortDate\": \"DESC\",
    \"perPage\": 250
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/entries/filter'
payload = {
    "ids": "47860,47859",
    "productIds": "184737,184738",
    "type": "imports",
    "startDate": "2025-06-01",
    "endDate": "2025-07-07",
    "sortDate": "DESC",
    "perPage": 250
}
params = {
  'page': '1',
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers, json=payload, params=params)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 20
x-ratelimit-remaining: 19
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/entries/filter

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

Which page to show. Example: 1

Body Parameters

ids   string  optional  

List of comma-separated Entry IDs. Example: 47860,47859

productIds   string  optional  

List of comma-separated Product IDs. Example: 184737,184738

type   enum(returns,imports)  optional  

The type of entry. Must be either returns or imports. Example: imports

startDate   date  optional  

The entry date. Must be a date between past and today. The format must be in: Y-m-d. Example: 2025-06-01

endDate   date  optional  

The entry date. Must be a date between past and today. If there is a startDate, endDate must be later than startDate. The format must be in: Y-m-d. Example: 2025-07-07

sortDate   enum(DESC,ASC)  optional  

Order in which to retrieve results. - Default : ASC. Example: DESC

perPage   integer  optional  

Number of entries per page. The allowed values are between 10 and 1000. If not provided, the default is 250. Example: 250

GET Entries created today

requires authentication

List all entries that were created today

Presents the result with page size and pagination.

Throttling: Max 5 requests per minute. (5/1)

Default page size : 200 records per page.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/entries/createdToday';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'page' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/entries/createdToday"
);

const params = {
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/entries/createdToday?page=1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/entries/createdToday'
params = {
  'page': '1',
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers, params=params)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 5
x-ratelimit-remaining: 4
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/entries/createdToday

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

Which page to show. Example: 1

GET Returned Entries

requires authentication

List sumOf product entries from returned orders, grouped by products and orders

Throttling: Max 20 requests per minute. (20/1)

Presents the result with page size and pagination.

Default page size : 200 records per page.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/entries/returns/sumOfQty';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'page' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/entries/returns/sumOfQty"
);

const params = {
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/entries/returns/sumOfQty?page=1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/entries/returns/sumOfQty'
params = {
  'page': '1',
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers, params=params)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 20
x-ratelimit-remaining: 19
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/entries/returns/sumOfQty

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

Which page to show. Example: 1

GET Import Entries

requires authentication

List sumOf product entries from imports, grouped by products and imports

Throttling: Max 20 requests per minute. (20/1)

Presents the result with page size and pagination.

Default page size : 200 records per page.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/entries/imports/sumOfQty';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'page' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/entries/imports/sumOfQty"
);

const params = {
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/entries/imports/sumOfQty?page=1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/entries/imports/sumOfQty'
params = {
  'page': '1',
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers, params=params)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 20
x-ratelimit-remaining: 19
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/entries/imports/sumOfQty

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

Which page to show. Example: 1

API V1 - Recipients

Recipients Endpoints

GET All Recipients

requires authentication

List all recipients.

Presents the result with page size and pagination.

Default page size : 200 records per page.

Throttling: Max 60 requests per minute. (60/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/recipients';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'page' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/recipients"
);

const params = {
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/recipients?page=1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/recipients'
params = {
  'page': '1',
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers, params=params)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 59
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/recipients

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

Which page to show. Example: 1

CREATE Recipient

requires authentication

Create a new Recipient

Throttling: Max 60 requests per minute. (60/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/recipients';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'recipientExternalId' => 'MHM124503sDfHJj',
            'isLegalEntity' => true,
            'companyName' => 'Company Name',
            'companyUniqueIdentifier' => 'RO55599888',
            'companyRegistrationNumber' => 'J99/9999/1950',
            'companyBankName' => 'The Bank of',
            'companyIban' => 'RO49AAAA1B31007593840000',
            'contactPerson' => 'John Doe',
            'address' => 'Green Street 23',
            'country' => 'Romania',
            'city' => 'Bucharest',
            'county' => 'Sector 1',
            'postalCode' => '010025',
            'phone' => '0700099900',
            'email' => 'john.d@gmail.com',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/recipients"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "recipientExternalId": "MHM124503sDfHJj",
    "isLegalEntity": true,
    "companyName": "Company Name",
    "companyUniqueIdentifier": "RO55599888",
    "companyRegistrationNumber": "J99\/9999\/1950",
    "companyBankName": "The Bank of",
    "companyIban": "RO49AAAA1B31007593840000",
    "contactPerson": "John Doe",
    "address": "Green Street 23",
    "country": "Romania",
    "city": "Bucharest",
    "county": "Sector 1",
    "postalCode": "010025",
    "phone": "0700099900",
    "email": "john.d@gmail.com"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "https://clients.metrica.bg/api/v1/connectors/client/recipients" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"recipientExternalId\": \"MHM124503sDfHJj\",
    \"isLegalEntity\": true,
    \"companyName\": \"Company Name\",
    \"companyUniqueIdentifier\": \"RO55599888\",
    \"companyRegistrationNumber\": \"J99\\/9999\\/1950\",
    \"companyBankName\": \"The Bank of\",
    \"companyIban\": \"RO49AAAA1B31007593840000\",
    \"contactPerson\": \"John Doe\",
    \"address\": \"Green Street 23\",
    \"country\": \"Romania\",
    \"city\": \"Bucharest\",
    \"county\": \"Sector 1\",
    \"postalCode\": \"010025\",
    \"phone\": \"0700099900\",
    \"email\": \"john.d@gmail.com\"
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/recipients'
payload = {
    "recipientExternalId": "MHM124503sDfHJj",
    "isLegalEntity": true,
    "companyName": "Company Name",
    "companyUniqueIdentifier": "RO55599888",
    "companyRegistrationNumber": "J99\/9999\/1950",
    "companyBankName": "The Bank of",
    "companyIban": "RO49AAAA1B31007593840000",
    "contactPerson": "John Doe",
    "address": "Green Street 23",
    "country": "Romania",
    "city": "Bucharest",
    "county": "Sector 1",
    "postalCode": "010025",
    "phone": "0700099900",
    "email": "john.d@gmail.com"
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Request      

POST api/v1/connectors/client/recipients

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

recipientExternalId   string   

A unique alphanumeric identifier for the recipient, used to link with external records. Must be unique within your recipient records. Example: MHM124503sDfHJj

isLegalEntity   boolean   

Mention if the recipient is a legal entity/juridical person or an individual/natural person. Accepted input are true, false, 1, 0, "1", and "0". Example: true

companyName   string  optional  

requiredIf The billing Company name. Fill only if the recipient is a legal entity. This is prohibited when isLegalEntity is set to false. Max 75 characters allowed. Example: Company Name

companyUniqueIdentifier   string  optional  

requiredIf The billing Company Unique Identifier (CUI/VAT). Fill only if the recipient is a legal entity. This is prohibited when isLegalEntity is set to false. All whitespaces and non-alphanumeric characters are automatically removed from this field. Max 30 characters allowed. Example: RO55599888

companyRegistrationNumber   string  optional  

requiredIf The billing company registration number. Fill only if the recipient is a legal entity. This is prohibited when isLegalEntity is set to false. Max 50 characters allowed. Example: J99/9999/1950

companyBankName   string  optional  

The billing company bank name. Fill only if the recipient is for a legal entity. This is prohibited when isLegalEntity is set to false. Max 50 characters allowed. Example: The Bank of

companyIban   string  optional  

The billing company IBAN. Fill only if the recipient is for a legal entity. Max 34 characters allowed. This is prohibited when isLegalEntity is set to false. Example: RO49AAAA1B31007593840000

contactPerson   string   

The name of the recipient. Example: John Doe

address   string  optional  

optional The address of the recipient. Example: Green Street 23

country   string   

The country of the recipient. Example: Romania

city   string   

The city of the recipient. Example: Bucharest

county   string   

The county of the recipient. Example: Sector 1

postalCode   string  optional  

optional The postal code of the recipient. Example: 010025

phone   string   

The phone number of the recipient. Must have 10 digits. Example: 0700099900

email   string  optional  

optional The email of the recipient. Example: john.d@gmail.com

GET Recipient By ID

requires authentication

Get Recipient information by internal ID.

Throttling: Max 60 requests per minute. (60/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/recipients/537';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/recipients/537"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/recipients/537" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/recipients/537'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 58
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for Recipient not found",
        "code": 404
    }
}
 

Request      

GET api/v1/connectors/client/recipients/{id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The ID of the recipient. Example: 537

UPDATE Recipient

requires authentication

Update Recipient by ID

Throttling: Max 60 requests per minute. (60/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/recipients/1';
$response = $client->put(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'recipientExternalId' => 'MHM124503sDfHJj',
            'isLegalEntity' => true,
            'companyName' => 'Company Name',
            'companyUniqueIdentifier' => 'RO55599888',
            'companyRegistrationNumber' => 'J99/9999/1950',
            'companyBankName' => 'The Bank of',
            'companyIban' => 'RO49AAAA1B31007593840000',
            'contactPerson' => 'John Doe',
            'address' => 'Green Street 23',
            'country' => 'Romania',
            'city' => 'Bucharest',
            'county' => 'Sector 1',
            'postalCode' => '010025',
            'phone' => '0700099900',
            'email' => 'john.d@gmail.com',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/recipients/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "recipientExternalId": "MHM124503sDfHJj",
    "isLegalEntity": true,
    "companyName": "Company Name",
    "companyUniqueIdentifier": "RO55599888",
    "companyRegistrationNumber": "J99\/9999\/1950",
    "companyBankName": "The Bank of",
    "companyIban": "RO49AAAA1B31007593840000",
    "contactPerson": "John Doe",
    "address": "Green Street 23",
    "country": "Romania",
    "city": "Bucharest",
    "county": "Sector 1",
    "postalCode": "010025",
    "phone": "0700099900",
    "email": "john.d@gmail.com"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request PUT \
    "https://clients.metrica.bg/api/v1/connectors/client/recipients/1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"recipientExternalId\": \"MHM124503sDfHJj\",
    \"isLegalEntity\": true,
    \"companyName\": \"Company Name\",
    \"companyUniqueIdentifier\": \"RO55599888\",
    \"companyRegistrationNumber\": \"J99\\/9999\\/1950\",
    \"companyBankName\": \"The Bank of\",
    \"companyIban\": \"RO49AAAA1B31007593840000\",
    \"contactPerson\": \"John Doe\",
    \"address\": \"Green Street 23\",
    \"country\": \"Romania\",
    \"city\": \"Bucharest\",
    \"county\": \"Sector 1\",
    \"postalCode\": \"010025\",
    \"phone\": \"0700099900\",
    \"email\": \"john.d@gmail.com\"
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/recipients/1'
payload = {
    "recipientExternalId": "MHM124503sDfHJj",
    "isLegalEntity": true,
    "companyName": "Company Name",
    "companyUniqueIdentifier": "RO55599888",
    "companyRegistrationNumber": "J99\/9999\/1950",
    "companyBankName": "The Bank of",
    "companyIban": "RO49AAAA1B31007593840000",
    "contactPerson": "John Doe",
    "address": "Green Street 23",
    "country": "Romania",
    "city": "Bucharest",
    "county": "Sector 1",
    "postalCode": "010025",
    "phone": "0700099900",
    "email": "john.d@gmail.com"
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('PUT', url, headers=headers, json=payload)
response.json()

Request      

PUT api/v1/connectors/client/recipients/{id}

PATCH api/v1/connectors/client/recipients/{id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The ID of the recipient. Example: 1

Body Parameters

recipientExternalId   string   

A unique alphanumeric identifier for the recipient, used to link with external records. Must be unique within your recipient records. Example: MHM124503sDfHJj

isLegalEntity   boolean   

Mention if the recipient is a legal entity/juridical person or an individual/natural person. Accepted input are true, false, 1, 0, "1", and "0". Example: true

companyName   string  optional  

requiredIf The billing Company name. Fill only if the recipient is a legal entity. This is prohibited when isLegalEntity is set to false. Max 75 characters allowed. Example: Company Name

companyUniqueIdentifier   string  optional  

requiredIf The billing Company Unique Identifier (CUI/VAT). Fill only if the recipient is a legal entity. This is prohibited when isLegalEntity is set to false. All whitespaces and non-alphanumeric characters are automatically removed from this field. Max 30 characters allowed. Example: RO55599888

companyRegistrationNumber   string  optional  

requiredIf The billing company registration number. Fill only if the recipient is a legal entity. This is prohibited when isLegalEntity is set to false. Max 50 characters allowed. Example: J99/9999/1950

companyBankName   string  optional  

The billing company bank name. Fill only if the recipient is for a legal entity. This is prohibited when isLegalEntity is set to false. Max 50 characters allowed. Example: The Bank of

companyIban   string  optional  

The billing company IBAN. Fill only if the recipient is for a legal entity. This is prohibited when isLegalEntity is set to false. Max 34 characters allowed. Example: RO49AAAA1B31007593840000

contactPerson   string   

The name of the recipient. Example: John Doe

address   string  optional  

optional The address of the recipient. Example: Green Street 23

country   string   

The country of the recipient. Example: Romania

city   string   

The city of the recipient. Example: Bucharest

county   string   

The county of the recipient. Example: Sector 1

postalCode   string  optional  

optional The postal code of the recipient. Example: 010025

phone   string   

The phone number of the recipient. Must have 10 digits. Example: 0700099900

email   string  optional  

optional The email of the recipient. Example: john.d@gmail.com

DELETE Recipient By ID

requires authentication

Delete Recipient by internal id

Throttling: Max 60 requests per minute. (60/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/recipients/1';
$response = $client->delete(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/recipients/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
curl --request DELETE \
    "https://clients.metrica.bg/api/v1/connectors/client/recipients/1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/recipients/1'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('DELETE', url, headers=headers)
response.json()

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for Recipient not found",
        "code": 404
    }
}
 

Request      

DELETE api/v1/connectors/client/recipients/{id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The ID of the recipient. Example: 1

recipientId   integer   

The recipient ID.

GET Recipient By External ID

requires authentication

Get Recipient by external ID.

Throttling: Max 60 requests per minute. (60/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/recipients/byExternalId/MHM024515AP';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/recipients/byExternalId/MHM024515AP"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/recipients/byExternalId/MHM024515AP" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/recipients/byExternalId/MHM024515AP'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 57
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for Recipient not found",
        "code": 404
    }
}
 

Request      

GET api/v1/connectors/client/recipients/byExternalId/{externalId}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

externalId   string   

The recipient external ID. Example: MHM024515AP

API V1 - Orders

Orders Endpoints

GET All Orders

requires authentication

List all orders.

Throttling: Max 5 requests per minute. (5/1) Max 20 requests per hour. (20/60)

Presents the result with page size and simple pagination (without showing the total number of records and last page).

Default page size : 500 records per page. The ordering is newest orders first.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/orders';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'page' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/orders"
);

const params = {
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/orders?page=1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/orders'
params = {
  'page': '1',
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers, params=params)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 5
x-ratelimit-remaining: 4
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/orders

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

Which page to show. Example: 1

GET Filtered Orders

requires authentication

List all orders that match filters.

Throttling: Max 5 requests per minute. (5/1) Max 20 requests per hour. (20/60)

Presents the result with page size and pagination.

Default page size : 250 records per page. (Maximum 500)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/filter';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'page' => '1',
        ],
        'json' => [
            'ids' => '3234201,3234202',
            'external_ids' => 'MHMF134018SHNi,MHMF134018SH12',
            'startDate' => '2024-01-01 12:59:59',
            'endDate' => '2024-12-22 19:30:00',
            'dateFilterBy' => 'CREATED_AT',
            'sortDate' => 'ASC',
            'status' => 'InProcessing,Sent',
            'customerName' => 'ContactPerson3',
            'customerPhone' => '0700112233',
            'isReturned' => false,
            'withCashOnDelivery' => '0',
            'perPage' => 250,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/orders/filter"
);

const params = {
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "ids": "3234201,3234202",
    "external_ids": "MHMF134018SHNi,MHMF134018SH12",
    "startDate": "2024-01-01 12:59:59",
    "endDate": "2024-12-22 19:30:00",
    "dateFilterBy": "CREATED_AT",
    "sortDate": "ASC",
    "status": "InProcessing,Sent",
    "customerName": "ContactPerson3",
    "customerPhone": "0700112233",
    "isReturned": false,
    "withCashOnDelivery": "0",
    "perPage": 250
};

fetch(url, {
    method: "GET",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/orders/filter?page=1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"ids\": \"3234201,3234202\",
    \"external_ids\": \"MHMF134018SHNi,MHMF134018SH12\",
    \"startDate\": \"2024-01-01 12:59:59\",
    \"endDate\": \"2024-12-22 19:30:00\",
    \"dateFilterBy\": \"CREATED_AT\",
    \"sortDate\": \"ASC\",
    \"status\": \"InProcessing,Sent\",
    \"customerName\": \"ContactPerson3\",
    \"customerPhone\": \"0700112233\",
    \"isReturned\": false,
    \"withCashOnDelivery\": \"0\",
    \"perPage\": 250
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/filter'
payload = {
    "ids": "3234201,3234202",
    "external_ids": "MHMF134018SHNi,MHMF134018SH12",
    "startDate": "2024-01-01 12:59:59",
    "endDate": "2024-12-22 19:30:00",
    "dateFilterBy": "CREATED_AT",
    "sortDate": "ASC",
    "status": "InProcessing,Sent",
    "customerName": "ContactPerson3",
    "customerPhone": "0700112233",
    "isReturned": false,
    "withCashOnDelivery": "0",
    "perPage": 250
}
params = {
  'page': '1',
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers, json=payload, params=params)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 5
x-ratelimit-remaining: 4
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/orders/filter

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

Which page to show. Example: 1

Body Parameters

ids   string  optional  

List of comma-separated Order IDs. Example: 3234201,3234202

external_ids   string  optional  

List of comma-separated Order external IDs. Example: MHMF134018SHNi,MHMF134018SH12

startDate   date  optional  

A date between past and today. The format must be in: Y-m-d H:i:s. Example: 2024-01-01 12:59:59

endDate   date  optional  

A date between past and today. If there is a startDate, endDate must be later than startDate. The format must be in: Y-m-d H:i:s. Example: 2024-12-22 19:30:00

dateFilterBy   enum(CREATED_AT,UPDATED_AT,SHIPPED_AT,RETURNED_AT)  optional  

The column to which startDate and endDate are compared. - Default: CREATED_AT. Example: CREATED_AT

sortDate   enum(DESC,ASC)  optional  

Order in which to retrieve results. - default ASC Example: ASC

status   enum(Sent,Callcenter,InProcessing,NotReady,Locked)  optional  

Filter orders by their status specified by a comma-separated list. Example: InProcessing,Sent

shippingAWB   string  optional  

The AWB number.

customerName   string  optional  

The name of the customer. Example: ContactPerson3

customerPhone   string  optional  

The customer's phone number. Example: 0700112233

isReturned   boolean  optional  

A filter that will select only orders that are returned or not returned. Example: false

withCashOnDelivery   boolean/int/string  optional  

A filter that will select only the orders with or without cash on delivery. Accepted inputs are true, false, 1, 0, "1", and "0". Example: 0

perPage   integer  optional  

Number of entries per page. The allowed values are between 10 and 500. If not provided, the default is 250. Example: 250

POST Filter Orders by Date

requires authentication

Returns a list with the orders filtered by the date of entry, the shipping date or the returned date.

Throttling: Max 20 requests per minute. (20/1)

Presents the result with page size and pagination.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/filterByDate';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'page' => '1',
        ],
        'json' => [
            'filterBy' => 'entryDate',
            'fromDate' => '2020-01-01',
            'perPage' => 100,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/orders/filterByDate"
);

const params = {
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "filterBy": "entryDate",
    "fromDate": "2020-01-01",
    "perPage": 100
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "https://clients.metrica.bg/api/v1/connectors/client/orders/filterByDate?page=1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"filterBy\": \"entryDate\",
    \"fromDate\": \"2020-01-01\",
    \"perPage\": 100
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/filterByDate'
payload = {
    "filterBy": "entryDate",
    "fromDate": "2020-01-01",
    "perPage": 100
}
params = {
  'page': '1',
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers, json=payload, params=params)
response.json()

Request      

POST api/v1/connectors/client/orders/filterByDate

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

Which page to show. Example: 1

Body Parameters

filterBy   string   

The filterBy field accepts only the following values: entryDate, shippingDate, returnedDate. Example: entryDate

fromDate   date   

A date in the past that is applied to the chosen filter. The date must be older than today and not older than 62 days from today. The format must be in: yyyy-mm-dd Example: 2020-01-01

perPage   integer   

Number of orders to show per page. The allowed values are between 10 and 500. Example: 100

POST Filter Orders by Date Intervals

requires authentication

Returns a list with the orders between two dates. The result can be filtered by the date of entry, the shipping date or the returned date.

Throttling: Max 20 requests per minute. (20/1)

Presents the result with page size and pagination.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/filterByDateIntervals';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'page' => '1',
        ],
        'json' => [
            'filterBy' => 'entryDate',
            'startDate' => '2024-01-01',
            'endDate' => '2024-01-31',
            'withCashOnDelivery' => false,
            'perPage' => 100,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/orders/filterByDateIntervals"
);

const params = {
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "filterBy": "entryDate",
    "startDate": "2024-01-01",
    "endDate": "2024-01-31",
    "withCashOnDelivery": false,
    "perPage": 100
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "https://clients.metrica.bg/api/v1/connectors/client/orders/filterByDateIntervals?page=1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"filterBy\": \"entryDate\",
    \"startDate\": \"2024-01-01\",
    \"endDate\": \"2024-01-31\",
    \"withCashOnDelivery\": false,
    \"perPage\": 100
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/filterByDateIntervals'
payload = {
    "filterBy": "entryDate",
    "startDate": "2024-01-01",
    "endDate": "2024-01-31",
    "withCashOnDelivery": false,
    "perPage": 100
}
params = {
  'page': '1',
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers, json=payload, params=params)
response.json()

Request      

POST api/v1/connectors/client/orders/filterByDateIntervals

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

Which page to show. Example: 1

Body Parameters

filterBy   string   

The filterBy field accepts only the following values: entryDate, shippingDate, returnedDate. Example: entryDate

startDate   date   

A date between past and today. The format must be in: yyyy-mm-dd Example: 2024-01-01

endDate   date   

A date between past and today. The date must later or equal to startDate and not later than 62 days. The format must be in: yyyy-mm-dd Example: 2024-01-31

withCashOnDelivery   boolean  optional  

A filter that will select only the orders with or without cash on delivery. Accepted input are true, false, 1, 0, "1", and "0". Example: false

perPage   integer   

Number of orders per page. The allowed values are between 10 and 500. Example: 100

POST Filter Orders by Status

requires authentication

List the orders in our system filtering by the order status

Throttling: Max 20 requests per minute. (20/1)

Presents the result with page size and pagination.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/filterByStatus';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'page' => '1',
        ],
        'json' => [
            'status' => 'Shipped',
            'perPage' => 100,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/orders/filterByStatus"
);

const params = {
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "status": "Shipped",
    "perPage": 100
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "https://clients.metrica.bg/api/v1/connectors/client/orders/filterByStatus?page=1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"status\": \"Shipped\",
    \"perPage\": 100
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/filterByStatus'
payload = {
    "status": "Shipped",
    "perPage": 100
}
params = {
  'page': '1',
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers, json=payload, params=params)
response.json()

Request      

POST api/v1/connectors/client/orders/filterByStatus

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

Which page to show. Example: 1

Body Parameters

status   string   

The status field accepts only the following values: Locked, Callcenter, NotReady, Processing, Shipped, NotShipped. Example: Shipped

perPage   integer   

Number of orders to show per page. The allowed values are between 10 and 500. Example: 100

GET Today latest updated orders

requires authentication

Retrieve a list of today's latest updated orders.

Throttling: Max 1 request per 10 minutes. (1/10)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/todayLatestUpdated';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/orders/todayLatestUpdated"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/orders/todayLatestUpdated" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/todayLatestUpdated'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 1
x-ratelimit-remaining: 0
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/orders/todayLatestUpdated

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

GET Order By ID

requires authentication

Get Order information by internal ID.

Throttling: Max 60 requests per minute. (60/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/byId/3234201';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/orders/byId/3234201"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/orders/byId/3234201" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/byId/3234201'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 59
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for OrderItem not found",
        "code": 404
    }
}
 

Request      

GET api/v1/connectors/client/orders/byId/{orderId}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

orderId   integer   

The order ID. Example: 3234201

GET Order By External ID

requires authentication

Get Order information by external ID.

Throttling: Max 60 requests per minute. (60/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/byExternalId/MHMF1338580SQl';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/orders/byExternalId/MHMF1338580SQl"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/orders/byExternalId/MHMF1338580SQl" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/byExternalId/MHMF1338580SQl'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 59
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for OrderItem not found",
        "code": 404
    }
}
 

Request      

GET api/v1/connectors/client/orders/byExternalId/{externalId}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

externalId   string   

The order external ID. Example: MHMF1338580SQl

GET Order By AWB

requires authentication

Get Order information by AWB Number.

Throttling: Max 60 requests per minute. (60/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/byAwb/AWBNO9923';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/orders/byAwb/AWBNO9923"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/orders/byAwb/AWBNO9923" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/byAwb/AWBNO9923'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 59
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for OrderItem not found",
        "code": 404
    }
}
 

Request      

GET api/v1/connectors/client/orders/byAwb/{awb}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

awb   string  optional  

alphaNum required The order AWB Number. Example: AWBNO9923

GET Order By External Source Order ID

requires authentication

Get Order information by external source order ID.

Throttling: Max 60 requests per minute. (60/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/byExternalSourceOrderId/SID323';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/orders/byExternalSourceOrderId/SID323"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/orders/byExternalSourceOrderId/SID323" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/byExternalSourceOrderId/SID323'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 59
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for OrderItem not found",
        "code": 404
    }
}
 

Request      

GET api/v1/connectors/client/orders/byExternalSourceOrderId/{externalSourceOrderId}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

externalSourceOrderId   string  optional  

alphaNum required The order externalSourceOrderId. Example: SID323

GET Shipped Orders With Expiry Dates

requires authentication

Returns a list with the shipped orders and a field named shippedExpiryDates for each product that contains a list with the quantity of each date/batch. The expiryDate and batch fields will be null if the productType is Normal. The orders are sorted DESC by the shipped date.

Throttling: Max 10 requests per minute. (10/1)

Presents the result with page size and pagination.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/shipped/with/expiryDates';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/orders/shipped/with/expiryDates"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/orders/shipped/with/expiryDates" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/shipped/with/expiryDates'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 10
x-ratelimit-remaining: 9
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/orders/shipped/with/expiryDates

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

CREATE Order

requires authentication

Creates a new Order.

Throttling: Max 15 requests per minute. (15/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/create';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'externalId' => 'ID123',
            'prefDate' => '2040-12-31',
            'address' => 'Str. My Street, No.10, Ap. 99',
            'streetId' => 995,
            'cityId' => 15,
            'city' => 'Bucuresti',
            'county' => 'Sector 1',
            'country' => 'RO',
            'postalCode' => '010111',
            'companyName' => 'Company SA',
            'companyUniqueIdentifier' => 'RO55599888',
            'companyRegistrationNumber' => 'J99/9999/1950',
            'contactPerson' => 'Contact Person',
            'contactPhone' => '0700999111',
            'contactEmail' => 'test@test.com',
            'cashOnDelivery' => '100.99',
            'declaredValueAmount' => '100.99',
            'warehouseRemarks' => 'eligendi',
            'shippingInstructions' => 'voluptatem',
            'courierId' => 15,
            'courierSubAccountId' => 4,
            'awbUrl' => 'https://pathtomyawb.pdf',
            'invoiceUrl' => 'https://pathtomyinvoice.pdf',
            'deliveryNoteUrl' => 'https://pathtomydeliverynote.pdf',
            'maxKeepDays' => 365,
            'externalSource' => 'Shopify MyWebSite',
            'externalSourceOrderId' => 'AxZ00001',
            'awbNumber' => 'AWB001',
            'withPriority' => false,
            'saveAsLocked' => false,
            'lockerId' => '"5959"',
            'useOverriddenValidationRules' => false,
            'products' => [
                [
                    'id' => '184736',
                    'quantity' => 3,
                    'price' => 100.9999,
                ],
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/orders/create"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "externalId": "ID123",
    "prefDate": "2040-12-31",
    "address": "Str. My Street, No.10, Ap. 99",
    "streetId": 995,
    "cityId": 15,
    "city": "Bucuresti",
    "county": "Sector 1",
    "country": "RO",
    "postalCode": "010111",
    "companyName": "Company SA",
    "companyUniqueIdentifier": "RO55599888",
    "companyRegistrationNumber": "J99\/9999\/1950",
    "contactPerson": "Contact Person",
    "contactPhone": "0700999111",
    "contactEmail": "test@test.com",
    "cashOnDelivery": "100.99",
    "declaredValueAmount": "100.99",
    "warehouseRemarks": "eligendi",
    "shippingInstructions": "voluptatem",
    "courierId": 15,
    "courierSubAccountId": 4,
    "awbUrl": "https:\/\/pathtomyawb.pdf",
    "invoiceUrl": "https:\/\/pathtomyinvoice.pdf",
    "deliveryNoteUrl": "https:\/\/pathtomydeliverynote.pdf",
    "maxKeepDays": 365,
    "externalSource": "Shopify MyWebSite",
    "externalSourceOrderId": "AxZ00001",
    "awbNumber": "AWB001",
    "withPriority": false,
    "saveAsLocked": false,
    "lockerId": "\"5959\"",
    "useOverriddenValidationRules": false,
    "products": [
        {
            "id": "184736",
            "quantity": 3,
            "price": 100.9999
        }
    ]
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "https://clients.metrica.bg/api/v1/connectors/client/orders/create" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"externalId\": \"ID123\",
    \"prefDate\": \"2040-12-31\",
    \"address\": \"Str. My Street, No.10, Ap. 99\",
    \"streetId\": 995,
    \"cityId\": 15,
    \"city\": \"Bucuresti\",
    \"county\": \"Sector 1\",
    \"country\": \"RO\",
    \"postalCode\": \"010111\",
    \"companyName\": \"Company SA\",
    \"companyUniqueIdentifier\": \"RO55599888\",
    \"companyRegistrationNumber\": \"J99\\/9999\\/1950\",
    \"contactPerson\": \"Contact Person\",
    \"contactPhone\": \"0700999111\",
    \"contactEmail\": \"test@test.com\",
    \"cashOnDelivery\": \"100.99\",
    \"declaredValueAmount\": \"100.99\",
    \"warehouseRemarks\": \"eligendi\",
    \"shippingInstructions\": \"voluptatem\",
    \"courierId\": 15,
    \"courierSubAccountId\": 4,
    \"awbUrl\": \"https:\\/\\/pathtomyawb.pdf\",
    \"invoiceUrl\": \"https:\\/\\/pathtomyinvoice.pdf\",
    \"deliveryNoteUrl\": \"https:\\/\\/pathtomydeliverynote.pdf\",
    \"maxKeepDays\": 365,
    \"externalSource\": \"Shopify MyWebSite\",
    \"externalSourceOrderId\": \"AxZ00001\",
    \"awbNumber\": \"AWB001\",
    \"withPriority\": false,
    \"saveAsLocked\": false,
    \"lockerId\": \"\\\"5959\\\"\",
    \"useOverriddenValidationRules\": false,
    \"products\": [
        {
            \"id\": \"184736\",
            \"quantity\": 3,
            \"price\": 100.9999
        }
    ]
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/create'
payload = {
    "externalId": "ID123",
    "prefDate": "2040-12-31",
    "address": "Str. My Street, No.10, Ap. 99",
    "streetId": 995,
    "cityId": 15,
    "city": "Bucuresti",
    "county": "Sector 1",
    "country": "RO",
    "postalCode": "010111",
    "companyName": "Company SA",
    "companyUniqueIdentifier": "RO55599888",
    "companyRegistrationNumber": "J99\/9999\/1950",
    "contactPerson": "Contact Person",
    "contactPhone": "0700999111",
    "contactEmail": "test@test.com",
    "cashOnDelivery": "100.99",
    "declaredValueAmount": "100.99",
    "warehouseRemarks": "eligendi",
    "shippingInstructions": "voluptatem",
    "courierId": 15,
    "courierSubAccountId": 4,
    "awbUrl": "https:\/\/pathtomyawb.pdf",
    "invoiceUrl": "https:\/\/pathtomyinvoice.pdf",
    "deliveryNoteUrl": "https:\/\/pathtomydeliverynote.pdf",
    "maxKeepDays": 365,
    "externalSource": "Shopify MyWebSite",
    "externalSourceOrderId": "AxZ00001",
    "awbNumber": "AWB001",
    "withPriority": false,
    "saveAsLocked": false,
    "lockerId": "\"5959\"",
    "useOverriddenValidationRules": false,
    "products": [
        {
            "id": "184736",
            "quantity": 3,
            "price": 100.9999
        }
    ]
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Request      

POST api/v1/connectors/client/orders/create

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

externalId   string  optional  

sometimes The order external ID. Is generated automatically by us if not provided. To avoid order duplicates provide it from your source id field. Example: ID123

prefDate   date   

Preferred shipment date of the order. Use the current date if it does not exist. Example: 2040-12-31

address   string  optional  

requiredIf The recipient address. This field is required only if awbUrl field is empty. Example: Str. My Street, No.10, Ap. 99

streetId   integer  optional  

The recipient street id. Is usually used in some courier integrations. Example: 995

cityId   integer  optional  

requiredIf The recipient city id. This field is required only if the selected courier is EMAG (courierId 7). Is usually used in some courier integrations. Example: 15

city   string  optional  

requiredIf The recipient city. The field must have at least 1 character. This field is required only if awbUrl field is empty. Max 50 characters allowed. Example: Bucuresti

county   string  optional  

requiredIf The recipient county. The field must have at least 1 character. This field is required only if awbUrl field is empty. Max 50 characters allowed. Example: Sector 1

country   string  optional  

requiredIf The recipient country. The field must have min 2 characters. It is required if awbUrl field is empty. Between 2 and 50 characters allowed. Example: RO

postalCode   string  optional  

The recipient postal code. Max 10 characters allowed. Example: 010111

companyName   string  optional  

The recipient company name. Fill only if the shipment is B2B. Max 150 characters allowed. Example: Company SA

companyUniqueIdentifier   string  optional  

The recipient Company Unique Identifier (CUI/VAT). Fill only if the shipment is B2B. Max 20 characters allowed. Example: RO55599888

companyRegistrationNumber   string  optional  

The recipient company registration number. Fill only if the shipment is B2B. Max 100 characters allowed. Example: J99/9999/1950

contactPerson   string  optional  

requiredIf The recipient contact person. This field is required only if awbUrl field is empty. Max 200 characters allowed. Example: Contact Person

contactPhone   string  optional  

requiredIf The recipient contact person phone. This field is required only if awbUrl field is empty. The phone number must contain the correct number of digits (usually between 8-14) and the allowed characters between digits are: space, dash, dots or parenthesis. Example: 0700999111

contactEmail   email  optional  

requiredIf The recipient contact person email. It is required if the selected courier is DPD (courierId 3) and the country is not RO/Romania. Example: test@test.com

cashOnDelivery   numeric   

The shipment Cash On Delivery amount. The amount can have max 2 decimals. If the order does not have Cash On Delivery the field value must be 0. Example: 100.99

declaredValueAmount   numeric  optional  

The shipment declared value amount. The amount can have max 2 decimals. Example: 100.99

warehouseRemarks   sting  optional  

Info for the Warehouse operators. Example: eligendi

shippingInstructions   sting  optional  

Info for the shipping courier. Example: voluptatem

courierId   integer   

The courier ID. Example: 15

courierSubAccountId   integer  optional  

The SubAccount courier ID. Example: 4

awbUrl   url  optional  

Url path to a pdf containing the order AWB. Max 250 characters allowed. Example: https://pathtomyawb.pdf

invoiceUrl   url  optional  

Url path to a pdf containing the order invoice. Max 250 characters allowed. Example: https://pathtomyinvoice.pdf

deliveryNoteUrl   url  optional  

Url path to a pdf containing the order delivery note. Max 250 characters allowed. Example: https://pathtomydeliverynote.pdf

maxKeepDays   integer   

Value between 0 and 365. Example: 365

externalSource   string  optional  

The name of the external source of the order. The value must start with a value from in External Source List endpoint result. Example: Shopify MyWebSite

externalSourceOrderId   string  optional  

The order website id or any other id that can help identify the order in our system. Example: AxZ00001

awbNumber   alphaNumeric  optional  

The AWB Number. Max 150 characters allowed. Example: AWB001

withPriority   boolean  optional  

Mention if the order must be prioritized. Accepted input are true, false, 1, 0, "1", and "0". Example: false

saveAsLocked   boolean  optional  

Mention if the order must be saved as Locked. Accepted input are true, false, 1, 0, "1", and "0". Example: false

lockerId   string  optional  

Value must have max 100 characters. Allowed characters are: alphanumeric, space or parenthesis. The lockerId is only allowed on a few couriers. Example: "5959"

useOverriddenValidationRules   boolean  optional  

If there are custom validation rules added by developers this field must be passed as true in order to be taken into account. Example: false

products   object[]   

Array of products

id   string   

The product (internal) ID. The id must be unique(distinct) in the products object. Example: 184736

quantity   integer   

The product quantity. The value must be at least 1. Example: 3

price   number  optional  

The product price. The price can have max 4 decimals. Example: 100.9999

UPDATE Order

requires authentication

Updates order by ID

Throttling: Max 15 requests per minute. (15/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/update/';
$response = $client->put(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'address' => 'Str. My Street, No.10, Ap. 99',
            'city' => 'Bucuresti',
            'county' => 'Sector 12307050000008470',
            'country' => 'RO',
            'postalCode' => 'ea',
            'companyName' => 'Company SA',
            'companyUniqueIdentifier' => 'RO55599888',
            'companyRegistrationNumber' => 'J99/9999/1950',
            'contactPerson' => 'qui',
            'contactPhone' => '0700999111',
            'contactEmail' => 'xbeer@example.net',
            'cashOnDelivery' => '100.99',
            'warehouseRemarks' => 'officia',
            'shippingInstructions' => 'ab',
            'courierId' => 15,
            'courierSubAccountId' => 4,
            'awbUrl' => 'https://pathtomyawb.pdf',
            'invoiceUrl' => 'https://pathtomyinvoice.pdf',
            'deliveryNoteUrl' => 'https://pathtomydeliverynote.pdf',
            'maxKeepDays' => 365,
            'externalSource' => 'Shopify MyWebSite',
            'externalSourceOrderId' => 'AxZ00001',
            'awbNumber' => 'AWB001',
            'withPriority' => false,
            'lockerId' => '"5959"',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/orders/update/"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "address": "Str. My Street, No.10, Ap. 99",
    "city": "Bucuresti",
    "county": "Sector 12307050000008470",
    "country": "RO",
    "postalCode": "ea",
    "companyName": "Company SA",
    "companyUniqueIdentifier": "RO55599888",
    "companyRegistrationNumber": "J99\/9999\/1950",
    "contactPerson": "qui",
    "contactPhone": "0700999111",
    "contactEmail": "xbeer@example.net",
    "cashOnDelivery": "100.99",
    "warehouseRemarks": "officia",
    "shippingInstructions": "ab",
    "courierId": 15,
    "courierSubAccountId": 4,
    "awbUrl": "https:\/\/pathtomyawb.pdf",
    "invoiceUrl": "https:\/\/pathtomyinvoice.pdf",
    "deliveryNoteUrl": "https:\/\/pathtomydeliverynote.pdf",
    "maxKeepDays": 365,
    "externalSource": "Shopify MyWebSite",
    "externalSourceOrderId": "AxZ00001",
    "awbNumber": "AWB001",
    "withPriority": false,
    "lockerId": "\"5959\""
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request PUT \
    "https://clients.metrica.bg/api/v1/connectors/client/orders/update/" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"address\": \"Str. My Street, No.10, Ap. 99\",
    \"city\": \"Bucuresti\",
    \"county\": \"Sector 12307050000008470\",
    \"country\": \"RO\",
    \"postalCode\": \"ea\",
    \"companyName\": \"Company SA\",
    \"companyUniqueIdentifier\": \"RO55599888\",
    \"companyRegistrationNumber\": \"J99\\/9999\\/1950\",
    \"contactPerson\": \"qui\",
    \"contactPhone\": \"0700999111\",
    \"contactEmail\": \"xbeer@example.net\",
    \"cashOnDelivery\": \"100.99\",
    \"warehouseRemarks\": \"officia\",
    \"shippingInstructions\": \"ab\",
    \"courierId\": 15,
    \"courierSubAccountId\": 4,
    \"awbUrl\": \"https:\\/\\/pathtomyawb.pdf\",
    \"invoiceUrl\": \"https:\\/\\/pathtomyinvoice.pdf\",
    \"deliveryNoteUrl\": \"https:\\/\\/pathtomydeliverynote.pdf\",
    \"maxKeepDays\": 365,
    \"externalSource\": \"Shopify MyWebSite\",
    \"externalSourceOrderId\": \"AxZ00001\",
    \"awbNumber\": \"AWB001\",
    \"withPriority\": false,
    \"lockerId\": \"\\\"5959\\\"\"
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/update/'
payload = {
    "address": "Str. My Street, No.10, Ap. 99",
    "city": "Bucuresti",
    "county": "Sector 12307050000008470",
    "country": "RO",
    "postalCode": "ea",
    "companyName": "Company SA",
    "companyUniqueIdentifier": "RO55599888",
    "companyRegistrationNumber": "J99\/9999\/1950",
    "contactPerson": "qui",
    "contactPhone": "0700999111",
    "contactEmail": "xbeer@example.net",
    "cashOnDelivery": "100.99",
    "warehouseRemarks": "officia",
    "shippingInstructions": "ab",
    "courierId": 15,
    "courierSubAccountId": 4,
    "awbUrl": "https:\/\/pathtomyawb.pdf",
    "invoiceUrl": "https:\/\/pathtomyinvoice.pdf",
    "deliveryNoteUrl": "https:\/\/pathtomydeliverynote.pdf",
    "maxKeepDays": 365,
    "externalSource": "Shopify MyWebSite",
    "externalSourceOrderId": "AxZ00001",
    "awbNumber": "AWB001",
    "withPriority": false,
    "lockerId": "\"5959\""
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('PUT', url, headers=headers, json=payload)
response.json()

Request      

PUT api/v1/connectors/client/orders/update/{orderId}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

orderId   integer   

The order ID.

Body Parameters

address   string  optional  

requiredIf The recipient address. It is required if awbUrl field is empty. Example: Str. My Street, No.10, Ap. 99

city   string  optional  

requiredIf The recipient city. The field must have at least 1 character. It is required if awbUrl field is empty. Max 50 characters allowed. Example: Bucuresti

county   string  optional  

requiredIf The recipient county. The field must have at least 1 character. It is required if awbUrl field is empty. Max 50 characters allowed. Example: Sector 12307050000008470

country   string  optional  

requiredIf The recipient country. The field must have min 2 characters. It is required if awbUrl field is empty. Between 2 and 50 characters allowed. Example: RO

postalCode   string  optional  

The recipient postal code. Max 10 characters allowed. Example: ea

companyName   string  optional  

The recipient company name. Fill only if the shipment is B2B. Max 150 characters allowed. Example: Company SA

companyUniqueIdentifier   string  optional  

The recipient Company Unique Identifier (CUI/VAT). Fill only if the shipment is B2B. Max 20 characters allowed. Example: RO55599888

companyRegistrationNumber   string  optional  

The recipient company registration number. Fill only if the shipment is B2B. Max 100 characters allowed. Example: J99/9999/1950

contactPerson   string   

The recipient contact person. Max 200 characters allowed. Example: qui

contactPhone   string   

The recipient contact person phone. The phone number must contain the correct number of digits and the allowed characters between digits are: space, dash, dots or parenthesis. Example: 0700999111

contactEmail   email  optional  

requiredIf The recipient contact person email. It is required if the selected courier is DPD (courierId 7) and the country is not RO/Romania. Example: xbeer@example.net

cashOnDelivery   numeric   

The shipment Cash On Delivery amount. The amount can have max 2 decimals. If the order does not have Cash On Delivery the field value must be 0. Example: 100.99

warehouseRemarks   sting  optional  

Info for Warehouse. Example: officia

shippingInstructions   sting  optional  

Info for the shipping courier. Example: ab

courierId   integer   

The courier ID. Example: 15

courierSubAccountId   integer  optional  

The SubAccount courier ID. Example: 4

awbUrl   url  optional  

Url path to a pdf containing the order AWB. Max 250 characters allowed. Example: https://pathtomyawb.pdf

invoiceUrl   url  optional  

Url path to a pdf containing the order invoice. Max 250 characters allowed. Example: https://pathtomyinvoice.pdf

deliveryNoteUrl   url  optional  

Url path to a pdf containing the order delivery note. Max 250 characters allowed. Example: https://pathtomydeliverynote.pdf

maxKeepDays   integer   

Value between 0 and 365. Example: 365

externalSource   string  optional  

The name of the external source of the order. The value must start with a value from in External Source List endpoint result. Example: Shopify MyWebSite

externalSourceOrderId   string  optional  

The order website id or any other id that can help identify the order in our system. Example: AxZ00001

awbNumber   string  optional  

The AWB Number. Max 150 characters allowed. Example: AWB001

withPriority   boolean  optional  

Mention if the order must be prioritized. Accepted input are true, false, 1, 0, "1", and "0". Example: false

lockerId   string  optional  

Value must have max 100 characters. Allowed characters are: alphanumeric, space or parenthesis. The lockerId is only allowed on a few couriers. Example: "5959"

UPDATE Order Url Field

requires authentication

Directly updates order url fields by ID

Throttling: Max 5 requests per minute. (5/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/updateUrlField/';
$response = $client->put(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'urlField' => 'invoiceUrl',
            'url' => 'https://pathtomyurl.pdf',
            'deliveryNoteSerialNumber' => 'NO-001',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/orders/updateUrlField/"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "urlField": "invoiceUrl",
    "url": "https:\/\/pathtomyurl.pdf",
    "deliveryNoteSerialNumber": "NO-001"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request PUT \
    "https://clients.metrica.bg/api/v1/connectors/client/orders/updateUrlField/" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"urlField\": \"invoiceUrl\",
    \"url\": \"https:\\/\\/pathtomyurl.pdf\",
    \"deliveryNoteSerialNumber\": \"NO-001\"
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/updateUrlField/'
payload = {
    "urlField": "invoiceUrl",
    "url": "https:\/\/pathtomyurl.pdf",
    "deliveryNoteSerialNumber": "NO-001"
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('PUT', url, headers=headers, json=payload)
response.json()

Request      

PUT api/v1/connectors/client/orders/updateUrlField/{orderId}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

orderId   integer   

The order ID.

Body Parameters

urlField   enum(invoiceUrl,deliveryNoteUrl)   

The target order url field that should be updated. Example: invoiceUrl

url   url  optional  

The url path that returns a PDF file. Max 250 characters allowed. Example: https://pathtomyurl.pdf

deliveryNoteSerialNumber   string  optional  

The delivery note serial number. Allowed only when urlField is equal to deliveryNoteUrl. Max 30 characters allowed. Example: NO-001

DELETE Order By ID

requires authentication

Delete Order by internal id

Throttling: Max 60 requests per minute. (60/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/delete/';
$response = $client->delete(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/orders/delete/"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
curl --request DELETE \
    "https://clients.metrica.bg/api/v1/connectors/client/orders/delete/" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/delete/'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('DELETE', url, headers=headers)
response.json()

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for OrderItem not found",
        "code": 404
    }
}
 

Request      

DELETE api/v1/connectors/client/orders/delete/{orderId}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

orderId   integer   

The order ID.

LOCK Order By ID

requires authentication

LOCK Order by internal id. This will prevent the start of order processing until it's unlocked.

Throttling: Max 60 requests per minute. (60/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/lock/';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/orders/lock/"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
curl --request POST \
    "https://clients.metrica.bg/api/v1/connectors/client/orders/lock/" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/lock/'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers)
response.json()

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for OrderItem not found",
        "code": 404
    }
}
 

Request      

POST api/v1/connectors/client/orders/lock/{orderId}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

orderId   integer   

The order ID.

UNLOCK Order By ID

requires authentication

UNLOCK Order by internal id. This will unlock the order so the warehouse operators can start the picking and packing processes.

Throttling: Max 60 requests per minute. (60/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/unlock/';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/orders/unlock/"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
curl --request POST \
    "https://clients.metrica.bg/api/v1/connectors/client/orders/unlock/" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/unlock/'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers)
response.json()

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for OrderItem not found",
        "code": 404
    }
}
 

Request      

POST api/v1/connectors/client/orders/unlock/{orderId}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

orderId   integer   

The order ID.

GET External Source List

requires authentication

Retrieve a list with the allowed external sources.

Throttling: Max 100 requests per minute. (100/1)

Please inform us if your source is not on this list, so we can add it.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/externalSourceList';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/orders/externalSourceList"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/orders/externalSourceList" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/externalSourceList'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 100
x-ratelimit-remaining: 99
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/orders/externalSourceList

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

REQUEST DPD Pickup

requires authentication

Creates a new DPD AWB number and Pickup request for the given order ID.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/requestDPDPickup';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'id' => '1234',
            'identifiedAs' => 'orderId',
            'sender' => [
                'clientName' => 'Company 999',
                'contactName' => 'Contact Test',
                'contactPhoneNumber' => 'maxime',
                'address' => 'Test address',
                'city' => 'City',
                'county' => 'County',
                'postCode' => '999999',
            ],
            'extra' => [
                'declaredValueAmount' => '100.99',
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/orders/requestDPDPickup"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "id": "1234",
    "identifiedAs": "orderId",
    "sender": {
        "clientName": "Company 999",
        "contactName": "Contact Test",
        "contactPhoneNumber": "maxime",
        "address": "Test address",
        "city": "City",
        "county": "County",
        "postCode": "999999"
    },
    "extra": {
        "declaredValueAmount": "100.99"
    }
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "https://clients.metrica.bg/api/v1/connectors/client/orders/requestDPDPickup" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"id\": \"1234\",
    \"identifiedAs\": \"orderId\",
    \"sender\": {
        \"clientName\": \"Company 999\",
        \"contactName\": \"Contact Test\",
        \"contactPhoneNumber\": \"maxime\",
        \"address\": \"Test address\",
        \"city\": \"City\",
        \"county\": \"County\",
        \"postCode\": \"999999\"
    },
    \"extra\": {
        \"declaredValueAmount\": \"100.99\"
    }
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/requestDPDPickup'
payload = {
    "id": "1234",
    "identifiedAs": "orderId",
    "sender": {
        "clientName": "Company 999",
        "contactName": "Contact Test",
        "contactPhoneNumber": "maxime",
        "address": "Test address",
        "city": "City",
        "county": "County",
        "postCode": "999999"
    },
    "extra": {
        "declaredValueAmount": "100.99"
    }
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Request      

POST api/v1/connectors/client/orders/requestDPDPickup

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

id   string   

Requested order id. Example: 1234

identifiedAs   enum(orderId,externalId,externalSourceOrderId)   

Order column identifier for specifying where the provided id value should be searched. Example: orderId

sender   object   

Contains information about the sender of the shipment.

clientName   string   

Sender client name. Example: Company 999

contactName   string   

Sender contact name. Example: Contact Test

contactPhoneNumber   string   

Sender contact phone. Example: maxime

address   string   

Sender address. Example: Test address

city   string   

Sender city. Example: City

county   string   

Sender county. Example: County

postCode   string   

Sender postal code. Example: 999999

extra   object  optional  

Contains extra information for DPD.

declaredValueAmount   numeric  optional  

The amount can have max 2 decimals. Example: 100.99

API V1 - Order Invoices

Order Invoice Endpoints

GET Invoices Information

requires authentication

Returns a list with all invoices information that can be filtered by the available parameters.

Throttling: Max 20 requests per hour. (20/60)

Default page size : 100 records per page.

Presents the result with page size and pagination.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/invoice/information';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'page' => '1',
        ],
        'json' => [
            'hasInvoiceNumber' => false,
            'orderIsShipped' => true,
            'startDate' => '2024-01-01 12:59:59',
            'dateQueryType' => 'orderSentDate',
            'orderByField' => 'orderSentDate',
            'orderByDirection' => 'ASC',
            'perPage' => 100,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/orders/invoice/information"
);

const params = {
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "hasInvoiceNumber": false,
    "orderIsShipped": true,
    "startDate": "2024-01-01 12:59:59",
    "dateQueryType": "orderSentDate",
    "orderByField": "orderSentDate",
    "orderByDirection": "ASC",
    "perPage": 100
};

fetch(url, {
    method: "GET",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/orders/invoice/information?page=1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"hasInvoiceNumber\": false,
    \"orderIsShipped\": true,
    \"startDate\": \"2024-01-01 12:59:59\",
    \"dateQueryType\": \"orderSentDate\",
    \"orderByField\": \"orderSentDate\",
    \"orderByDirection\": \"ASC\",
    \"perPage\": 100
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/invoice/information'
payload = {
    "hasInvoiceNumber": false,
    "orderIsShipped": true,
    "startDate": "2024-01-01 12:59:59",
    "dateQueryType": "orderSentDate",
    "orderByField": "orderSentDate",
    "orderByDirection": "ASC",
    "perPage": 100
}
params = {
  'page': '1',
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers, json=payload, params=params)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 10
x-ratelimit-remaining: 9
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/orders/invoice/information

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

Which page to show. Example: 1

Body Parameters

hasInvoiceNumber   boolean  optional  

The result is filtered based on the presence of the invoice number in the information. If missing the filter will not be added. Example: false

orderIsShipped   boolean  optional  

The result is filtered based on the internal order status. If missing the filter will not be added. Example: true

startDate   date  optional  

A date between past and today. The format must be in: Y-m-d H:i:s Example: 2024-01-01 12:59:59

dateQueryType   enum(invoiceInformationCreatedDate,orderSentDate)  optional  

The column that should be queried by startDate field. Example: orderSentDate

orderByField   enum(invoiceInformationCreatedDate,orderSentDate)  optional  

The field responsible for ordering the result. Example: orderSentDate

orderByDirection   enum(ASC,DESC)  optional  

The direction of order for orderByField field. Example: ASC

perPage   integer  optional  

Number of records to show per page. The allowed values are between 10 and 250. If not provided, the default is 100. Example: 100

GET Invoice Information By Order ID

requires authentication

GET Invoice Information By Order internal ID

Throttling: Max 10 requests per minute. (10/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/invoice/information/byOrderId/animi';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/orders/invoice/information/byOrderId/animi"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/orders/invoice/information/byOrderId/animi" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/invoice/information/byOrderId/animi'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 10
x-ratelimit-remaining: 9
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for OrderItem not found",
        "code": 404
    }
}
 

Request      

GET api/v1/connectors/client/orders/invoice/information/byOrderId/{orderId}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

orderId   string   

Example: animi

order_id   integer   

The order ID. Example: 101

CREATE Order Invoice Information

requires authentication

Creates a new Order Invoice Information.

Throttling: Max 15 requests per minute. (15/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/invoice/information/create/';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'isLegalEntity' => false,
            'companyName' => 'Company Name',
            'companyUniqueIdentifier' => 'RO55599888',
            'companyRegistrationNumber' => 'J99/9999/1950',
            'companyBankName' => 'The Bank of',
            'companyIban' => 'RO49AAAA1B31007593840000',
            'firstName' => 'First',
            'lastName' => 'Last',
            'address' => 'Str. My Street, No.10, Ap. 99',
            'city' => 'Bucuresti',
            'county' => 'Sector 1',
            'country' => 'RO',
            'postalCode' => '010111',
            'phone' => '0700999111',
            'email' => 'test@test.com',
            'shippingTax' => '100.50',
            'processingFee' => '0',
            'orderCampaignId' => 1001,
            'discountsTotal' => '100.99',
            'invoiceTotal' => '999.99',
            'invoiceNumber' => 'SN-RO-001',
            'urlPath' => 'https://pathtomyinvoice.pdf',
            'unlockOrder' => false,
            'sameLinesAsOrder' => false,
            'linesPriceCheck' => false,
            'discounts' => [
                [
                    'name' => 'Discount Name No-1',
                    'value' => '100.9999',
                ],
            ],
            'discountApplications' => [
                [
                    'allocationMethod' => 'each',
                    'targetSelection' => 'explicit',
                    'targetType' => 'shipping_line',
                    'code' => 'CODEX101',
                    'title' => 'title',
                    'description' => 'description',
                    'type' => 'discount_code',
                    'value' => '20.0',
                    'valueType' => 'fixed_amount',
                    'calculatedAmount' => '100.9999',
                ],
            ],
            'invoiceLines' => [
                [
                    'productId' => 123456,
                    'lineExternalIdentifier' => 'accusamus',
                    'pricePerUnit' => '10.55',
                    'quantity' => 5,
                    'totalDiscount' => '10.55',
                    'taxLines' => [
                        [
                            'title' => 'VAT RO',
                        ],
                    ],
                    'price' => '10.55',
                    'rate' => '0.99',
                ],
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/orders/invoice/information/create/"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "isLegalEntity": false,
    "companyName": "Company Name",
    "companyUniqueIdentifier": "RO55599888",
    "companyRegistrationNumber": "J99\/9999\/1950",
    "companyBankName": "The Bank of",
    "companyIban": "RO49AAAA1B31007593840000",
    "firstName": "First",
    "lastName": "Last",
    "address": "Str. My Street, No.10, Ap. 99",
    "city": "Bucuresti",
    "county": "Sector 1",
    "country": "RO",
    "postalCode": "010111",
    "phone": "0700999111",
    "email": "test@test.com",
    "shippingTax": "100.50",
    "processingFee": "0",
    "orderCampaignId": 1001,
    "discountsTotal": "100.99",
    "invoiceTotal": "999.99",
    "invoiceNumber": "SN-RO-001",
    "urlPath": "https:\/\/pathtomyinvoice.pdf",
    "unlockOrder": false,
    "sameLinesAsOrder": false,
    "linesPriceCheck": false,
    "discounts": [
        {
            "name": "Discount Name No-1",
            "value": "100.9999"
        }
    ],
    "discountApplications": [
        {
            "allocationMethod": "each",
            "targetSelection": "explicit",
            "targetType": "shipping_line",
            "code": "CODEX101",
            "title": "title",
            "description": "description",
            "type": "discount_code",
            "value": "20.0",
            "valueType": "fixed_amount",
            "calculatedAmount": "100.9999"
        }
    ],
    "invoiceLines": [
        {
            "productId": 123456,
            "lineExternalIdentifier": "accusamus",
            "pricePerUnit": "10.55",
            "quantity": 5,
            "totalDiscount": "10.55",
            "taxLines": [
                {
                    "title": "VAT RO"
                }
            ],
            "price": "10.55",
            "rate": "0.99"
        }
    ]
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "https://clients.metrica.bg/api/v1/connectors/client/orders/invoice/information/create/" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"isLegalEntity\": false,
    \"companyName\": \"Company Name\",
    \"companyUniqueIdentifier\": \"RO55599888\",
    \"companyRegistrationNumber\": \"J99\\/9999\\/1950\",
    \"companyBankName\": \"The Bank of\",
    \"companyIban\": \"RO49AAAA1B31007593840000\",
    \"firstName\": \"First\",
    \"lastName\": \"Last\",
    \"address\": \"Str. My Street, No.10, Ap. 99\",
    \"city\": \"Bucuresti\",
    \"county\": \"Sector 1\",
    \"country\": \"RO\",
    \"postalCode\": \"010111\",
    \"phone\": \"0700999111\",
    \"email\": \"test@test.com\",
    \"shippingTax\": \"100.50\",
    \"processingFee\": \"0\",
    \"orderCampaignId\": 1001,
    \"discountsTotal\": \"100.99\",
    \"invoiceTotal\": \"999.99\",
    \"invoiceNumber\": \"SN-RO-001\",
    \"urlPath\": \"https:\\/\\/pathtomyinvoice.pdf\",
    \"unlockOrder\": false,
    \"sameLinesAsOrder\": false,
    \"linesPriceCheck\": false,
    \"discounts\": [
        {
            \"name\": \"Discount Name No-1\",
            \"value\": \"100.9999\"
        }
    ],
    \"discountApplications\": [
        {
            \"allocationMethod\": \"each\",
            \"targetSelection\": \"explicit\",
            \"targetType\": \"shipping_line\",
            \"code\": \"CODEX101\",
            \"title\": \"title\",
            \"description\": \"description\",
            \"type\": \"discount_code\",
            \"value\": \"20.0\",
            \"valueType\": \"fixed_amount\",
            \"calculatedAmount\": \"100.9999\"
        }
    ],
    \"invoiceLines\": [
        {
            \"productId\": 123456,
            \"lineExternalIdentifier\": \"accusamus\",
            \"pricePerUnit\": \"10.55\",
            \"quantity\": 5,
            \"totalDiscount\": \"10.55\",
            \"taxLines\": [
                {
                    \"title\": \"VAT RO\"
                }
            ],
            \"price\": \"10.55\",
            \"rate\": \"0.99\"
        }
    ]
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/invoice/information/create/'
payload = {
    "isLegalEntity": false,
    "companyName": "Company Name",
    "companyUniqueIdentifier": "RO55599888",
    "companyRegistrationNumber": "J99\/9999\/1950",
    "companyBankName": "The Bank of",
    "companyIban": "RO49AAAA1B31007593840000",
    "firstName": "First",
    "lastName": "Last",
    "address": "Str. My Street, No.10, Ap. 99",
    "city": "Bucuresti",
    "county": "Sector 1",
    "country": "RO",
    "postalCode": "010111",
    "phone": "0700999111",
    "email": "test@test.com",
    "shippingTax": "100.50",
    "processingFee": "0",
    "orderCampaignId": 1001,
    "discountsTotal": "100.99",
    "invoiceTotal": "999.99",
    "invoiceNumber": "SN-RO-001",
    "urlPath": "https:\/\/pathtomyinvoice.pdf",
    "unlockOrder": false,
    "sameLinesAsOrder": false,
    "linesPriceCheck": false,
    "discounts": [
        {
            "name": "Discount Name No-1",
            "value": "100.9999"
        }
    ],
    "discountApplications": [
        {
            "allocationMethod": "each",
            "targetSelection": "explicit",
            "targetType": "shipping_line",
            "code": "CODEX101",
            "title": "title",
            "description": "description",
            "type": "discount_code",
            "value": "20.0",
            "valueType": "fixed_amount",
            "calculatedAmount": "100.9999"
        }
    ],
    "invoiceLines": [
        {
            "productId": 123456,
            "lineExternalIdentifier": "accusamus",
            "pricePerUnit": "10.55",
            "quantity": 5,
            "totalDiscount": "10.55",
            "taxLines": [
                {
                    "title": "VAT RO"
                }
            ],
            "price": "10.55",
            "rate": "0.99"
        }
    ]
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Request      

POST api/v1/connectors/client/orders/invoice/information/create/{orderId}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

orderId   integer   

The order ID.

Body Parameters

isLegalEntity   boolean   

Mention if the order invoice information is a legal entity/juridical person or an individual/natural person. Accepted input are true, false, 1, 0, "1", and "0". Example: false

companyName   string  optional  

requiredIf The billing Company name. Fill only if the invoice is a legal entity. Max 75 characters allowed. Example: Company Name

companyUniqueIdentifier   string  optional  

requiredIf The billing Company Unique Identifier (CUI/VAT). Fill only if the invoice is a legal entity. All whitespaces and non-alphanumeric characters are automatically removed from this field. Max 30 characters allowed. Example: RO55599888

companyRegistrationNumber   string  optional  

The billing company registration number. Max 50 characters allowed. Example: J99/9999/1950

companyBankName   string  optional  

The billing company bank name. Fill only if the invoice is for a legal entity. Max 50 characters allowed. Example: The Bank of

companyIban   string  optional  

The billing company IBAN. Fill only if the invoice is for a legal entity. Max 34 characters allowed. Example: RO49AAAA1B31007593840000

firstName   string  optional  

requiredIf required The billing contact first name. Max 50 characters allowed. Required if lastName is not present. Example: First

lastName   string  optional  

requiredIf required The billing contact last name. Max 50 characters allowed. Required if firstName is not present. Example: Last

address   string   

The billing address. Example: Str. My Street, No.10, Ap. 99

city   string   

The billing city. The field must have at least 1 character. Max 50 characters allowed. Example: Bucuresti

county   string   

The billing county. The field must have at least 1 character. Max 50 characters allowed. Example: Sector 1

country   string   

The billing country. Between 2 and 50 characters allowed. Example: RO

postalCode   string  optional  

The billing postal code. Max 10 characters allowed. Example: 010111

phone   string  optional  

The billing phone. The phone number must contain the correct number of digits and the allowed characters between digits are: space, dash, dots or parenthesis. Example: 0700999111

email   string  optional  

The billing email. Example: test@test.com

shippingTax   decimal   

The shipping tax. The value can have up to 2 decimal places. Example: 100.50

processingFee   decimal  optional  

The processing fee for the order. The value can have up to 2 decimal places. Example: 0

orderCampaignId   integer  optional  

The order campaign id. Example: 1001

discountsTotal   decimal  optional  

The current total value of all the discounts. The value can have up to 2 decimal places. Example: 100.99

invoiceTotal   decimal  optional  

The current total value of the invoice. The value can have up to 2 decimal places. Example: 999.99

invoiceNumber   string  optional  

An invoice number is a unique number assigned to invoices. They allow invoices to be easily identified and tracked for accounting and tax purposes. Example: SN-RO-001

urlPath   url  optional  

Url path to a pdf containing the order invoice. Max 100 characters allowed. Example: https://pathtomyinvoice.pdf

unlockOrder   boolean  optional  

Mention if the order must be unlocked after the Invoice Information is added. Its recommended to create the order as Locked if the invoice information is required through its lifetime. Accepted input are true, false, 1, 0, "1", and "0". Example: false

sameLinesAsOrder   boolean  optional  

Activate a validation check that will verify if the provided invoice lines are the same as order lines. Accepted input are true, false, 1, 0, "1", and "0". Example: false

linesPriceCheck   boolean  optional  

Activate a validation check that will verify if the sum of provided invoice lines is equal to invoiceTotal value. Accepted input are true, false, 1, 0, "1", and "0". Example: false

discounts   object[]  optional  

Contains a list of discounts. This object parameter will be deprecated in the future. Please use discountApplications instead.

name   string   

The discount name. Max 30 characters allowed. The field must be distinct. The field may have alphanumeric characters, as well as dashes and underscores. Example: Discount Name No-1

value   decimal   

The discount value. The value can have up to 4 decimals and can also be a negative value. Example: 100.9999

discountApplications   object[]  optional  

Contains a list of discounts applied to the order based on Shopify REST Order resource model.

allocationMethod   string  optional  

The method by which the discount application value has been allocated to entitled lines. Example: each

targetSelection   string  optional  

The lines on the order, of the type defined by target_type, that the discount is allocated over. Valid values: all, entitled, explicit. Example: explicit

targetType   string  optional  

The type of line on the order that the discount is applicable on. Valid values: line_item, shipping_line. Example: shipping_line

code   string  optional  

The discount code that was used to apply the discount. Available only for discount code applications. Example: CODEX101

title   string  optional  

The title of the discount application, as defined by the merchant. Available only for manual discount applications. Example: title

description   string  optional  

The description of the discount application, as defined by the merchant. Available only for manual and script discount applications. Example: description

type   string  optional  

The discount application type. Valid values: automatic, discount_code, manual, script. Example: discount_code

value   decimal   

The value of the discount application as a decimal. This represents the intention of the discount application. For example, if the intent was to apply a 20% discount, then the value will be 20.0. If the intent was to apply a $15 discount, then the value will be 15.0 Example: 20.0

valueType   string   

The type of the value. Valid values: fixed_amount, percentage. Example: fixed_amount

calculatedAmount   decimal   

The calculated discount amount. Example: 100.9999

invoiceLines   object[]  optional  

Contains a list of invoice lines.

productId   integer   

The order product ID. The field must be distinct. Example: 123456

lineExternalIdentifier   string  optional  

The external id of the corresponding invoice line. Max 50 characters allowed. Example: accusamus

pricePerUnit   decimal   

The invoice line price per unit. The value must be a positive number and can have up to 2 decimal places. Example: 10.55

quantity   integer   

The invoice line quantity. The value must be a positive number. Example: 5

totalDiscount   decimal   

The invoice line total discount. The value must be a positive number and can have up to 2 decimal places. Example: 10.55

taxLines   object[]  optional  

Contains a list of tax lines for each invoice line.

title   string   

The tax title. Between 3 and 50 characters allowed. Example: VAT RO

price   decimal   

The tax price. The value must be a positive number and can have up to 2 decimal places. Example: 10.55

rate   decimal  optional  

The tax rate percentage. The value must be a positive number and can have up to 2 decimal places. Example: 0.99

UPDATE Order Invoice Information InvoiceNumber

requires authentication

Updates the invoice number for the Order invoice information by ID

Throttling: Max 50 requests per minute. (50/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/invoice/information/update/4/invoiceNumber';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'page' => '1',
        ],
        'json' => [
            'invoiceNumber' => 'SN-RO-001',
            'urlPath' => 'https://pathtomyinvoice.pdf',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/orders/invoice/information/update/4/invoiceNumber"
);

const params = {
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "invoiceNumber": "SN-RO-001",
    "urlPath": "https:\/\/pathtomyinvoice.pdf"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "https://clients.metrica.bg/api/v1/connectors/client/orders/invoice/information/update/4/invoiceNumber?page=1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"invoiceNumber\": \"SN-RO-001\",
    \"urlPath\": \"https:\\/\\/pathtomyinvoice.pdf\"
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/invoice/information/update/4/invoiceNumber'
payload = {
    "invoiceNumber": "SN-RO-001",
    "urlPath": "https:\/\/pathtomyinvoice.pdf"
}
params = {
  'page': '1',
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers, json=payload, params=params)
response.json()

Request      

POST api/v1/connectors/client/orders/invoice/information/update/{orderInvoiceInformation_id}/invoiceNumber

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

orderInvoiceInformation_id   integer   

The ID of the orderInvoiceInformation. Example: 4

orderInvoiceInformation   integer   

The Order invoice information ID.

Query Parameters

page   integer  optional  

Which page to show. Example: 1

Body Parameters

invoiceNumber   string   

An invoice number is a unique number assigned to invoices. They allow invoices to be easily identified and tracked for accounting and tax purposes. Example: SN-RO-001

urlPath   url  optional  

Url path to a pdf containing the order invoice. Max 100 characters allowed. Example: https://pathtomyinvoice.pdf

POST api/v1/connectors/client/orders/invoice/fiscal/{orderIdentifier}/download

requires authentication

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/invoice/fiscal/nam/download';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/orders/invoice/fiscal/nam/download"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
curl --request POST \
    "https://clients.metrica.bg/api/v1/connectors/client/orders/invoice/fiscal/nam/download" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/orders/invoice/fiscal/nam/download'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers)
response.json()

Request      

POST api/v1/connectors/client/orders/invoice/fiscal/{orderIdentifier}/download

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

orderIdentifier   string   

Example: nam

API V1 - Products

Products Endpoints

GET All Products

requires authentication

List all products.

Presents the result with page size and simple pagination (without showing the total number of records and last page).

Throttling: Max 20 requests per minute. (20/1) Max 100 requests per hour. (100/60)

Default page size : 1000 records per page.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/products';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'page' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/products"
);

const params = {
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/products?page=1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/products'
params = {
  'page': '1',
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers, params=params)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 20
x-ratelimit-remaining: 19
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/products

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

Which page to show. Example: 1

GET Filtered Products

requires authentication

List all products that match filters.

Presents the result with page size and simple pagination (without showing the total number of records and last page).

Throttling: Max 20 requests per minute. (20/1) Max 100 requests per hour. (100/60)

Default page size : 250 records per page. (Maximum 1000 records per page)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/products/filter';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'page' => '1',
        ],
        'json' => [
            'ids' => '184735,184736,3049927',
            'productCode' => 'MHM223259',
            'barcode' => '4971850911119',
            'externalId' => '109',
            'startDate' => '2025-01-01 12:59:59',
            'endDate' => '2025-02-07 13:10:00',
            'dateFilterBy' => 'CREATED_AT',
            'sortDate' => 'ASC',
            'perPage' => 250,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/products/filter"
);

const params = {
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "ids": "184735,184736,3049927",
    "productCode": "MHM223259",
    "barcode": "4971850911119",
    "externalId": "109",
    "startDate": "2025-01-01 12:59:59",
    "endDate": "2025-02-07 13:10:00",
    "dateFilterBy": "CREATED_AT",
    "sortDate": "ASC",
    "perPage": 250
};

fetch(url, {
    method: "GET",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/products/filter?page=1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"ids\": \"184735,184736,3049927\",
    \"productCode\": \"MHM223259\",
    \"barcode\": \"4971850911119\",
    \"externalId\": \"109\",
    \"startDate\": \"2025-01-01 12:59:59\",
    \"endDate\": \"2025-02-07 13:10:00\",
    \"dateFilterBy\": \"CREATED_AT\",
    \"sortDate\": \"ASC\",
    \"perPage\": 250
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/products/filter'
payload = {
    "ids": "184735,184736,3049927",
    "productCode": "MHM223259",
    "barcode": "4971850911119",
    "externalId": "109",
    "startDate": "2025-01-01 12:59:59",
    "endDate": "2025-02-07 13:10:00",
    "dateFilterBy": "CREATED_AT",
    "sortDate": "ASC",
    "perPage": 250
}
params = {
  'page': '1',
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers, json=payload, params=params)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 20
x-ratelimit-remaining: 19
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/products/filter

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

Which page to show. Example: 1

Body Parameters

ids   string  optional  

List of comma-separated Product IDs. Example: 184735,184736,3049927

productCode   string  optional  

The product code. Example: MHM223259

barcode   string  optional  

The product barcode/ean. Example: 4971850911119

externalId   string  optional  

The product external id. Example: 109

startDate   date  optional  

A date between past and today. The format must be in: Y-m-d H:i:s. Example: 2025-01-01 12:59:59

endDate   date  optional  

A date between past and today. If there is a startDate, endDate must be later than startDate. The format must be in: Y-m-d H:i:s. Example: 2025-02-07 13:10:00

dateFilterBy   enum(CREATED_AT,UPDATED_AT)  optional  

The column to which startDate and endDate are compared. - Default: CREATED_AT. Example: CREATED_AT

sortDate   enum(DESC,ASC)  optional  

Order in which to retrieve results. - Default : ASC. Example: ASC

perPage   integer  optional  

Number of entries per page. The allowed values are between 10 and 1000. If not provided, the default is 250. Example: 250

GET Products created today

requires authentication

List all products that were created today

Presents the result with page size and pagination.

Throttling: Max 20 requests per hour. (20/60)

Default page size : 1000 records per page.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/products/filter/createdToday';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'page' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/products/filter/createdToday"
);

const params = {
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/products/filter/createdToday?page=1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/products/filter/createdToday'
params = {
  'page': '1',
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers, params=params)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 20
x-ratelimit-remaining: 19
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/products/filter/createdToday

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

Which page to show. Example: 1

GET Products updated today

requires authentication

List all products that were updated today

Presents the result with page size and pagination. Changes on product stock does not reflect as a product update.

Throttling: Max 20 requests per hour. (20/60)

Default page size : 1000 records per page.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/products/filter/updatedToday';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'page' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/products/filter/updatedToday"
);

const params = {
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/products/filter/updatedToday?page=1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/products/filter/updatedToday'
params = {
  'page': '1',
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers, params=params)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 20
x-ratelimit-remaining: 19
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/products/filter/updatedToday

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

Which page to show. Example: 1

GET Product By ID

requires authentication

Get Product information by internal ID

Throttling: Max 60 requests per minute. (60/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/products/byId/184742';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/products/byId/184742"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/products/byId/184742" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/products/byId/184742'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 59
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for Product not found",
        "code": 404
    }
}
 

Request      

GET api/v1/connectors/client/products/byId/{id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The product ID. Example: 184742

GET Product By EAN

requires authentication

Get Product information by its EAN (barcode)

This endpoint will return the first product found with the given param value!

Throttling: Max 60 requests per minute. (60/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/products/byEan/4971850911118';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/products/byEan/4971850911118"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/products/byEan/4971850911118" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/products/byEan/4971850911118'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 59
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for Product not found",
        "code": 404
    }
}
 

Request      

GET api/v1/connectors/client/products/byEan/{ean}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

ean   string   

The product EAN. Example: 4971850911118

DELETE Product By ID

requires authentication

Delete Product by internal id

Throttling: Max 60 requests per minute. (60/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/products/delete/';
$response = $client->delete(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/products/delete/"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
curl --request DELETE \
    "https://clients.metrica.bg/api/v1/connectors/client/products/delete/" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/products/delete/'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('DELETE', url, headers=headers)
response.json()

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for Product not found",
        "code": 404
    }
}
 

Request      

DELETE api/v1/connectors/client/products/delete/{productId}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

productId   integer   

The product ID.

GET Product By Product Code

requires authentication

Get Product information by its Product Code

This endpoint will return the first product found with the given param value!

Throttling: Max 60 requests per minute. (60/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/products/byProductCode/MHM223256';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/products/byProductCode/MHM223256"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/products/byProductCode/MHM223256" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/products/byProductCode/MHM223256'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 59
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for Product not found",
        "code": 404
    }
}
 

Request      

GET api/v1/connectors/client/products/byProductCode/{productCode}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

productCode   string   

The product code. Example: MHM223256

GET Product By External ID

requires authentication

Get Product information by its External ID

This endpoint will return the first product found with the given param value!

Throttling: Max 60 requests per minute. (60/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/products/byExternalId/105';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/products/byExternalId/105"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/products/byExternalId/105" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/products/byExternalId/105'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 59
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for Product not found",
        "code": 404
    }
}
 

Request      

GET api/v1/connectors/client/products/byExternalId/{externalId}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

externalId   string   

The product External ID. Example: 105

GET Product Stock By ID

requires authentication

Get Product stock information by internal ID

Throttling: Max 60 requests per minute. (60/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/products/stock/byId/184742';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/products/stock/byId/184742"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/products/stock/byId/184742" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/products/stock/byId/184742'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 58
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for Product not found",
        "code": 404
    }
}
 

Request      

GET api/v1/connectors/client/products/stock/byId/{id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

id   integer   

The product ID. Example: 184742

CREATE Product

requires authentication

Create a new Product

Throttling: Max 100 requests per minute. (100/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/products/create';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'description' => 'TestProduct',
            'productCode' => 'ABQ.123+',
            'ean' => '8009000123A-2.A',
            'externalId' => 10999,
            'price' => '10.55',
            'weight_grams' => 1500,
            'pictureUrl' => 'https://www.pathtomyimage.com',
            'productType' => '1',
            'useDefaultExpiryOnReception' => 'no',
            'useProdIdAsEan' => 'no',
            'productSpecialType' => 'et',
            'externalSource' => 'Shopify MyWebSite',
            'externalSourceProductId' => 'PRD00001',
            'useOverriddenValidationRules' => false,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/products/create"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "description": "TestProduct",
    "productCode": "ABQ.123+",
    "ean": "8009000123A-2.A",
    "externalId": 10999,
    "price": "10.55",
    "weight_grams": 1500,
    "pictureUrl": "https:\/\/www.pathtomyimage.com",
    "productType": "1",
    "useDefaultExpiryOnReception": "no",
    "useProdIdAsEan": "no",
    "productSpecialType": "et",
    "externalSource": "Shopify MyWebSite",
    "externalSourceProductId": "PRD00001",
    "useOverriddenValidationRules": false
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "https://clients.metrica.bg/api/v1/connectors/client/products/create" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"description\": \"TestProduct\",
    \"productCode\": \"ABQ.123+\",
    \"ean\": \"8009000123A-2.A\",
    \"externalId\": 10999,
    \"price\": \"10.55\",
    \"weight_grams\": 1500,
    \"pictureUrl\": \"https:\\/\\/www.pathtomyimage.com\",
    \"productType\": \"1\",
    \"useDefaultExpiryOnReception\": \"no\",
    \"useProdIdAsEan\": \"no\",
    \"productSpecialType\": \"et\",
    \"externalSource\": \"Shopify MyWebSite\",
    \"externalSourceProductId\": \"PRD00001\",
    \"useOverriddenValidationRules\": false
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/products/create'
payload = {
    "description": "TestProduct",
    "productCode": "ABQ.123+",
    "ean": "8009000123A-2.A",
    "externalId": 10999,
    "price": "10.55",
    "weight_grams": 1500,
    "pictureUrl": "https:\/\/www.pathtomyimage.com",
    "productType": "1",
    "useDefaultExpiryOnReception": "no",
    "useProdIdAsEan": "no",
    "productSpecialType": "et",
    "externalSource": "Shopify MyWebSite",
    "externalSourceProductId": "PRD00001",
    "useOverriddenValidationRules": false
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Request      

POST api/v1/connectors/client/products/create

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

description   string   

The product name. Between 3 and 100 characters allowed. Example: TestProduct

productCode   string   

The product code. The field may have alpha-numeric characters, as well as dash, dot, forward slash, plus sign and underscore. Between 3 and 100 characters allowed. The non alpha-numeric characters are not allowed at the beginning of the string. The underscore, dot and forward slash are not allowed at the end of the string. Example: ABQ.123+ Example: ABQ.123+

ean   string   

The product barcode. The field may have alpha-numeric characters, as well as dashes, dots and underscores. Between 4 and 20 characters allowed. The non alpha-numeric characters are not allowed at the beginning/end of the string. Example: 8009000123A-2.A

externalId   integer  optional  

The product external id. The value must be a positive integer. Example: 10999

price   decimal  optional  

The product price. The value must be a positive number and can support up 2 decimal places. Example: 10.55

weight_grams   integer   

The product weight in grams. The value must be a positive integer. Example: 1500

pictureUrl   url  optional  

The product image url. Between 10 and 200 characters allowed. Example: https://www.pathtomyimage.com

productType   enum(0,1,2)   

The product type must be one of next possible values: 0 - Normal; 1 - With Expiration Date; 2 - With Expiration Date & Production Lot. Example: 1

useDefaultExpiryOnReception   enum(no,yes)   

if productType is not 0. If the field is set to yes, a far future expiry date will be used as the default upon product reception. Example: no

useProdIdAsEan   enum(no,yes)   

If the field is set to yes, the product EAN will be updated with the ProductId after the product is created. Example: no

productSpecialType   alphaNumeric  optional  

If the product is a special type (e.g. each received piece has a SerialNumber) the value needs to be mentioned here from a possible list of values given by developers. This field can be set only if the productType value is set to 0. Example: et

externalSource   string  optional  

The name of the external source of the product. The value must start with a value from in External Source List endpoint result. Example: Shopify MyWebSite

externalSourceProductId   string  optional  

The product internal website id or any other id that can help identify the product in our system. Example: PRD00001

useOverriddenValidationRules   boolean  optional  

If there are custom validation rules added by developers this field must be passed as true in order to be taken into account. Example: false

UPDATE Product

requires authentication

Updates product by ID

Throttling: Max 100 requests per minute. (100/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/products/update/1';
$response = $client->put(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'description' => 'TestProduct',
            'productCode' => 'ABQ.123+',
            'ean' => '8009000123A-2.A',
            'externalId' => 10999,
            'price' => '10.55',
            'weight_grams' => 1500,
            'pictureUrl' => 'https://www.pathtomyimage.com',
            'productType' => '1',
            'useDefaultExpiryOnReception' => 'no',
            'externalSource' => 'Shopify MyWebSite',
            'externalSourceProductId' => 'PRD00001',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/products/update/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "description": "TestProduct",
    "productCode": "ABQ.123+",
    "ean": "8009000123A-2.A",
    "externalId": 10999,
    "price": "10.55",
    "weight_grams": 1500,
    "pictureUrl": "https:\/\/www.pathtomyimage.com",
    "productType": "1",
    "useDefaultExpiryOnReception": "no",
    "externalSource": "Shopify MyWebSite",
    "externalSourceProductId": "PRD00001"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request PUT \
    "https://clients.metrica.bg/api/v1/connectors/client/products/update/1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"description\": \"TestProduct\",
    \"productCode\": \"ABQ.123+\",
    \"ean\": \"8009000123A-2.A\",
    \"externalId\": 10999,
    \"price\": \"10.55\",
    \"weight_grams\": 1500,
    \"pictureUrl\": \"https:\\/\\/www.pathtomyimage.com\",
    \"productType\": \"1\",
    \"useDefaultExpiryOnReception\": \"no\",
    \"externalSource\": \"Shopify MyWebSite\",
    \"externalSourceProductId\": \"PRD00001\"
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/products/update/1'
payload = {
    "description": "TestProduct",
    "productCode": "ABQ.123+",
    "ean": "8009000123A-2.A",
    "externalId": 10999,
    "price": "10.55",
    "weight_grams": 1500,
    "pictureUrl": "https:\/\/www.pathtomyimage.com",
    "productType": "1",
    "useDefaultExpiryOnReception": "no",
    "externalSource": "Shopify MyWebSite",
    "externalSourceProductId": "PRD00001"
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('PUT', url, headers=headers, json=payload)
response.json()

Request      

PUT api/v1/connectors/client/products/update/{product_idp}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

product_idp   integer   

Example: 1

Body Parameters

description   string   

The product name. Between 3 and 100 characters allowed. Example: TestProduct

productCode   string   

The product code. The field may have alpha-numeric characters, as well as dash, dot, forward slash, plus sign and underscore. Between 3 and 100 characters allowed. The non alpha-numeric characters are not allowed at the beginning of the string. The underscore, dot and forward slash are not allowed at the end of the string. Example: ABQ.123+ Example: ABQ.123+

ean   string   

The product barcode. The field may have alpha-numeric characters, as well as dashes, dots and underscores. Between 4 and 20 characters allowed. The non alpha-numeric characters are not allowed at the beginning/end of the string. Example: 8009000123A-2.A Example: 8009000123A-2.A

externalId   integer  optional  

The product external id. The value must be a positive integer. Example: 10999

price   decimal  optional  

The product price. The value must be a positive number and can have up to 2 decimal places. Example: 10.55

weight_grams   integer   

The product weight in grams. The value must be a positive integer. Example: 1500

pictureUrl   url  optional  

The product image url. Between 10 and 200 characters allowed. Example: https://www.pathtomyimage.com

productType   enum(0,1,2)   

The product type must be one of next possible values: 0 - Normal; 1 - With Expiration Date; 2 - With Expiration Date & Production Lot Example: 1

useDefaultExpiryOnReception   enum(no,yes)   

if productType is not 0. If the field is set to yes, a far future expiry date will be used as the default upon product reception. Example: no

externalSource   string  optional  

The name of the external source of the product. The value must start with a value from in External Source List endpoint result. Example: Shopify MyWebSite

externalSourceProductId   string  optional  

The product internal website id or any other id that can help identify the product in our system. Example: PRD00001

GET External Source List

requires authentication

Retrieve a list with the allowed external sources.

Throttling: Max 100 requests per minute. (100/1)

Please inform us if your source is not on this list, so we can add it.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/products/externalSourceList';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/products/externalSourceList"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/products/externalSourceList" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/products/externalSourceList'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 100
x-ratelimit-remaining: 99
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/products/externalSourceList

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

API V1 - Receptions

Reception Endpoints

GET All Receptions

requires authentication

List all receptions.

Throttling: Max 30 requests per minute. (30/1)

Presents the result with page size and pagination.

Default page size : 200 records per page.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/receptions';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'page' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/receptions"
);

const params = {
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/receptions?page=1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/receptions'
params = {
  'page': '1',
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers, params=params)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 30
x-ratelimit-remaining: 29
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/receptions

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

Which page to show. Example: 1

GET Filtered Receptions with Reception Plans

requires authentication

List filtered receptions with reception plans.

Throttling: Max 15 requests per minute. (15/1)

Presents the result with page size and pagination.

Default page size : 200 records per page. (Maximum 300)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/receptions/filter';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'page' => '1',
        ],
        'json' => [
            'ids' => '31084,31072',
            'startDate' => '2020-01-01 12:59:59',
            'endDate' => '2020-12-30 19:30:00',
            'dateFilterBy' => 'CREATED_AT',
            'sortDate' => 'ASC',
            'isProcessed' => false,
            'withReceptionPlans' => false,
            'perPage' => 200,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/receptions/filter"
);

const params = {
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "ids": "31084,31072",
    "startDate": "2020-01-01 12:59:59",
    "endDate": "2020-12-30 19:30:00",
    "dateFilterBy": "CREATED_AT",
    "sortDate": "ASC",
    "isProcessed": false,
    "withReceptionPlans": false,
    "perPage": 200
};

fetch(url, {
    method: "GET",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/receptions/filter?page=1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"ids\": \"31084,31072\",
    \"startDate\": \"2020-01-01 12:59:59\",
    \"endDate\": \"2020-12-30 19:30:00\",
    \"dateFilterBy\": \"CREATED_AT\",
    \"sortDate\": \"ASC\",
    \"isProcessed\": false,
    \"withReceptionPlans\": false,
    \"perPage\": 200
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/receptions/filter'
payload = {
    "ids": "31084,31072",
    "startDate": "2020-01-01 12:59:59",
    "endDate": "2020-12-30 19:30:00",
    "dateFilterBy": "CREATED_AT",
    "sortDate": "ASC",
    "isProcessed": false,
    "withReceptionPlans": false,
    "perPage": 200
}
params = {
  'page': '1',
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers, json=payload, params=params)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 15
x-ratelimit-remaining: 14
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/receptions/filter

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

Which page to show. Example: 1

Body Parameters

ids   string  optional  

List of comma-separated Order IDs. Example: 31084,31072

startDate   date  optional  

A date between past and today. The format must be in: Y-m-d H:i:s. Example: 2020-01-01 12:59:59

endDate   date  optional  

A date between past and today. If there is a startDate, endDate must be later than startDate. The format must be in: Y-m-d H:i:s. Example: 2020-12-30 19:30:00

dateFilterBy   enum(CREATED_AT,UPDATED_AT,PROCESSED_AT)  optional  

The column to which startDate and endDate are compared. - Default: CREATED_AT. Example: CREATED_AT

sortDate   enum(DESC,ASC)  optional  

Order in which to retrieve results. - Default : ASC. Example: ASC

isProcessed   boolean  optional  

A filter that will only select receptions that are processed or not processed. Example: false

shippingAWB   string  optional  

The AWB number.

withReceptionPlans   boolean  optional  

A filter that when true the response will show additional info regarding the reception plans. - Default: false Example: false

perPage   integer  optional  

Number of entries per page. The allowed values are between 10 and 300. If not provided, the default is 200. Example: 200

GET Reception By ID

requires authentication

Get Reception information by internal ID.

Throttling: Max 60 requests per minute. (60/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/receptions/byId/31072';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/receptions/byId/31072"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/receptions/byId/31072" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/receptions/byId/31072'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 59
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for Reception not found",
        "code": 404
    }
}
 

Request      

GET api/v1/connectors/client/receptions/byId/{receptionId}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

receptionId   integer   

The reception ID. Example: 31072

GET Reception Contents By ID

requires authentication

Get Reception contents ( received products ana quantity ) by internal ID.

Throttling: Max 20 requests per minute. (20/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/receptions/byId/13/contents';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/receptions/byId/13/contents"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/receptions/byId/13/contents" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/receptions/byId/13/contents'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 20
x-ratelimit-remaining: 19
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for Reception not found",
        "code": 404
    }
}
 

Request      

GET api/v1/connectors/client/receptions/byId/{reception_id}/contents

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

reception_id   integer   

The ID of the reception. Example: 13

reception   integer   

The reception ID. Example: 31072

API V1 - Reception Plans

Reception Plan Endpoints

GET All Reception Plans

requires authentication

List all reception plans.

Throttling: Max 30 requests per minute. (30/1)

Presents the result with page size and pagination.

Default page size : 200 records per page.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlans';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'page' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/receptionPlans"
);

const params = {
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/receptionPlans?page=1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlans'
params = {
  'page': '1',
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers, params=params)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 30
x-ratelimit-remaining: 29
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/receptionPlans

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

Which page to show. Example: 1

GET Filtered Reception Plans with Receptions

requires authentication

List all reception plans that match filters with receptions.

Presents the result with page size and simple pagination (without showing the total number of records and last page).

Throttling: Max 20 requests per minute. (20/1) Max 100 requests per hour. (100/60)

Default page size : 200 records per page.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/filter';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'page' => '1',
        ],
        'json' => [
            'ids' => '3420,3478',
            'external_ids' => '12312555,456789',
            'startDate' => '2024-01-01 12:59:59',
            'endDate' => '2024-12-22 19:30:00',
            'dateFilterBy' => 'CREATED_AT',
            'sortDate' => 'ASC',
            'status' => 'Processing,New',
            'hasReception' => true,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/filter"
);

const params = {
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "ids": "3420,3478",
    "external_ids": "12312555,456789",
    "startDate": "2024-01-01 12:59:59",
    "endDate": "2024-12-22 19:30:00",
    "dateFilterBy": "CREATED_AT",
    "sortDate": "ASC",
    "status": "Processing,New",
    "hasReception": true
};

fetch(url, {
    method: "GET",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/filter?page=1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"ids\": \"3420,3478\",
    \"external_ids\": \"12312555,456789\",
    \"startDate\": \"2024-01-01 12:59:59\",
    \"endDate\": \"2024-12-22 19:30:00\",
    \"dateFilterBy\": \"CREATED_AT\",
    \"sortDate\": \"ASC\",
    \"status\": \"Processing,New\",
    \"hasReception\": true
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/filter'
payload = {
    "ids": "3420,3478",
    "external_ids": "12312555,456789",
    "startDate": "2024-01-01 12:59:59",
    "endDate": "2024-12-22 19:30:00",
    "dateFilterBy": "CREATED_AT",
    "sortDate": "ASC",
    "status": "Processing,New",
    "hasReception": true
}
params = {
  'page': '1',
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers, json=payload, params=params)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 20
x-ratelimit-remaining: 19
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/receptionPlans/filter

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

Which page to show. Example: 1

Body Parameters

ids   string  optional  

List of comma-separated Reception Plan IDs. Example: 3420,3478

external_ids   string  optional  

List of comma-separated Reception Plan external IDs. Example: 12312555,456789

startDate   date  optional  

A date between past and today. The format must be in: Y-m-d H:i:s. Example: 2024-01-01 12:59:59

endDate   date  optional  

A date between past and today. If there is a startDate, endDate must be later than startDate. The format must be in: Y-m-d H:i:s. Example: 2024-12-22 19:30:00

dateFilterBy   enum(CREATED_AT,UPDATED_AT)  optional  

The column to which startDate and endDate are compared. - Default: CREATED_AT. Example: CREATED_AT

sortDate   enum(DESC,ASC)  optional  

Order in which to retrieve results. - default ASC Example: ASC

status   enum(New,Ready,Processing,Finished)  optional  

Filter orders by their status specified by a comma-separated list. Example: Processing,New

shippingAWB   string  optional  

The AWB number.

hasReception   boolean  optional  

A filter that will only select reception plans that have or don't have receptions. Example: true

GET Reception Plan By ID

requires authentication

Get Reception Plan by internal ID.

Throttling: Max 60 requests per minute. (60/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/byId/101';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/byId/101"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/byId/101" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/byId/101'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 59
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for ReceptionPlan not found",
        "code": 404
    }
}
 

Request      

GET api/v1/connectors/client/receptionPlans/byId/{receptionPlan_id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

receptionPlan_id   integer   

The reception plan ID. Example: 101

CREATE Reception Plan

requires authentication

Create a new Reception Plan

Throttling: Max 10 requests per minute. (10/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/create';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'name' => 'TestPlan',
            'externalId' => '10999',
            'supplierName' => 'My Supplier',
            'awbNumber' => 'AWB001',
            'estimatedArrivalDate' => '2035-01-01',
            'hasStrictMaxQuantity' => false,
            'hasUniqueProducts' => false,
            'shouldReceiveOnlyPlannedProducts' => false,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/create"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "TestPlan",
    "externalId": "10999",
    "supplierName": "My Supplier",
    "awbNumber": "AWB001",
    "estimatedArrivalDate": "2035-01-01",
    "hasStrictMaxQuantity": false,
    "hasUniqueProducts": false,
    "shouldReceiveOnlyPlannedProducts": false
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/create" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"TestPlan\",
    \"externalId\": \"10999\",
    \"supplierName\": \"My Supplier\",
    \"awbNumber\": \"AWB001\",
    \"estimatedArrivalDate\": \"2035-01-01\",
    \"hasStrictMaxQuantity\": false,
    \"hasUniqueProducts\": false,
    \"shouldReceiveOnlyPlannedProducts\": false
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/create'
payload = {
    "name": "TestPlan",
    "externalId": "10999",
    "supplierName": "My Supplier",
    "awbNumber": "AWB001",
    "estimatedArrivalDate": "2035-01-01",
    "hasStrictMaxQuantity": false,
    "hasUniqueProducts": false,
    "shouldReceiveOnlyPlannedProducts": false
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Request      

POST api/v1/connectors/client/receptionPlans/create

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

name   string   

The reception plan name. Between 5 and 50 characters allowed. Example: TestPlan

externalId   alphaNumeric   

The reception plan external id. Between 2 and 50 characters allowed. Example: 10999

supplierName   string  optional  

The reception plan supplier. Between 3 and 50 characters allowed. Example: My Supplier

awbNumber   string  optional  

The reception plan shipping AWB Number. Between 3 and 50 characters allowed. Example: AWB001

estimatedArrivalDate   date  optional  

The reception plan estimated arrival date. The date must later or equal to today. The format must be in: yyyy-mm-dd. Example: 2035-01-01

receptionSeries   string  optional  

The reception series. Between 1 and 50 characters allowed. Required when receptionNumber is present. The combination of receptionSeries and receptionNumber must be unique within your group.

receptionNumber   string  optional  

The reception number. Between 1 and 50 characters allowed. Required when receptionSeries is present. The combination of receptionSeries and receptionNumber must be unique within your group.

hasStrictMaxQuantity   boolean  optional  

When is enabled cannot be received more pcs of a product than the given quantity in the reception plan. Example: false

hasUniqueProducts   boolean  optional  

When is enabled, the reception plan contents can't have the same product more than once. The product needs to be unique even if multiple imports are added in the current plan. Example: false

shouldReceiveOnlyPlannedProducts   boolean  optional  

When is enabled, the reception will not accept products not present in the reception plan. Example: false

UPDATE Reception Plan

requires authentication

Updates reception plan by ID

Throttling: Max 10 requests per minute. (10/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/update/3';
$response = $client->put(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'supplierName' => 'My Supplier',
            'awbNumber' => 'AWB001',
            'estimatedArrivalDate' => '2035-01-01',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/update/3"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "supplierName": "My Supplier",
    "awbNumber": "AWB001",
    "estimatedArrivalDate": "2035-01-01"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request PUT \
    "https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/update/3" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"supplierName\": \"My Supplier\",
    \"awbNumber\": \"AWB001\",
    \"estimatedArrivalDate\": \"2035-01-01\"
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/update/3'
payload = {
    "supplierName": "My Supplier",
    "awbNumber": "AWB001",
    "estimatedArrivalDate": "2035-01-01"
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('PUT', url, headers=headers, json=payload)
response.json()

Request      

PUT api/v1/connectors/client/receptionPlans/update/{receptionPlan_id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

receptionPlan_id   integer   

The ID of the receptionPlan. Example: 3

Body Parameters

supplierName   string  optional  

The reception plan supplier. Between 3 and 50 characters allowed. Example: My Supplier

awbNumber   string  optional  

The reception plan shipping AWB Number. Between 3 and 50 characters allowed. Example: AWB001

estimatedArrivalDate   date  optional  

The reception plan estimated arrival date. The date must later or equal to today. The format must be in: yyyy-mm-dd. Example: 2035-01-01

receptionSeries   string  optional  

The reception series. Between 1 and 50 characters allowed. Required when receptionNumber is present. The combination of receptionSeries and receptionNumber must be unique within your group.

receptionNumber   string  optional  

The reception number. Between 1 and 50 characters allowed. Required when receptionSeries is present. The combination of receptionSeries and receptionNumber must be unique within your group.

GET Reception Plan Imports

requires authentication

Get Reception Plan Imports by internal ID.

Throttling: Max 30 requests per minute. (30/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/byId/126/imports';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/byId/126/imports"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/byId/126/imports" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/byId/126/imports'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 30
x-ratelimit-remaining: 29
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/receptionPlans/byId/{receptionPlan_id}/imports

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

receptionPlan_id   integer   

The reception plan ID. Example: 126

GET Reception Plan Details

requires authentication

Get Reception Plan Details by internal ID.

Throttling: Max 15 requests per minute. (15/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/byId/126/details';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/byId/126/details"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/byId/126/details" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/byId/126/details'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 15
x-ratelimit-remaining: 14
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/receptionPlans/byId/{receptionPlan_id}/details

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

receptionPlan_id   integer   

The reception plan ID. Example: 126

GET Reception Plan Report By ID

requires authentication

Get Reception Plan report by internal ID.

Throttling: Max 15 requests per minute. (15/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/byId/126/report';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/byId/126/report"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/byId/126/report" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/byId/126/report'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 15
x-ratelimit-remaining: 14
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Example response (403):


{
    "message": "This action is unauthorized."
}
 

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for ReceptionPlan not found",
        "code": 404
    }
}
 

Request      

GET api/v1/connectors/client/receptionPlans/byId/{receptionPlan_id}/report

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

receptionPlan_id   integer   

The reception plan ID. Example: 126

FINISH Reception Plan

requires authentication

Finish Reception Plan

Throttling: Max 10 requests per minute. (10/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/byId//finish';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/byId//finish"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/byId//finish" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/byId//finish'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "success": false,
    "error": {
        "message": "Requested Endpoint not found",
        "code": 404
    }
}
 

Request      

GET api/v1/connectors/client/receptionPlans/byId/{receptionPlan_id}/finish

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

receptionPlan_id   integer   

The reception plan ID.

DELETE Reception Plan

requires authentication

Delete Reception Plan by internal id

Throttling: Max 10 requests per minute. (10/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/byId//delete';
$response = $client->delete(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/byId//delete"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
curl --request DELETE \
    "https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/byId//delete" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlans/byId//delete'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('DELETE', url, headers=headers)
response.json()

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for ReceptionPlan not found",
        "code": 404
    }
}
 

Request      

DELETE api/v1/connectors/client/receptionPlans/byId/{receptionPlan_id}/delete

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

receptionPlan_id   integer   

The Reception Plan ID.

API V1 - Reception Plan Imports

Reception Plan Import Endpoints

GET Reception Plan Details

requires authentication

Get Reception Plan Details by import ID.

Throttling: Max 15 requests per minute. (15/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlanImports/395/details';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/receptionPlanImports/395/details"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/receptionPlanImports/395/details" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlanImports/395/details'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 60
x-ratelimit-remaining: 59
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/receptionPlanImports/{receptionPlanImport_id}/details

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

receptionPlanImport_id   integer   

The reception plan import ID. Example: 395

CREATE Reception Plan Import

requires authentication

Create a new Reception Plan Import

Throttling: Max 10 requests per minute. (10/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlanImports/create/101';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'name' => 'TestImportPlan',
            'productIdentifierType' => 'barcode',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/receptionPlanImports/create/101"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "TestImportPlan",
    "productIdentifierType": "barcode"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "https://clients.metrica.bg/api/v1/connectors/client/receptionPlanImports/create/101" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"TestImportPlan\",
    \"productIdentifierType\": \"barcode\"
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlanImports/create/101'
payload = {
    "name": "TestImportPlan",
    "productIdentifierType": "barcode"
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Request      

POST api/v1/connectors/client/receptionPlanImports/create/{receptionPlan_id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

receptionPlan_id   integer   

The reception plan ID. Example: 101

Body Parameters

name   string   

The reception plan import name. Between 5 and 50 characters allowed. Example: TestImportPlan

productIdentifierType   required  optional  

enum(productCode,barcode,externalId,productId) The product identifier type necessary for correctly identifying the product when the reception plan detail is created. Example: barcode

FINISH Reception Plan Import

requires authentication

Finish Reception Plan Import

Throttling: Max 10 requests per minute. (10/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlanImports//finish';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/receptionPlanImports//finish"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/receptionPlanImports//finish" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlanImports//finish'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (404):

Show headers
cache-control: no-cache, private
content-type: application/json
access-control-allow-origin: *
 

{
    "success": false,
    "error": {
        "message": "Requested Endpoint not found",
        "code": 404
    }
}
 

Request      

GET api/v1/connectors/client/receptionPlanImports/{receptionPlanImport_id}/finish

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

receptionPlanImport_id   integer   

The reception plan import ID.

DELETE Reception Plan Import

requires authentication

Delete Reception Plan Import by internal id

Throttling: Max 10 requests per minute. (10/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlanImports/1/delete';
$response = $client->delete(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/receptionPlanImports/1/delete"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
curl --request DELETE \
    "https://clients.metrica.bg/api/v1/connectors/client/receptionPlanImports/1/delete" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlanImports/1/delete'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('DELETE', url, headers=headers)
response.json()

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for ReceptionPlanImport not found",
        "code": 404
    }
}
 

Request      

DELETE api/v1/connectors/client/receptionPlanImports/{receptionPlanImport_id}/delete

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

receptionPlanImport_id   integer   

The Reception Plan Import ID. Example: 1

API V1 - Reception Plan Details

Reception Plan Details Endpoints

CREATE Reception Plan Detail

requires authentication

Create a new Reception Plan Detail

Throttling: Max 100 requests per minute. (100/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlanDetails/create/1';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'productIdentifier' => 'BARCODE999',
            'externalId' => '1',
            'expiryDate' => '2050-01-01',
            'batch' => 0,
            'quantity' => 15,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/receptionPlanDetails/create/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "productIdentifier": "BARCODE999",
    "externalId": "1",
    "expiryDate": "2050-01-01",
    "batch": 0,
    "quantity": 15
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "https://clients.metrica.bg/api/v1/connectors/client/receptionPlanDetails/create/1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"productIdentifier\": \"BARCODE999\",
    \"externalId\": \"1\",
    \"expiryDate\": \"2050-01-01\",
    \"batch\": 0,
    \"quantity\": 15
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlanDetails/create/1'
payload = {
    "productIdentifier": "BARCODE999",
    "externalId": "1",
    "expiryDate": "2050-01-01",
    "batch": 0,
    "quantity": 15
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Request      

POST api/v1/connectors/client/receptionPlanDetails/create/{receptionPlanImport_id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

receptionPlanImport_id   integer   

The ID of the receptionPlanImport. Example: 1

receptionPlanImportId   integer   

The reception plan import ID. Example: 395

Body Parameters

productIdentifier   string   

The product identifier necessary for correctly identifying the product. Example: BARCODE999

externalId   string  optional  

The external id of the reception plan line. Example: 1

expiryDate   date  optional  

requiredIf The batch is present and filled. Prohibited for Normal products. Date format: Y-m-d. Example: 2050-01-01

batch   integer  optional  

requiredIf Only if identified product is a food product and the expiryDate is present and filled. Prohibited for Normal products. Example: 0

quantity   integer   

The product quantity. Example: 15

DELETE Reception Plan Detail

requires authentication

Delete Reception Plan Detail by internal id

Throttling: Max 60 requests per minute. (60/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlanDetails/1/delete';
$response = $client->delete(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/receptionPlanDetails/1/delete"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
curl --request DELETE \
    "https://clients.metrica.bg/api/v1/connectors/client/receptionPlanDetails/1/delete" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/receptionPlanDetails/1/delete'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('DELETE', url, headers=headers)
response.json()

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for ReceptionPlanDetail not found",
        "code": 404
    }
}
 

Request      

DELETE api/v1/connectors/client/receptionPlanDetails/{receptionPlanDetail_id}/delete

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

receptionPlanDetail_id   integer   

The Reception Plan Detail ID. Example: 1

API V1 - Stock

Stock Endpoints

GET All Products Stock By ID

requires authentication

List all products stock by ID.

Throttling: Max 1 request in 5 minutes. (1/5)

Presents all the results (NonPaginated).

This endpoint is recommended to use when there are more than 1000 products to display, because the paginated endpoint can show up to 1000 products per page.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/stock/allProducts/byProductId';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'untilDate' => '31/12/2020',
            'showNoStock' => 'yes',
            'showOnlyGoodProducts' => 'yes',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/stock/allProducts/byProductId"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "untilDate": "31\/12\/2020",
    "showNoStock": "yes",
    "showOnlyGoodProducts": "yes"
};

fetch(url, {
    method: "GET",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/stock/allProducts/byProductId" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"untilDate\": \"31\\/12\\/2020\",
    \"showNoStock\": \"yes\",
    \"showOnlyGoodProducts\": \"yes\"
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/stock/allProducts/byProductId'
payload = {
    "untilDate": "31\/12\/2020",
    "showNoStock": "yes",
    "showOnlyGoodProducts": "yes"
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers, json=payload)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 1
x-ratelimit-remaining: 0
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/stock/allProducts/byProductId

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

untilDate   date  optional  

If a date is provided the stock will be calculated until the given date (included). The allowed date format is dd/mm/yyyy. Example: 31/12/2020

showNoStock   string  optional  

If this field is set to "no" then only the products that have "stock" > 0 will be returned. This field accepts only 2 values : yes,no. Example: yes

showOnlyGoodProducts   string  optional  

If this field is set to "yes" then only the products with "damageType" equal to "GOOD" will be returned. This field accepts only 2 values : yes,no. Example: yes

GET All Products Stock Paginated By ID

requires authentication

List all products stock by ID.

Throttling: Max 5 requests per minute. (5/1)

Presents the result with page size and pagination.

Default page size : 1000 records per page.

This endpoint is recommended to use when there are less than 1000 products to display, because the first page can show up to 1000 products.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/stock/allProductsPaginated/byProductId';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'page' => '1',
        ],
        'json' => [
            'untilDate' => '31/12/2020',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/stock/allProductsPaginated/byProductId"
);

const params = {
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "untilDate": "31\/12\/2020"
};

fetch(url, {
    method: "GET",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/stock/allProductsPaginated/byProductId?page=1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"untilDate\": \"31\\/12\\/2020\"
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/stock/allProductsPaginated/byProductId'
payload = {
    "untilDate": "31\/12\/2020"
}
params = {
  'page': '1',
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers, json=payload, params=params)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 5
x-ratelimit-remaining: 4
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/stock/allProductsPaginated/byProductId

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

Which page to show. Example: 1

Body Parameters

untilDate   date  optional  

If a date is provided the stock will be calculated until the given date (included). The allowed date format is dd/mm/yyyy. Example: 31/12/2020

API V1 - Bundlers

A bundler is only a product with 'abilities'. Usually a bundler contains children and their children are also products.

The bundle bundler

The stock-parent bundler

Product Bundlers Endpoints

GET All Bundlers

requires authentication

List all product bundlers.

Presents the result with page size and pagination.

Throttling: Max 10 requests per minute. (10/1)

Default page size : 50 records per page.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/bundlers';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'page' => '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/bundlers"
);

const params = {
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/bundlers?page=1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/bundlers'
params = {
  'page': '1',
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers, params=params)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 10
x-ratelimit-remaining: 9
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/bundlers

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

Which page to show. Example: 1

CREATE Bundler

requires authentication

Create a new Bundler

Throttling: Max 10 requests per minute. (10/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/bundlers';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'bundlerType' => 'bundle',
            'bundlerProductId' => 10999,
            'bundlerProducts' => [
                [],
            ],
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/bundlers"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "bundlerType": "bundle",
    "bundlerProductId": 10999,
    "bundlerProducts": [
        []
    ]
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "https://clients.metrica.bg/api/v1/connectors/client/bundlers" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"bundlerType\": \"bundle\",
    \"bundlerProductId\": 10999,
    \"bundlerProducts\": [
        []
    ]
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/bundlers'
payload = {
    "bundlerType": "bundle",
    "bundlerProductId": 10999,
    "bundlerProducts": [
        []
    ]
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Request      

POST api/v1/connectors/client/bundlers

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

bundlerType   enum('bundle','stock-parent')   

The bundler type must be one of next possible values: bundle,stock-parent. Example: bundle

bundlerProductId   integer  optional  

The product (internal) ID. This product will be upgraded to a bundler. The value must be a positive integer. Example: 10999

bundlerProducts   object[]   

array of children products for the bundler

products   object  optional  
id   integer   

The product (internal) ID. The id must be unique(distinct) in the products object. Example: 184736

quantity   integer  optional  

requiredIf The product quantity. This field is required only if bundlerType is bundle. The value must be at least 1. Example: 3

priority   integer  optional  

requiredIf The product priority. This field is required only if bundlerType is stock-parent. The value must be at least 1. Example: 3

GET Bundler By ID

requires authentication

Get Bundler information by internal ID

Throttling: Max 40 requests per minute. (40/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/bundlers/1';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/bundlers/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/bundlers/1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/bundlers/1'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 40
x-ratelimit-remaining: 35
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for Product not found",
        "code": 404
    }
}
 

Request      

GET api/v1/connectors/client/bundlers/{idp}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

idp   integer   

Example: 1

id   integer   

The bundler ID. Example: 184742

DELETE Bundler By ID

requires authentication

Delete Bundler by internal id

Throttling: Max 40 requests per minute. (40/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/bundlers/1';
$response = $client->delete(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/bundlers/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
curl --request DELETE \
    "https://clients.metrica.bg/api/v1/connectors/client/bundlers/1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/bundlers/1'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('DELETE', url, headers=headers)
response.json()

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for Product not found",
        "code": 404
    }
}
 

Request      

DELETE api/v1/connectors/client/bundlers/{idp}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

idp   integer   

Example: 1

productId   integer   

The product ID.

GET Bundler By EAN

requires authentication

Get Bundler information by its EAN (barcode)

This endpoint will return the first product found with the given param value!

Throttling: Max 40 requests per minute. (40/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/bundlers/byEan/4971850911118';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/bundlers/byEan/4971850911118"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/bundlers/byEan/4971850911118" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/bundlers/byEan/4971850911118'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 40
x-ratelimit-remaining: 39
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for Product not found",
        "code": 404
    }
}
 

Request      

GET api/v1/connectors/client/bundlers/byEan/{ean}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

ean   string   

The bundler EAN. Example: 4971850911118

GET Bundler By External ID

requires authentication

Get Bundler information by its External ID

This endpoint will return the first product found with the given param value!

Throttling: Max 40 requests per minute. (40/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/bundlers/byExternalId/105';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/bundlers/byExternalId/105"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/bundlers/byExternalId/105" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/bundlers/byExternalId/105'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 40
x-ratelimit-remaining: 39
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for Product not found",
        "code": 404
    }
}
 

Request      

GET api/v1/connectors/client/bundlers/byExternalId/{externalId}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

externalId   string   

The bundler External ID. Example: 105

ADD Product to bundler

requires authentication

ADD a child product using the product internal ID to a bundler

Throttling: Max 10 requests per minute. (10/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/bundlers/1/addProduct';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'productId' => '184736',
            'productQuantity' => 3,
            'productPriority' => 3,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/bundlers/1/addProduct"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "productId": "184736",
    "productQuantity": 3,
    "productPriority": 3
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "https://clients.metrica.bg/api/v1/connectors/client/bundlers/1/addProduct" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"productId\": \"184736\",
    \"productQuantity\": 3,
    \"productPriority\": 3
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/bundlers/1/addProduct'
payload = {
    "productId": "184736",
    "productQuantity": 3,
    "productPriority": 3
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for Product not found",
        "code": 404
    }
}
 

Request      

POST api/v1/connectors/client/bundlers/{bundler_idp}/addProduct

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

bundler_idp   integer   

Example: 1

Body Parameters

productId   string   

The child product (internal) ID. Example: 184736

productQuantity   integer  optional  

requiredIf The child product quantity. This field is required only if the bundler type is bundle. The value must be at least 1. Example: 3

productPriority   integer  optional  

requiredIf The child product priority. This field is required only if the bundler type is stock-parent. The value must be at least 1. Example: 3

REMOVE Product from bundler

requires authentication

REMOVE a child product using the product internal ID from a bundler

Throttling: Max 10 requests per minute. (10/1)

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/bundlers/1/removeProduct';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'productId' => '184736',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/bundlers/1/removeProduct"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "productId": "184736"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "https://clients.metrica.bg/api/v1/connectors/client/bundlers/1/removeProduct" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"productId\": \"184736\"
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/bundlers/1/removeProduct'
payload = {
    "productId": "184736"
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Example response (404):


{
    "success": false,
    "error": {
        "message": "Entry for Product not found",
        "code": 404
    }
}
 

Request      

POST api/v1/connectors/client/bundlers/{bundler_idp}/removeProduct

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

bundler_idp   integer   

Example: 1

Body Parameters

productId   string   

The child product (internal) ID. Example: 184736

API V1 - Campaigns

List Campaigns

requires authentication

Retrieves a paginated list of all campaigns. Requires the campaigns:viewAll permission.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/campaigns';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'perPage' => '50',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/campaigns"
);

const params = {
    "perPage": "50",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/campaigns?perPage=50" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/campaigns'
params = {
  'perPage': '50',
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers, params=params)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 10
x-ratelimit-remaining: 9
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/campaigns

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

perPage   integer  optional  

The number of results to return per page. Defaults to 200. Example: 50

Create Campaign

requires authentication

Creates a new campaign entry. The name and externalCode must be unique. Requires the campaigns:create permission.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/campaigns/create';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'name' => '"The winter sale"',
            'externalCode' => '"the-winter-sale"',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/campaigns/create"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "\"The winter sale\"",
    "externalCode": "\"the-winter-sale\""
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "https://clients.metrica.bg/api/v1/connectors/client/campaigns/create" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"\\\"The winter sale\\\"\",
    \"externalCode\": \"\\\"the-winter-sale\\\"\"
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/campaigns/create'
payload = {
    "name": "\"The winter sale\"",
    "externalCode": "\"the-winter-sale\""
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Request      

POST api/v1/connectors/client/campaigns/create

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

name   string   

A unique name for the new campaign. Example: "The winter sale"

externalCode   string   

A unique external identifier for the campaign. Allows letters, numbers, hyphens, and underscores, but not at the start or end. Example: "the-winter-sale"

API V1 - Courier Status List

Courier Status List Endpoints

GET All Courier Statuses

requires authentication

List all internal courier statuses records.

Throttling: Max 1 request per hour. (1/60)

Information found on fields courierStatusId, status and statusLong come from couriers and might not be up-to-date.

isFinal has only two values: YES,NO. The AWB number/order that have a courier status id with isFinal = YES is considered final and will probably not be changed anymore.

We have knowledge on situations when couriers changed the status of a shipment even after they provided a final status!

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/couriers/statusList';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/couriers/statusList"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/couriers/statusList" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/couriers/statusList'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 1
x-ratelimit-remaining: 0
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/couriers/statusList

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

API V1 - Delete Event

Delete Event Endpoints

There are no delete event records BEFORE 23.05.2024!
The order delete event records are different from the other sources.

GET Deleted Events by CreatedAt Date

requires authentication

Returns a list with all deleted events filtered by the source and the provided date of creation.

Throttling: Max 20 requests per hour. (20/60)

Default page size : 250 records per page.

Presents the result with page size and pagination.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/deleteEvents/createdAtDate';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'page' => '1',
        ],
        'json' => [
            'source' => 'product',
            'date' => '2024-05-23',
            'perPage' => 100,
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/deleteEvents/createdAtDate"
);

const params = {
    "page": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "source": "product",
    "date": "2024-05-23",
    "perPage": 100
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "https://clients.metrica.bg/api/v1/connectors/client/deleteEvents/createdAtDate?page=1" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"source\": \"product\",
    \"date\": \"2024-05-23\",
    \"perPage\": 100
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/deleteEvents/createdAtDate'
payload = {
    "source": "product",
    "date": "2024-05-23",
    "perPage": 100
}
params = {
  'page': '1',
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers, json=payload, params=params)
response.json()

Request      

POST api/v1/connectors/client/deleteEvents/createdAtDate

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

page   integer  optional  

Which page to show. Example: 1

Body Parameters

source   string   

The source field accepts only the following values: product, entry, order. Example: product

date   date  optional  

The date must be today or older than today and not older than 2024-05-23. If not provided, the default is today. The format must be in: yyyy-mm-dd. Example: 2024-05-23

perPage   integer  optional  

Number of records to show per page. The allowed values are between 10 and 1000. If not provided, the default is 250. Example: 100

API V1 - Multi Stock

List Multi-Stocks

requires authentication

Retrieves a paginated list of all multi-stocks. Requires the stock:all and multiStock:viewAll permissions.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/multiStocks';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'query' => [
            'perPage' => '50',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/multiStocks"
);

const params = {
    "perPage": "50",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/multiStocks?perPage=50" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/multiStocks'
params = {
  'perPage': '50',
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers, params=params)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 10
x-ratelimit-remaining: 9
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/multiStocks

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Query Parameters

perPage   integer  optional  

The number of results to return per page. Defaults to 200. Example: 50

Create Multi-Stock

requires authentication

Creates a new multi-stock entry. The name and external_id must be unique. Requires the stock:all and multiStock:create permissions.

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/multiStocks/create';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'name' => '"Regional Warehouse"',
            'external_id' => '"REG_WH_123"',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/multiStocks/create"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "\"Regional Warehouse\"",
    "external_id": "\"REG_WH_123\""
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "https://clients.metrica.bg/api/v1/connectors/client/multiStocks/create" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"name\": \"\\\"Regional Warehouse\\\"\",
    \"external_id\": \"\\\"REG_WH_123\\\"\"
}"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/multiStocks/create'
payload = {
    "name": "\"Regional Warehouse\"",
    "external_id": "\"REG_WH_123\""
}
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers, json=payload)
response.json()

Request      

POST api/v1/connectors/client/multiStocks/create

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

name   string   

A unique name for the new multi-stock. Example: "Regional Warehouse"

external_id   string   

A unique external identifier for the multi-stock. Allows letters, numbers, hyphens, and underscores, but not at the start or end. Example: "REG_WH_123"

Endpoints

requires authentication

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/custom/products/search';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/custom/products/search"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
curl --request POST \
    "https://clients.metrica.bg/api/v1/connectors/client/custom/products/search" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/custom/products/search'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers)
response.json()

POST api/v1/connectors/client/custom/products/create

requires authentication

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/custom/products/create';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/custom/products/create"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
curl --request POST \
    "https://clients.metrica.bg/api/v1/connectors/client/custom/products/create" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/custom/products/create'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers)
response.json()

Request      

POST api/v1/connectors/client/custom/products/create

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

GET api/v1/connectors/client/custom/orders/byExternalId/{externalId}

requires authentication

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/custom/orders/byExternalId/recusandae';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/custom/orders/byExternalId/recusandae"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "https://clients.metrica.bg/api/v1/connectors/client/custom/orders/byExternalId/recusandae" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/custom/orders/byExternalId/recusandae'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('GET', url, headers=headers)
response.json()

Example response (401):

Show headers
cache-control: no-cache, private
content-type: application/json
x-ratelimit-limit: 30
x-ratelimit-remaining: 29
access-control-allow-origin: *
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/v1/connectors/client/custom/orders/byExternalId/{externalId}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

externalId   string   

Example: recusandae

POST api/v1/connectors/client/custom/orders/create

requires authentication

Example request:
$client = new \GuzzleHttp\Client();
$url = 'https://clients.metrica.bg/api/v1/connectors/client/custom/orders/create';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
    "https://clients.metrica.bg/api/v1/connectors/client/custom/orders/create"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
curl --request POST \
    "https://clients.metrica.bg/api/v1/connectors/client/custom/orders/create" \
    --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
import requests
import json

url = 'https://clients.metrica.bg/api/v1/connectors/client/custom/orders/create'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_TOKEN}',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

response = requests.request('POST', url, headers=headers)
response.json()

Request      

POST api/v1/connectors/client/custom/orders/create

Headers

Authorization      

Example: Bearer {YOUR_AUTH_TOKEN}

Content-Type      

Example: application/json

Accept      

Example: application/json