Example for Plan

Plan ownership change

Let’s view transfer example for plan.

Tender creation

At first let’s create a plan:

Request

POST /api/2.5/plans?opt_pretty=1 HTTP/1.0
Authorization: Bearer brokerx
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua

{
  "data": {
    "tender": {
      "procurementMethod": "open",
      "procurementMethodType": "belowThreshold",
      "tenderPeriod": {
        "startDate": "2023-10-17T01:00:00+03:00"
      }
    },
    "items": [
      {
        "deliveryDate": {
          "startDate": "2023-10-12T01:00:00+03:00",
          "endDate": "2023-10-15T01:00:00+03:00"
        },
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "01.11.92",
            "description": "Насіння гірчиці"
          }
        ],
        "unit": {
          "code": "KGM",
          "name": "кг"
        },
        "classification": {
          "scheme": "ДК021",
          "description": "Mustard seeds",
          "id": "03111600-8"
        },
        "quantity": 1000,
        "description": "Насіння гірчиці"
      },
      {
        "deliveryDate": {
          "startDate": "2023-10-12T01:00:00+03:00",
          "endDate": "2023-10-15T01:00:00+03:00"
        },
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "01.11.95",
            "description": "Насіння соняшнику"
          }
        ],
        "unit": {
          "code": "KGM",
          "name": "кг"
        },
        "classification": {
          "scheme": "ДК021",
          "description": "Sunflower seeds",
          "id": "03111300-5"
        },
        "quantity": 2000,
        "description": "Насіння соняшнику"
      },
      {
        "deliveryDate": {
          "startDate": "2023-10-12T01:00:00+03:00",
          "endDate": "2023-10-15T01:00:00+03:00"
        },
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "01.11.84",
            "description": "Насіння бавовнику"
          }
        ],
        "unit": {
          "code": "KGM",
          "name": "кг"
        },
        "classification": {
          "scheme": "ДК021",
          "description": "Cotton seeds",
          "id": "03111400-6"
        },
        "quantity": 3000,
        "description": "Насіння бавовнику"
      }
    ],
    "classification": {
      "scheme": "ДК021",
      "description": "Seeds",
      "id": "03111000-2"
    },
    "additionalClassifications": [
      {
        "scheme": "КЕКВ",
        "id": "1",
        "description": "-"
      }
    ],
    "procuringEntity": {
      "identifier": {
        "scheme": "UA-EDR",
        "id": "111983",
        "legalName": "ДП Державне Управління Справами"
      },
      "name": "ДУС",
      "address": {
        "countryName": "Україна",
        "postalCode": "01220",
        "region": "м. Київ",
        "locality": "м. Київ",
        "streetAddress": "вул. Банкова, 11, корпус 1"
      },
      "kind": "general"
    },
    "buyers": [
      {
        "identifier": {
          "scheme": "UA-EDR",
          "id": "111983",
          "legalName": "ДП Державне Управління Справами"
        },
        "name": "ДУС",
        "address": {
          "countryName": "Україна",
          "postalCode": "01220",
          "region": "м. Київ",
          "locality": "м. Київ",
          "streetAddress": "вул. Банкова, 11, корпус 1"
        },
        "contactPoint": {
          "name": "Державне управління справами",
          "telephone": "+0440000000"
        },
        "kind": "general"
      }
    ],
    "budget": {
      "project": {
        "name": "proj_name",
        "id": "123"
      },
      "amount": 10000,
      "amountNet": 12222,
      "currency": "UAH",
      "id": "12303111000-2",
      "description": "budget_description",
      "period": {
        "startDate": "2024-01-01T00:00:00",
        "endDate": "2024-12-31T00:00:00"
      },
      "breakdown": [
        {
          "title": "other",
          "description": "Breakdown other description.",
          "value": {
            "amount": 1500,
            "currency": "UAH"
          }
        }
      ]
    }
  }
}

Response

HTTP/1.0 201 Created
Content-Type: application/json
Location: http://lb-api-sandbox.prozorro.gov.ua/api/2.5/plans/7c7db9c9432746d19f41cd2b04bc65a5

{
  "data": {
    "status": "scheduled",
    "procuringEntity": {
      "id": "348cb0420d074d0fa9c46e626ebc8e76",
      "name": "ДУС",
      "identifier": {
        "scheme": "UA-EDR",
        "id": "111983",
        "legalName": "ДП Державне Управління Справами"
      },
      "address": {
        "streetAddress": "вул. Банкова, 11, корпус 1",
        "locality": "м. Київ",
        "region": "м. Київ",
        "postalCode": "01220",
        "countryName": "Україна"
      },
      "kind": "general"
    },
    "tender": {
      "procurementMethod": "open",
      "procurementMethodType": "belowThreshold",
      "tenderPeriod": {
        "startDate": "2023-10-17T01:00:00+03:00"
      }
    },
    "budget": {
      "id": "12303111000-2",
      "description": "budget_description",
      "amount": 10000.0,
      "currency": "UAH",
      "amountNet": 12222.0,
      "project": {
        "id": "123",
        "name": "proj_name"
      },
      "period": {
        "startDate": "2024-01-01T00:00:00+02:00",
        "endDate": "2024-12-31T00:00:00+02:00"
      },
      "breakdown": [
        {
          "id": "880d4e1ef7d84cd0be15ba5678c6306d",
          "title": "other",
          "description": "Breakdown other description.",
          "value": {
            "amount": 1500.0,
            "currency": "UAH"
          }
        }
      ]
    },
    "classification": {
      "description": "Seeds",
      "scheme": "ДК021",
      "id": "03111000-2"
    },
    "additionalClassifications": [
      {
        "scheme": "КЕКВ",
        "id": "1",
        "description": "-"
      }
    ],
    "items": [
      {
        "id": "1cacdbcc3bb7446aab11f090bc5b971b",
        "classification": {
          "description": "Mustard seeds",
          "scheme": "ДК021",
          "id": "03111600-8"
        },
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "01.11.92",
            "description": "Насіння гірчиці"
          }
        ],
        "unit": {
          "name": "кг",
          "code": "KGM"
        },
        "quantity": 1000.0,
        "deliveryDate": {
          "startDate": "2023-10-12T01:00:00+03:00",
          "endDate": "2023-10-15T01:00:00+03:00"
        },
        "description": "Насіння гірчиці"
      },
      {
        "id": "3aaa9e8a6a3e4d618bc8e8af0a406b45",
        "classification": {
          "description": "Sunflower seeds",
          "scheme": "ДК021",
          "id": "03111300-5"
        },
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "01.11.95",
            "description": "Насіння соняшнику"
          }
        ],
        "unit": {
          "name": "кг",
          "code": "KGM"
        },
        "quantity": 2000.0,
        "deliveryDate": {
          "startDate": "2023-10-12T01:00:00+03:00",
          "endDate": "2023-10-15T01:00:00+03:00"
        },
        "description": "Насіння соняшнику"
      },
      {
        "id": "8ae59717ad824e6ba1988907e91c554c",
        "classification": {
          "description": "Cotton seeds",
          "scheme": "ДК021",
          "id": "03111400-6"
        },
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "01.11.84",
            "description": "Насіння бавовнику"
          }
        ],
        "unit": {
          "name": "кг",
          "code": "KGM"
        },
        "quantity": 3000.0,
        "deliveryDate": {
          "startDate": "2023-10-12T01:00:00+03:00",
          "endDate": "2023-10-15T01:00:00+03:00"
        },
        "description": "Насіння бавовнику"
      }
    ],
    "buyers": [
      {
        "id": "b70ea6f297d64c4a96a32ec1636b3eca",
        "name": "ДУС",
        "identifier": {
          "scheme": "UA-EDR",
          "id": "111983",
          "legalName": "ДП Державне Управління Справами"
        },
        "address": {
          "streetAddress": "вул. Банкова, 11, корпус 1",
          "locality": "м. Київ",
          "region": "м. Київ",
          "postalCode": "01220",
          "countryName": "Україна"
        },
        "kind": "general",
        "contactPoint": {
          "name": "Державне управління справами",
          "telephone": "+0440000000"
        }
      }
    ],
    "planID": "UA-P-2023-10-10-000001-a",
    "owner": "brokerx",
    "datePublished": "2023-10-10T01:00:00+03:00",
    "dateModified": "2023-10-10T01:00:00+03:00",
    "dateCreated": "2023-10-10T01:00:00+03:00",
    "id": "7c7db9c9432746d19f41cd2b04bc65a5"
  },
  "access": {
    "token": "4fce6f670b9247b2a5ae29ff970195cd",
    "transfer": "8922ed835f03478a82a84df60c4eea7e"
  }
}

broker is current plan’s owner.

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

After plan’s registration in CDB broker has to provide its customer with transfer key.

Transfer creation

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

Request

POST /api/2.5/transfers HTTP/1.0
Authorization: Bearer broker1
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": "845293b7f3c2411e9ecbc6ba4a0cf557"
  },
  "access": {
    "token": "dede6d098bfa4709a7bee0b08479d68b",
    "transfer": "cc8b9847eee44a49ae3ddb50ac670093"
  }
}

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

Transfer can be retrieved by id:

Request

GET /api/2.5/transfers/845293b7f3c2411e9ecbc6ba4a0cf557 HTTP/1.0
Authorization: Bearer broker1
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",
    "id": "845293b7f3c2411e9ecbc6ba4a0cf557"
  }
}

Changing plan’s owner

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

Allowed

Not Allowed

scheduled

draft

cancelled

complete

To change plan’s ownership new broker should send POST request to appropriate /plans/id/ with data section containing id of Transfer and transfer token received from customer:

Request

POST /api/2.5/plans/7c7db9c9432746d19f41cd2b04bc65a5/ownership HTTP/1.0
Authorization: Bearer broker1
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua

{
  "data": {
    "id": "845293b7f3c2411e9ecbc6ba4a0cf557",
    "transfer": "8922ed835f03478a82a84df60c4eea7e"
  }
}

Response

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

{
  "data": {
    "owner": "broker1",
    "id": "7c7db9c9432746d19f41cd2b04bc65a5"
  }
}

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 plan path in usedFor property:

Request

GET /api/2.5/transfers/845293b7f3c2411e9ecbc6ba4a0cf557 HTTP/1.0
Authorization: Bearer broker1
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": "/plans/7c7db9c9432746d19f41cd2b04bc65a5",
    "id": "845293b7f3c2411e9ecbc6ba4a0cf557"
  }
}

‘Used’ Transfer can’t be applied to any other object.

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

Request

PATCH /api/2.5/plans/7c7db9c9432746d19f41cd2b04bc65a5?acc_token=dede6d098bfa4709a7bee0b08479d68b HTTP/1.0
Authorization: Bearer broker1
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua

{
  "data": {
    "budget": {
      "project": {
        "name": "proj_name",
        "id": "123"
      },
      "amount": 10000,
      "amountNet": 12222,
      "currency": "UAH",
      "id": "12303111000-2",
      "description": "broker1 now can change the plan",
      "period": {
        "startDate": "2024-01-01T00:00:00",
        "endDate": "2024-12-31T00:00:00"
      },
      "breakdown": [
        {
          "title": "other",
          "description": "Breakdown other description.",
          "value": {
            "amount": 1500,
            "currency": "UAH"
          }
        }
      ]
    }
  }
}

Response

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

{
  "data": {
    "status": "scheduled",
    "procuringEntity": {
      "id": "348cb0420d074d0fa9c46e626ebc8e76",
      "name": "ДУС",
      "identifier": {
        "scheme": "UA-EDR",
        "id": "111983",
        "legalName": "ДП Державне Управління Справами"
      },
      "address": {
        "streetAddress": "вул. Банкова, 11, корпус 1",
        "locality": "м. Київ",
        "region": "м. Київ",
        "postalCode": "01220",
        "countryName": "Україна"
      },
      "kind": "general"
    },
    "tender": {
      "procurementMethod": "open",
      "procurementMethodType": "belowThreshold",
      "tenderPeriod": {
        "startDate": "2023-10-17T01:00:00+03:00"
      }
    },
    "budget": {
      "id": "12303111000-2",
      "description": "broker1 now can change the plan",
      "amount": 10000.0,
      "currency": "UAH",
      "amountNet": 12222.0,
      "project": {
        "id": "123",
        "name": "proj_name"
      },
      "period": {
        "startDate": "2024-01-01T00:00:00+02:00",
        "endDate": "2024-12-31T00:00:00+02:00"
      },
      "breakdown": [
        {
          "id": "e5e65888451d4f8587e90a3af0098f5d",
          "title": "other",
          "description": "Breakdown other description.",
          "value": {
            "amount": 1500.0,
            "currency": "UAH"
          }
        }
      ]
    },
    "classification": {
      "description": "Seeds",
      "scheme": "ДК021",
      "id": "03111000-2"
    },
    "additionalClassifications": [
      {
        "scheme": "КЕКВ",
        "id": "1",
        "description": "-"
      }
    ],
    "planID": "UA-P-2023-10-10-000001-a",
    "items": [
      {
        "id": "1cacdbcc3bb7446aab11f090bc5b971b",
        "classification": {
          "description": "Mustard seeds",
          "scheme": "ДК021",
          "id": "03111600-8"
        },
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "01.11.92",
            "description": "Насіння гірчиці"
          }
        ],
        "unit": {
          "name": "кг",
          "code": "KGM"
        },
        "quantity": 1000.0,
        "deliveryDate": {
          "startDate": "2023-10-12T01:00:00+03:00",
          "endDate": "2023-10-15T01:00:00+03:00"
        },
        "description": "Насіння гірчиці"
      },
      {
        "id": "3aaa9e8a6a3e4d618bc8e8af0a406b45",
        "classification": {
          "description": "Sunflower seeds",
          "scheme": "ДК021",
          "id": "03111300-5"
        },
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "01.11.95",
            "description": "Насіння соняшнику"
          }
        ],
        "unit": {
          "name": "кг",
          "code": "KGM"
        },
        "quantity": 2000.0,
        "deliveryDate": {
          "startDate": "2023-10-12T01:00:00+03:00",
          "endDate": "2023-10-15T01:00:00+03:00"
        },
        "description": "Насіння соняшнику"
      },
      {
        "id": "8ae59717ad824e6ba1988907e91c554c",
        "classification": {
          "description": "Cotton seeds",
          "scheme": "ДК021",
          "id": "03111400-6"
        },
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "01.11.84",
            "description": "Насіння бавовнику"
          }
        ],
        "unit": {
          "name": "кг",
          "code": "KGM"
        },
        "quantity": 3000.0,
        "deliveryDate": {
          "startDate": "2023-10-12T01:00:00+03:00",
          "endDate": "2023-10-15T01:00:00+03:00"
        },
        "description": "Насіння бавовнику"
      }
    ],
    "buyers": [
      {
        "id": "b70ea6f297d64c4a96a32ec1636b3eca",
        "name": "ДУС",
        "identifier": {
          "scheme": "UA-EDR",
          "id": "111983",
          "legalName": "ДП Державне Управління Справами"
        },
        "address": {
          "streetAddress": "вул. Банкова, 11, корпус 1",
          "locality": "м. Київ",
          "region": "м. Київ",
          "postalCode": "01220",
          "countryName": "Україна"
        },
        "kind": "general",
        "contactPoint": {
          "name": "Державне управління справами",
          "telephone": "+0440000000"
        }
      }
    ],
    "owner": "broker1",
    "dateCreated": "2023-10-10T01:00:00+03:00",
    "dateModified": "2023-10-10T01:00:00+03:00",
    "datePublished": "2023-10-10T01:00:00+03:00",
    "id": "7c7db9c9432746d19f41cd2b04bc65a5"
  }
}

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/plans/7c7db9c9432746d19f41cd2b04bc65a5/ownership HTTP/1.0
Authorization: Bearer broker2
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua

{
  "data": {
    "id": "3a5c56c87da24e6f8d1622d9c0655bfa",
    "transfer": "8922ed835f03478a82a84df60c4eea7e"
  }
}

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

{
  "data": {
    "id": "7b46b5e1fc2847f895eeb0f4fc010673",
    "transfer": "8922ed835f03478a82a84df60c4eea7e"
  }
}

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