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/35990a4bc5c748a68bd8970a17f938de/credentials?acc_token=d068d30365f24b19e584c996e06cd22211268032021e7311ac9bf4c2a91485eaad238a69aad469f86981e3409ba4ce6338feb8ca15c3334e65fbab10e76e518a HTTP/1.0
Authorization: Bearer broker
Content-Length: 12
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua
DATA:
{
  "data": ""
}

Response: 200 OK
Content-Type: application/json; charset=UTF-8
{
  "access": {
    "transfer": "ce149419ccc3449386198315c53bdb16",
    "token": "755fff689f7442f49f682219d78caf6a"
  },
  "data": {
    "agreementID": "UA-2018-07-30-000001-afe4b1ed046845bcae5d675b0b8ca5aa1",
    "status": "active",
    "contracts": [
      {
        "status": "active",
        "unitPrices": [
          {
            "value": {
              "currency": "UAH",
              "amount": 100.0,
              "valueAddedTaxIncluded": true
            },
            "relatedItem": "1662b0e1d59f4e2f8e2c5bd48e03a7bc"
          }
        ],
        "suppliers": [
          {
            "contactPoint": {
              "name": "Державне управління справами",
              "telephone": "0440000000"
            },
            "identifier": {
              "scheme": "UA-EDR",
              "id": "00037256",
              "uri": "http://www.dus.gov.ua/"
            },
            "name": "Державне управління справами",
            "address": {
              "postalCode": "01220",
              "countryName": "Україна",
              "streetAddress": "вул. Банкова, 11, корпус 1",
              "region": "м. Київ",
              "locality": "м. Київ"
            }
          }
        ],
        "bidID": "0a292b6466274139ad3d973fd64830ff",
        "date": "2018-07-30T17:40:15.471158+03:00",
        "awardID": "d7406b07c05b4796bb168a7c47ee7d31",
        "id": "d6cd8c3188d74e1481a9cebb57fd9329"
      },
      {
        "status": "active",
        "unitPrices": [
          {
            "value": {
              "currency": "UAH",
              "amount": 100.0,
              "valueAddedTaxIncluded": true
            },
            "relatedItem": "1662b0e1d59f4e2f8e2c5bd48e03a7bc"
          }
        ],
        "suppliers": [
          {
            "contactPoint": {
              "name": "Державне управління справами",
              "telephone": "0440000000"
            },
            "identifier": {
              "scheme": "UA-EDR",
              "id": "00037256",
              "uri": "http://www.dus.gov.ua/"
            },
            "name": "Державне управління справами",
            "address": {
              "postalCode": "01220",
              "countryName": "Україна",
              "streetAddress": "вул. Банкова, 11, корпус 1",
              "region": "м. Київ",
              "locality": "м. Київ"
            }
          }
        ],
        "bidID": "d85ef51272f14087abb2eed535340493",
        "date": "2018-07-30T17:40:15.471207+03:00",
        "awardID": "cdb6da320600480d8eaabd8eaa920872",
        "id": "c8ef8c0d1cb74528b13335a623225762"
      },
      {
        "status": "active",
        "unitPrices": [
          {
            "value": {
              "currency": "UAH",
              "amount": 100.0,
              "valueAddedTaxIncluded": true
            },
            "relatedItem": "1662b0e1d59f4e2f8e2c5bd48e03a7bc"
          }
        ],
        "suppliers": [
          {
            "contactPoint": {
              "name": "Державне управління справами",
              "telephone": "0440000000"
            },
            "identifier": {
              "scheme": "UA-EDR",
              "id": "00037256",
              "uri": "http://www.dus.gov.ua/"
            },
            "name": "Державне управління справами",
            "address": {
              "postalCode": "01220",
              "countryName": "Україна",
              "streetAddress": "вул. Банкова, 11, корпус 1",
              "region": "м. Київ",
              "locality": "м. Київ"
            }
          }
        ],
        "bidID": "fc02090c338a477f8013156a4fa2da10",
        "date": "2018-07-30T17:40:15.471264+03:00",
        "awardID": "a915a07f7f0b4dafa583cce119bf1823",
        "id": "d925d6c6124447d581f2ae5f52ba710f"
      }
    ],
    "items": [
      {
        "description": "футляри до державних нагород",
        "classification": {
          "scheme": "ДК021",
          "description": "Cartons",
          "id": "44617100-9"
        },
        "description_en": "Cases for state awards",
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "17.21.1",
            "description": "папір і картон гофровані, паперова й картонна тара"
          }
        ],
        "deliveryAddress": {
          "postalCode": "79000",
          "countryName": "Україна",
          "streetAddress": "вул. Банкова 1",
          "region": "м. Київ",
          "locality": "м. Київ"
        },
        "deliveryDate": {
          "startDate": "2018-06-27T13:39:09.362837+03:00",
          "endDate": "2018-06-30T13:39:09.362837+03:00"
        },
        "id": "1662b0e1d59f4e2f8e2c5bd48e03a7bc",
        "unit": {
          "code": "44617100-9",
          "name": "item"
        },
        "quantity": 5.0
      }
    ],
    "dateSigned": "2019-10-25T01:00:00+03:00",
    "id": "35990a4bc5c748a68bd8970a17f938de",
    "numberOfContracts": 3,
    "procuringEntity": {
      "kind": "general",
      "name": "Державне управління справами",
      "address": {
        "postalCode": "01220",
        "countryName": "Україна",
        "streetAddress": "вул. Банкова, 11, корпус 1",
        "region": "м. Київ",
        "locality": "м. Київ"
      },
      "contactPoint": {
        "name_en": "State administration",
        "name": "Державне управління справами",
        "availableLanguage": "uk",
        "telephone": "0440000000"
      },
      "identifier": {
        "scheme": "UA-EDR",
        "legalName_en": "dus.gov.ua",
        "id": "00037256",
        "uri": "http://www.dus.gov.ua/"
      },
      "name_en": "State administration"
    },
    "owner": "broker",
    "dateModified": "2019-10-25T01:00:00+03:00",
    "tender_id": "f0dce4b8a8954b28ba318663bb91b15b"
  }
}

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-Length: 12
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua
DATA:
{
  "data": {}
}

Response: 201 Created
Content-Type: application/json; charset=UTF-8
{
  "access": {
    "transfer": "0ec61677f28746f0af757f537f541b4a",
    "token": "575f3322f20549bcba96cb63f59a96c3"
  },
  "data": {
    "date": "2019-10-25T01:00:00+03:00",
    "id": "e12304edbbb945618010929a159d473b"
  }
}

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:

POST /api/2.5/agreements/35990a4bc5c748a68bd8970a17f938de/ownership HTTP/1.0
Authorization: Bearer broker3
Content-Length: 100
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua
DATA:
{
  "data": {
    "transfer": "ce149419ccc3449386198315c53bdb16",
    "id": "e12304edbbb945618010929a159d473b"
  }
}

Response: 200 OK
Content-Type: application/json; charset=UTF-8
{
  "data": {
    "agreementID": "UA-2018-07-30-000001-afe4b1ed046845bcae5d675b0b8ca5aa1",
    "status": "active",
    "contracts": [
      {
        "status": "active",
        "unitPrices": [
          {
            "value": {
              "currency": "UAH",
              "amount": 100.0,
              "valueAddedTaxIncluded": true
            },
            "relatedItem": "1662b0e1d59f4e2f8e2c5bd48e03a7bc"
          }
        ],
        "suppliers": [
          {
            "contactPoint": {
              "name": "Державне управління справами",
              "telephone": "0440000000"
            },
            "identifier": {
              "scheme": "UA-EDR",
              "id": "00037256",
              "uri": "http://www.dus.gov.ua/"
            },
            "name": "Державне управління справами",
            "address": {
              "postalCode": "01220",
              "countryName": "Україна",
              "streetAddress": "вул. Банкова, 11, корпус 1",
              "region": "м. Київ",
              "locality": "м. Київ"
            }
          }
        ],
        "bidID": "0a292b6466274139ad3d973fd64830ff",
        "date": "2018-07-30T17:40:15.471158+03:00",
        "awardID": "d7406b07c05b4796bb168a7c47ee7d31",
        "id": "d6cd8c3188d74e1481a9cebb57fd9329"
      },
      {
        "status": "active",
        "unitPrices": [
          {
            "value": {
              "currency": "UAH",
              "amount": 100.0,
              "valueAddedTaxIncluded": true
            },
            "relatedItem": "1662b0e1d59f4e2f8e2c5bd48e03a7bc"
          }
        ],
        "suppliers": [
          {
            "contactPoint": {
              "name": "Державне управління справами",
              "telephone": "0440000000"
            },
            "identifier": {
              "scheme": "UA-EDR",
              "id": "00037256",
              "uri": "http://www.dus.gov.ua/"
            },
            "name": "Державне управління справами",
            "address": {
              "postalCode": "01220",
              "countryName": "Україна",
              "streetAddress": "вул. Банкова, 11, корпус 1",
              "region": "м. Київ",
              "locality": "м. Київ"
            }
          }
        ],
        "bidID": "d85ef51272f14087abb2eed535340493",
        "date": "2018-07-30T17:40:15.471207+03:00",
        "awardID": "cdb6da320600480d8eaabd8eaa920872",
        "id": "c8ef8c0d1cb74528b13335a623225762"
      },
      {
        "status": "active",
        "unitPrices": [
          {
            "value": {
              "currency": "UAH",
              "amount": 100.0,
              "valueAddedTaxIncluded": true
            },
            "relatedItem": "1662b0e1d59f4e2f8e2c5bd48e03a7bc"
          }
        ],
        "suppliers": [
          {
            "contactPoint": {
              "name": "Державне управління справами",
              "telephone": "0440000000"
            },
            "identifier": {
              "scheme": "UA-EDR",
              "id": "00037256",
              "uri": "http://www.dus.gov.ua/"
            },
            "name": "Державне управління справами",
            "address": {
              "postalCode": "01220",
              "countryName": "Україна",
              "streetAddress": "вул. Банкова, 11, корпус 1",
              "region": "м. Київ",
              "locality": "м. Київ"
            }
          }
        ],
        "bidID": "fc02090c338a477f8013156a4fa2da10",
        "date": "2018-07-30T17:40:15.471264+03:00",
        "awardID": "a915a07f7f0b4dafa583cce119bf1823",
        "id": "d925d6c6124447d581f2ae5f52ba710f"
      }
    ],
    "items": [
      {
        "description": "футляри до державних нагород",
        "classification": {
          "scheme": "ДК021",
          "description": "Cartons",
          "id": "44617100-9"
        },
        "description_en": "Cases for state awards",
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "17.21.1",
            "description": "папір і картон гофровані, паперова й картонна тара"
          }
        ],
        "deliveryAddress": {
          "postalCode": "79000",
          "countryName": "Україна",
          "streetAddress": "вул. Банкова 1",
          "region": "м. Київ",
          "locality": "м. Київ"
        },
        "deliveryDate": {
          "startDate": "2018-06-27T13:39:09.362837+03:00",
          "endDate": "2018-06-30T13:39:09.362837+03:00"
        },
        "id": "1662b0e1d59f4e2f8e2c5bd48e03a7bc",
        "unit": {
          "code": "44617100-9",
          "name": "item"
        },
        "quantity": 5.0
      }
    ],
    "dateSigned": "2019-10-25T01:00:00+03:00",
    "id": "35990a4bc5c748a68bd8970a17f938de",
    "numberOfContracts": 3,
    "procuringEntity": {
      "kind": "general",
      "name": "Державне управління справами",
      "address": {
        "postalCode": "01220",
        "countryName": "Україна",
        "streetAddress": "вул. Банкова, 11, корпус 1",
        "region": "м. Київ",
        "locality": "м. Київ"
      },
      "contactPoint": {
        "name_en": "State administration",
        "name": "Державне управління справами",
        "availableLanguage": "uk",
        "telephone": "0440000000"
      },
      "identifier": {
        "scheme": "UA-EDR",
        "legalName_en": "dus.gov.ua",
        "id": "00037256",
        "uri": "http://www.dus.gov.ua/"
      },
      "name_en": "State administration"
    },
    "owner": "broker3",
    "dateModified": "2019-10-25T01:00:00+03:00",
    "tender_id": "f0dce4b8a8954b28ba318663bb91b15b"
  }
}

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/e12304edbbb945618010929a159d473b HTTP/1.0
Authorization: Bearer broker3
Host: lb-api-sandbox.prozorro.gov.ua

Response: 200 OK
Content-Type: application/json; charset=UTF-8
{
  "data": {
    "date": "2019-10-25T01:00:00+03:00",
    "id": "e12304edbbb945618010929a159d473b",
    "usedFor": "/agreements/35990a4bc5c748a68bd8970a17f938de"
  }
}

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

PATCH /api/2.5/agreements/35990a4bc5c748a68bd8970a17f938de?acc_token=575f3322f20549bcba96cb63f59a96c3 HTTP/1.0
Authorization: Bearer broker3
Content-Length: 71
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua
DATA:
{
  "data": {
    "terminationDetails": "broker3 now can change the contract"
  }
}

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

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/35990a4bc5c748a68bd8970a17f938de/ownership HTTP/1.0
Authorization: Bearer broker2
Content-Length: 100
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua
DATA:
{
  "data": {
    "transfer": "ce149419ccc3449386198315c53bdb16",
    "id": "a8cb74a85c6e42c5af7f3e1ae9b07f7c"
  }
}

Response: 403 Forbidden
Content-Type: application/json; charset=UTF-8
{
  "status": "error",
  "errors": [
    {
      "description": "Broker Accreditation level does not permit ownership change",
      "location": "ownership",
      "name": "accreditation"
    }
  ]
}

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

POST /api/2.5/agreements/35990a4bc5c748a68bd8970a17f938de/ownership HTTP/1.0
Authorization: Bearer broker
Content-Length: 100
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua
DATA:
{
  "data": {
    "transfer": "ce149419ccc3449386198315c53bdb16",
    "id": "47c2cde58114441dad832af69699b016"
  }
}

Response: 403 Forbidden
Content-Type: application/json; charset=UTF-8
{
  "status": "error",
  "errors": [
    {
      "description": "Owner Accreditation level does not permit ownership change",
      "location": "ownership",
      "name": "accreditation"
    }
  ]
}