Example for Agreement

Agreement ownership change

Let’s view transfer example for agreement transfer.

Getting agreement’s credentials

At first let’s get agreement credentials:

Request

PATCH /api/2.5/agreements/5f2c362583984e0daed42cb21777cee3/credentials?acc_token=66c2955323508410df20289d70d5a479b575f6a04753c0345c58d2ea246cebb8223b7085ab9577fcd74d553eb4e997da9cf761aa0387348f3bdc98d8eeae60cf 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": {
    "agreementID": "UA-2018-07-30-000001-afe4b1ed046845bcae5d675b0b8ca5aa1",
    "status": "active",
    "owner": "brokerx",
    "dateSigned": "2023-10-10T01:00:00+03:00",
    "contracts": [
      {
        "id": "d6cd8c3188d74e1481a9cebb57fd9329",
        "status": "active",
        "suppliers": [
          {
            "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"
            }
          }
        ],
        "unitPrices": [
          {
            "relatedItem": "1662b0e1d59f4e2f8e2c5bd48e03a7bc",
            "value": {
              "currency": "UAH",
              "valueAddedTaxIncluded": true,
              "amount": 100.0
            }
          }
        ],
        "awardID": "d7406b07c05b4796bb168a7c47ee7d31",
        "bidID": "0a292b6466274139ad3d973fd64830ff",
        "date": "2018-07-30T17:40:15.471158+03:00"
      },
      {
        "id": "c8ef8c0d1cb74528b13335a623225762",
        "status": "active",
        "suppliers": [
          {
            "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"
            }
          }
        ],
        "unitPrices": [
          {
            "relatedItem": "1662b0e1d59f4e2f8e2c5bd48e03a7bc",
            "value": {
              "currency": "UAH",
              "valueAddedTaxIncluded": true,
              "amount": 100.0
            }
          }
        ],
        "awardID": "cdb6da320600480d8eaabd8eaa920872",
        "bidID": "d85ef51272f14087abb2eed535340493",
        "date": "2018-07-30T17:40:15.471207+03:00"
      },
      {
        "id": "d925d6c6124447d581f2ae5f52ba710f",
        "status": "active",
        "suppliers": [
          {
            "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"
            }
          }
        ],
        "unitPrices": [
          {
            "relatedItem": "1662b0e1d59f4e2f8e2c5bd48e03a7bc",
            "value": {
              "currency": "UAH",
              "valueAddedTaxIncluded": true,
              "amount": 100.0
            }
          }
        ],
        "awardID": "a915a07f7f0b4dafa583cce119bf1823",
        "bidID": "fc02090c338a477f8013156a4fa2da10",
        "date": "2018-07-30T17:40:15.471264+03:00"
      }
    ],
    "items": [
      {
        "id": "1662b0e1d59f4e2f8e2c5bd48e03a7bc",
        "description": "футляри до державних нагород",
        "quantity": 5.0,
        "classification": {
          "description": "Cartons",
          "scheme": "ДК021",
          "id": "44617100-9"
        },
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "17.21.1",
            "description": "папір і картон гофровані, паперова й картонна тара"
          }
        ],
        "description_en": "Cases for state awards",
        "deliveryDate": {
          "startDate": "2018-06-27T13:39:09.362837+03:00",
          "endDate": "2018-06-30T13:39:09.362837+03:00"
        },
        "deliveryAddress": {
          "streetAddress": "вул. Банкова 1",
          "locality": "м. Київ",
          "region": "м. Київ",
          "postalCode": "79000",
          "countryName": "Україна"
        },
        "unit": {
          "name": "item",
          "code": "KGM"
        }
      }
    ],
    "procuringEntity": {
      "name": "Державне управління справами",
      "name_en": "State administration",
      "identifier": {
        "scheme": "UA-EDR",
        "id": "00037256",
        "legalName_en": "dus.gov.ua",
        "uri": "http://www.dus.gov.ua/"
      },
      "kind": "general",
      "contactPoint": {
        "name": "Державне управління справами",
        "name_en": "State administration",
        "telephone": "+0440000000",
        "availableLanguage": "uk"
      },
      "address": {
        "streetAddress": "вул. Банкова, 11, корпус 1",
        "locality": "м. Київ",
        "region": "м. Київ",
        "postalCode": "01220",
        "countryName": "Україна"
      }
    },
    "tender_id": "f394ae7a792e404c96103b00547a61d5",
    "numberOfContracts": 3,
    "dateModified": "2023-10-10T01:00:00+03:00",
    "id": "5f2c362583984e0daed42cb21777cee3"
  },
  "access": {
    "token": "bf503973a9634f818cac36375fca970d",
    "transfer": "500a8aa113a8452abc838adf2114f767"
  }
}

broker is current agreement’s owner.

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

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

Transfer creation

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

Broker that is going to become new agreement 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": "b2cfd3fb7ec34750afd9c66d4d214596"
  },
  "access": {
    "token": "5dd784d6228c4abb9d509c3d86c604ca",
    "transfer": "ac8fe7e20bac48f1b43ac294f28f6148"
  }
}

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

Changing agreement’s owner

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

Allowed

Not Allowed

active

pending

terminated

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

Request

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

{
  "data": {
    "id": "b2cfd3fb7ec34750afd9c66d4d214596",
    "transfer": "500a8aa113a8452abc838adf2114f767"
  }
}

Response

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

{
  "data": {
    "owner": "broker3",
    "id": "5f2c362583984e0daed42cb21777cee3"
  }
}

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 agreement path in usedFor property.

Request

GET /api/2.5/transfers/b2cfd3fb7ec34750afd9c66d4d214596 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": "/agreements/5f2c362583984e0daed42cb21777cee3",
    "id": "b2cfd3fb7ec34750afd9c66d4d214596"
  }
}

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

Request

PATCH /api/2.5/agreements/5f2c362583984e0daed42cb21777cee3?acc_token=5dd784d6228c4abb9d509c3d86c604ca HTTP/1.0
Authorization: Bearer broker3
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua

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

Response

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

{
  "data": {
    "agreementID": "UA-2018-07-30-000001-afe4b1ed046845bcae5d675b0b8ca5aa1",
    "status": "active",
    "dateModified": "2023-10-10T01:00:00+03:00",
    "owner": "broker3",
    "dateSigned": "2023-10-10T01:00:00+03:00",
    "contracts": [
      {
        "id": "d6cd8c3188d74e1481a9cebb57fd9329",
        "status": "active",
        "suppliers": [
          {
            "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"
            }
          }
        ],
        "unitPrices": [
          {
            "relatedItem": "1662b0e1d59f4e2f8e2c5bd48e03a7bc",
            "value": {
              "currency": "UAH",
              "valueAddedTaxIncluded": true,
              "amount": 100.0
            }
          }
        ],
        "awardID": "d7406b07c05b4796bb168a7c47ee7d31",
        "bidID": "0a292b6466274139ad3d973fd64830ff",
        "date": "2018-07-30T17:40:15.471158+03:00"
      },
      {
        "id": "c8ef8c0d1cb74528b13335a623225762",
        "status": "active",
        "suppliers": [
          {
            "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"
            }
          }
        ],
        "unitPrices": [
          {
            "relatedItem": "1662b0e1d59f4e2f8e2c5bd48e03a7bc",
            "value": {
              "currency": "UAH",
              "valueAddedTaxIncluded": true,
              "amount": 100.0
            }
          }
        ],
        "awardID": "cdb6da320600480d8eaabd8eaa920872",
        "bidID": "d85ef51272f14087abb2eed535340493",
        "date": "2018-07-30T17:40:15.471207+03:00"
      },
      {
        "id": "d925d6c6124447d581f2ae5f52ba710f",
        "status": "active",
        "suppliers": [
          {
            "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"
            }
          }
        ],
        "unitPrices": [
          {
            "relatedItem": "1662b0e1d59f4e2f8e2c5bd48e03a7bc",
            "value": {
              "currency": "UAH",
              "valueAddedTaxIncluded": true,
              "amount": 100.0
            }
          }
        ],
        "awardID": "a915a07f7f0b4dafa583cce119bf1823",
        "bidID": "fc02090c338a477f8013156a4fa2da10",
        "date": "2018-07-30T17:40:15.471264+03:00"
      }
    ],
    "items": [
      {
        "id": "1662b0e1d59f4e2f8e2c5bd48e03a7bc",
        "description": "футляри до державних нагород",
        "quantity": 5.0,
        "classification": {
          "description": "Cartons",
          "scheme": "ДК021",
          "id": "44617100-9"
        },
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "17.21.1",
            "description": "папір і картон гофровані, паперова й картонна тара"
          }
        ],
        "description_en": "Cases for state awards",
        "deliveryDate": {
          "startDate": "2018-06-27T13:39:09.362837+03:00",
          "endDate": "2018-06-30T13:39:09.362837+03:00"
        },
        "deliveryAddress": {
          "streetAddress": "вул. Банкова 1",
          "locality": "м. Київ",
          "region": "м. Київ",
          "postalCode": "79000",
          "countryName": "Україна"
        },
        "unit": {
          "name": "item",
          "code": "KGM"
        }
      }
    ],
    "procuringEntity": {
      "name": "Державне управління справами",
      "name_en": "State administration",
      "identifier": {
        "scheme": "UA-EDR",
        "id": "00037256",
        "legalName_en": "dus.gov.ua",
        "uri": "http://www.dus.gov.ua/"
      },
      "kind": "general",
      "contactPoint": {
        "name": "Державне управління справами",
        "name_en": "State administration",
        "telephone": "+0440000000",
        "availableLanguage": "uk"
      },
      "address": {
        "streetAddress": "вул. Банкова, 11, корпус 1",
        "locality": "м. Київ",
        "region": "м. Київ",
        "postalCode": "01220",
        "countryName": "Україна"
      }
    },
    "terminationDetails": "broker3 now can change the contract",
    "tender_id": "f394ae7a792e404c96103b00547a61d5",
    "numberOfContracts": 3,
    "id": "5f2c362583984e0daed42cb21777cee3"
  },
  "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/agreements/5f2c362583984e0daed42cb21777cee3/ownership HTTP/1.0
Authorization: Bearer broker2
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua

{
  "data": {
    "id": "feebea6be33048f1a8bcaa94affe3c4d",
    "transfer": "500a8aa113a8452abc838adf2114f767"
  }
}

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/agreements/5f2c362583984e0daed42cb21777cee3/ownership HTTP/1.0
Authorization: Bearer brokerx
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua

{
  "data": {
    "id": "456f0eb8ebec428c8e0491d7757ba327",
    "transfer": "500a8aa113a8452abc838adf2114f767"
  }
}

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"
    }
  ]
}