Example for Contract

Contract ownership change

Let’s view transfer example for contract transfer.

Getting contract’s credentials

At first let’s get contract credentials:

Request

PATCH /api/2.5/contracts/2b264b733b7546749561d03ffa5e7971/credentials?acc_token=cb43a6ebac1af6a2f9f8bbbe823e917271caf0cc9675013f26478eeed8030605a96a6e856b34063dd1696510aced32e8c3d41448c2a395e5aa1bae4531fdbb6c HTTP/1.0
Authorization: Bearer brokerx
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua

{
  "data": ""
}

Response

HTTP/1.0 200 OK
Content-Type: application/json

{
  "data": {
    "awardID": "8481d7eb01694c25b18658036c236c5d",
    "contractID": "UA-2016-03-18-000001-1",
    "contractNumber": "contract #13111",
    "period": {
      "startDate": "2016-03-18T18:47:47.155143+02:00",
      "endDate": "2017-03-18T18:47:47.155143+02:00"
    },
    "value": {
      "amount": 238.0,
      "currency": "UAH",
      "valueAddedTaxIncluded": true,
      "amountNet": 237.0
    },
    "items": [
      {
        "id": "c6c6e8ed4b1542e4bf13d3f98ec5ab59",
        "description": "футляри до державних нагород",
        "quantity": 5.0,
        "classification": {
          "description": "Cartons",
          "scheme": "CPV",
          "id": "44617100-9"
        },
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "17.21.1",
            "description": "папір і картон гофровані, паперова й картонна тара"
          }
        ],
        "unit": {
          "name": "кг",
          "value": {
            "amount": 20.8,
            "currency": "UAH",
            "valueAddedTaxIncluded": true
          },
          "code": "KGM"
        },
        "deliveryAddress": {
          "streetAddress": "вул. Банкова 1",
          "locality": "м. Київ",
          "region": "м. Київ",
          "postalCode": "79000",
          "countryName": "Україна"
        },
        "deliveryDate": {
          "startDate": "2016-03-20T18:47:47.136678+02:00",
          "endDate": "2016-03-23T18:47:47.136678+02:00"
        }
      }
    ],
    "suppliers": [
      {
        "name": "ДКП «Книга»",
        "identifier": {
          "scheme": "UA-EDR",
          "id": "00137226",
          "uri": "http://www.sc.gov.ua/"
        },
        "address": {
          "streetAddress": "вул. Островського, 34",
          "locality": "м. Львів",
          "region": "Львівська область",
          "postalCode": "79013",
          "countryName": "Україна"
        },
        "contactPoint": {
          "name": "Андрій Олексюк",
          "email": "aagt@gmail.com",
          "telephone": "+380322916930"
        }
      }
    ],
    "owner": "brokerx",
    "tender_id": "232024f88849442aae6b031afd11a28b",
    "status": "active",
    "dateSigned": "2023-10-10T01:00:00+03:00",
    "procuringEntity": {
      "name": "Державне управління справами",
      "identifier": {
        "scheme": "UA-EDR",
        "id": "00037256",
        "uri": "http://www.dus.gov.ua/"
      },
      "address": {
        "streetAddress": "вул. Банкова, 11, корпус 1",
        "locality": "м. Київ",
        "region": "м. Київ",
        "postalCode": "01220",
        "countryName": "Україна"
      },
      "contactPoint": {
        "name": "Державне управління справами",
        "telephone": "+0440000000"
      }
    },
    "dateCreated": "2023-10-10T01:00:00+03:00",
    "dateModified": "2023-10-10T01:00:00+03:00",
    "id": "2b264b733b7546749561d03ffa5e7971"
  },
  "config": {
    "restricted": false
  },
  "access": {
    "token": "8d19b16d50724c8ea5cc3c9dcede3832",
    "transfer": "97d050219a734eb791b1fee00b50d095"
  }
}

broker is current contract’s owner.

Note that response’s access section contains a transfer key which is used to change tender ownership.

After contract’s credentials obtaining broker has to provide its customer with transfer key.

Transfer creation

First of all, you must know ID of the contract that you want to transfer.

Broker that is going to become new contract owner should create a Transfer.

Request

POST /api/2.5/transfers HTTP/1.0
Authorization: Bearer broker3
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua

{
  "data": {}
}

Response

HTTP/1.0 201 Created
Content-Type: application/json

{
  "data": {
    "date": "2023-10-10T01:00:00+03:00",
    "id": "0a30abb09f71439fa89d9a4c5bb50ea4"
  },
  "access": {
    "token": "08f1d49be1284d93b4a95928f9028b33",
    "transfer": "9763efce634449088e1683021b9db077"
  }
}

Transfer object contains new access token and new transfer token for the object that will be transferred to new broker.

Changing contract’s owner

An ability to change contract’s ownership depends on contract’s status:

Allowed

Not Allowed

active

pending

terminated

cancelled

In order to change contract’s ownership new broker should send POST request to appropriate /contracts/id/ with data section containing id of Transfer and transfer token received from customer:

Request

POST /api/2.5/contracts/2b264b733b7546749561d03ffa5e7971/ownership HTTP/1.0
Authorization: Bearer broker3
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua

{
  "data": {
    "id": "0a30abb09f71439fa89d9a4c5bb50ea4",
    "transfer": "97d050219a734eb791b1fee00b50d095"
  }
}

Response

HTTP/1.0 200 OK
Content-Type: application/json

{
  "data": {
    "owner": "broker3",
    "id": "2b264b733b7546749561d03ffa5e7971"
  }
}

Updated owner value indicates that ownership is successfully changed.

Note that new broker has to provide its customer with new transfer key (generated in Transfer object).

After Transfer is applied it stores contract path in usedFor property.

Request

GET /api/2.5/transfers/0a30abb09f71439fa89d9a4c5bb50ea4 HTTP/1.0
Authorization: Bearer broker3
Host: public-api-sandbox.prozorro.gov.ua

Response

HTTP/1.0 200 OK
Content-Type: application/json

{
  "data": {
    "date": "2023-10-10T01:00:00+03:00",
    "usedFor": "/contracts/2b264b733b7546749561d03ffa5e7971",
    "id": "0a30abb09f71439fa89d9a4c5bb50ea4"
  }
}

Let’s try to change the contract using token received on Transfer creation:

Request

PATCH /api/2.5/contracts/2b264b733b7546749561d03ffa5e7971?acc_token=08f1d49be1284d93b4a95928f9028b33 HTTP/1.0
Authorization: Bearer broker3
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua

{
  "data": {
    "description": "broker3 now can change the contract"
  }
}

Response

HTTP/1.0 200 OK
Content-Type: application/json

{
  "data": {
    "awardID": "8481d7eb01694c25b18658036c236c5d",
    "contractID": "UA-2016-03-18-000001-1",
    "contractNumber": "contract #13111",
    "description": "broker3 now can change the contract",
    "dateSigned": "2023-10-10T01:00:00+03:00",
    "dateModified": "2023-10-10T01:00:00+03:00",
    "dateCreated": "2023-10-10T01:00:00+03:00",
    "items": [
      {
        "id": "c6c6e8ed4b1542e4bf13d3f98ec5ab59",
        "description": "футляри до державних нагород",
        "quantity": 5.0,
        "classification": {
          "description": "Cartons",
          "scheme": "CPV",
          "id": "44617100-9"
        },
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "17.21.1",
            "description": "папір і картон гофровані, паперова й картонна тара"
          }
        ],
        "unit": {
          "name": "кг",
          "value": {
            "amount": 20.8,
            "currency": "UAH",
            "valueAddedTaxIncluded": true
          },
          "code": "KGM"
        },
        "deliveryAddress": {
          "streetAddress": "вул. Банкова 1",
          "locality": "м. Київ",
          "region": "м. Київ",
          "postalCode": "79000",
          "countryName": "Україна"
        },
        "deliveryDate": {
          "startDate": "2016-03-20T18:47:47.136678+02:00",
          "endDate": "2016-03-23T18:47:47.136678+02:00"
        }
      }
    ],
    "tender_id": "232024f88849442aae6b031afd11a28b",
    "owner": "broker3",
    "status": "active",
    "period": {
      "startDate": "2016-03-18T18:47:47.155143+02:00",
      "endDate": "2017-03-18T18:47:47.155143+02:00"
    },
    "suppliers": [
      {
        "name": "ДКП «Книга»",
        "identifier": {
          "scheme": "UA-EDR",
          "id": "00137226",
          "uri": "http://www.sc.gov.ua/"
        },
        "address": {
          "streetAddress": "вул. Островського, 34",
          "locality": "м. Львів",
          "region": "Львівська область",
          "postalCode": "79013",
          "countryName": "Україна"
        },
        "contactPoint": {
          "name": "Андрій Олексюк",
          "email": "aagt@gmail.com",
          "telephone": "+380322916930"
        }
      }
    ],
    "value": {
      "amount": 238.0,
      "currency": "UAH",
      "valueAddedTaxIncluded": true,
      "amountNet": 237.0
    },
    "procuringEntity": {
      "name": "Державне управління справами",
      "identifier": {
        "scheme": "UA-EDR",
        "id": "00037256",
        "uri": "http://www.dus.gov.ua/"
      },
      "address": {
        "streetAddress": "вул. Банкова, 11, корпус 1",
        "locality": "м. Київ",
        "region": "м. Київ",
        "postalCode": "01220",
        "countryName": "Україна"
      },
      "contactPoint": {
        "name": "Державне управління справами",
        "telephone": "+0440000000"
      }
    },
    "id": "2b264b733b7546749561d03ffa5e7971"
  },
  "config": {
    "restricted": false
  }
}

Pay attention that only broker with appropriate accreditation level can become new owner. Otherwise broker will be forbidden from this action.

Request

POST /api/2.5/contracts/2b264b733b7546749561d03ffa5e7971/ownership HTTP/1.0
Authorization: Bearer broker2
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua

{
  "data": {
    "id": "1a24daa0b7ff4c3aa2a7e9986dc0fba2",
    "transfer": "97d050219a734eb791b1fee00b50d095"
  }
}

Response

HTTP/1.0 403 Forbidden
Content-Type: application/json

{
  "status": "error",
  "errors": [
    {
      "location": "url",
      "name": "accreditation",
      "description": "Broker Accreditation level does not permit ownership change"
    }
  ]
}

Also ownership change is allowed only if current owner has a special accreditation level that allows ownership change:

Request

POST /api/2.5/contracts/2b264b733b7546749561d03ffa5e7971/ownership HTTP/1.0
Authorization: Bearer brokerx
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua

{
  "data": {
    "id": "b0ad624db0924215957296c3c371e069",
    "transfer": "97d050219a734eb791b1fee00b50d095"
  }
}

Response

HTTP/1.0 403 Forbidden
Content-Type: application/json

{
  "status": "error",
  "errors": [
    {
      "location": "url",
      "name": "accreditation",
      "description": "Owner Accreditation level does not permit ownership change"
    }
  ]
}