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:

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": ""
}
HTTP/1.0 200 OK
Content-Type: application/json
{
  "data": {
    "agreementID": "UA-2018-07-30-000001-afe4b1ed046845bcae5d675b0b8ca5aa1",
    "status": "active",
    "owner": "brokerx",
    "agreementType": "closeFrameworkAgreementUA",
    "dateSigned": "2027-01-01T00:00:00+02: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": "папір і картон гофровані, паперова й картонна тара"
          }
        ],
        "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"
        },
        "description_en": "Cases for state awards"
      }
    ],
    "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": "2027-01-01T00:00:00+02: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.

POST /api/2.5/transfers HTTP/1.0
Authorization: Bearer broker3
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua
{
  "data": {}
}
HTTP/1.0 201 Created
Content-Type: application/json
{
  "data": {
    "date": "2027-01-01T00:00:00+02:00",
    "id": "59368bd55b0e4fa8bb72b64fd3738e5d"
  },
  "access": {
    "token": "29e661cc1116414289c4b63b0c2cb035",
    "transfer": "489ce11cb49e46d29ea2517b0e790ba1"
  }
}

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

Agreement ownership change

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:

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": "59368bd55b0e4fa8bb72b64fd3738e5d",
    "transfer": "500a8aa113a8452abc838adf2114f767"
  }
}
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.

GET /api/2.5/transfers/59368bd55b0e4fa8bb72b64fd3738e5d HTTP/1.0
Authorization: Bearer broker3
Host: public-api-sandbox.prozorro.gov.ua
HTTP/1.0 200 OK
Content-Type: application/json
{
  "data": {
    "date": "2027-01-01T00:00:00+02:00",
    "usedFor": "/agreements/5f2c362583984e0daed42cb21777cee3",
    "id": "59368bd55b0e4fa8bb72b64fd3738e5d"
  }
}

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

PATCH /api/2.5/agreements/5f2c362583984e0daed42cb21777cee3?acc_token=29e661cc1116414289c4b63b0c2cb035 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"
  }
}
HTTP/1.0 200 OK
Content-Type: application/json
{
  "data": {
    "agreementID": "UA-2018-07-30-000001-afe4b1ed046845bcae5d675b0b8ca5aa1",
    "status": "active",
    "terminationDetails": "broker3 now can change the contract",
    "dateModified": "2027-01-01T00:00:00+02:00",
    "owner": "broker3",
    "agreementType": "closeFrameworkAgreementUA",
    "dateSigned": "2027-01-01T00:00:00+02: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": "папір і картон гофровані, паперова й картонна тара"
          }
        ],
        "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"
        },
        "description_en": "Cases for state awards"
      }
    ],
    "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,
    "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.

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": "147a9819b3634c9e944c5c8e71518913",
    "transfer": "500a8aa113a8452abc838adf2114f767"
  }
}
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:

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": "3c5754cf47fb4e75b0331206865fd09c",
    "transfer": "500a8aa113a8452abc838adf2114f767"
  }
}
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"
    }
  ]
}