MENU navbar-image

Introduction

Authenticating requests

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

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

Для получения доступа к API необходимо отправить запрос вашему менеджеру Pac Group.

Endpoints

Получение токена доступа.

Example request:
curl --request POST \
    "https://apicontracts.pac.ru/api/login" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json" \
    --data "{
    \"email\": \"agent@domain.ru\",
    \"password\": \"12345678\"
}"
const url = new URL(
    "https://apicontracts.pac.ru/api/login"
);

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

let body = {
    "email": "agent@domain.ru",
    "password": "12345678"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://apicontracts.pac.ru/api/login';
$response = $client->post(
    $url,
    [
        'headers' => [
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
        'json' => [
            'email' => 'agent@domain.ru',
            'password' => '12345678',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json

url = 'https://apicontracts.pac.ru/api/login'
payload = {
    "email": "agent@domain.ru",
    "password": "12345678"
}
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

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

Example response (200):


{
    "data": {
        "token": "MHAN0H5RBBR1f0b260aZhbpwr1o197teMxEVS0aTnTE2fFWb",
        "expiresIn": null
    }
}
 

Request      

POST api/login

Headers

Content-Type      

Example: application/json

Accept      

Example: application/json

Body Parameters

email   string   

Email учетной записи. Поле value должно быть действительным email адресом. Поле value не должно быть длиннее 255 символов. Example: agent@domain.ru

password   string   

Пароль. Поле value должно быть не короче 6 символов. Example: 12345678

Запрос данных по договору

requires authentication

Example request:
curl --request GET \
    --get "https://apicontracts.pac.ru/api/contracts/POM41022AA" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --header "Accept: application/json"
const url = new URL(
    "https://apicontracts.pac.ru/api/contracts/POM41022AA"
);

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

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://apicontracts.pac.ru/api/contracts/POM41022AA';
$response = $client->get(
    $url,
    [
        'headers' => [
            'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
            'Content-Type' => 'application/json',
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json

url = 'https://apicontracts.pac.ru/api/contracts/POM41022AA'
headers = {
  'Authorization': 'Bearer {YOUR_AUTH_KEY}',
  '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
vary: Origin
 

{
    "message": "Unauthenticated."
}
 

Request      

GET api/contracts/{code}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Accept      

Example: application/json

URL Parameters

code   string   

Номер договора. Example: POM41022AA