# Create a purchase offer

> Record a supplier cost for a variant.

`POST /rest/api/purchase_offers`

Creates a Purchase Offer resource.

Creates a purchase offer - the cost of a `variant` from a `supplier`, for a `country`, with a `tax` and a `taxExcludedPrice`, valid from `startsAt`.

> **Relations are IRIs**
>
> `variant`, `supplier`, `country` and `tax` reference existing resources by IRI. `taxExcludedPrice` is a money object (amount + currency).

## Headers

| Name                         | Type     | Required | Description                                                                                                                                      |
| ---------------------------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `X-Flowkiwi-Organization-Id` | `string` | Yes      | The organization the request acts as. Determines the identity, permissions and ownership applied when reading or modifying data on the instance. |

## Request body

| Property                   | Type                            | Required | Description                                                                 |
| -------------------------- | ------------------------------- | -------- | --------------------------------------------------------------------------- |
| `status`                   | `string`                        | Yes      | The status of the offer.                                                    |
| `taxExcludedPrice`         | `EmbeddedMoneyResource \| null` | Yes      | The price set for the offer, excluding tax.                                 |
| `discountTaxExcludedPrice` | `EmbeddedMoneyResource \| null` | -        | The discounted tax-excluded price, when a discount applies.                 |
| `startsAt`                 | `string \| null`                | -        | Start date of the offer. Defaults to the current date/time if not provided. |
| `endsAt`                   | `string \| null`                | -        | End date of the offer.                                                      |
| `country`                  | `string \| null`                | Yes      | The country resource it belongs to.                                         |
| `tax`                      | `string \| null`                | Yes      | The tax resource it belongs to.                                             |
| `variant`                  | `string \| null`                | Yes      | The variant resource it belongs to.                                         |
| `supplier`                 | `string \| null`                | Yes      | The supplier resource it belongs to.                                        |

## Response

**201** - Purchase Offer resource created

| Property                          | Type                                   | Required | Description                                                                                |
| --------------------------------- | -------------------------------------- | -------- | ------------------------------------------------------------------------------------------ |
| `@context`                        | `object`                               | -        |                                                                                            |
| `@id`                             | `string`                               | Yes      |                                                                                            |
| `@type`                           | `string`                               | Yes      |                                                                                            |
| `id`                              | `string`                               | -        | The unique identifier of the purchase offer.                                               |
| `status`                          | `string`                               | -        | The status of the offer.                                                                   |
| `taxExcludedPrice`                | `EmbeddedMoneyResource`                | Yes      | The price set for the offer, excluding tax.                                                |
| `taxExcludedPricePerUnit`         | `EmbeddedPricePerUnitResource \| null` | -        | The tax-excluded price expressed per measurement reference unit.                           |
| `price`                           | `EmbeddedMoneyResource`                | -        | The tax-included price, computed from `taxExcludedPrice` and the referenced `Tax` rate.    |
| `pricePerUnit`                    | `EmbeddedPricePerUnitResource \| null` | -        | The tax-included price expressed per measurement reference unit.                           |
| `discountPrice`                   | `EmbeddedMoneyResource \| null`        | -        | The discounted tax-included price, when a discount applies.                                |
| `discountPricePerUnit`            | `EmbeddedPricePerUnitResource \| null` | -        | The discounted tax-included price per measurement reference unit, when a discount applies. |
| `discountTaxExcludedPrice`        | `EmbeddedMoneyResource \| null`        | -        | The discounted tax-excluded price, when a discount applies.                                |
| `discountTaxExcludedPricePerUnit` | `EmbeddedPricePerUnitResource \| null` | -        | The discounted tax-excluded price per measurement reference unit, when a discount applies. |
| `startsAt`                        | `string`                               | -        | Start date of the offer. Defaults to the current date/time if not provided.                |
| `endsAt`                          | `string \| null`                       | -        | End date of the offer.                                                                     |
| `country`                         | `string`                               | Yes      | The country resource it belongs to.                                                        |
| `tax`                             | `string`                               | Yes      | The tax resource it belongs to.                                                            |
| `variant`                         | `string`                               | Yes      | The variant resource it belongs to.                                                        |
| `supplier`                        | `string`                               | Yes      | The supplier resource it belongs to.                                                       |
| `createdAt`                       | `string`                               | -        | The date and time when the resource was created (ISO 8601 format).                         |
| `updatedAt`                       | `string`                               | -        | The date and time when the resource was last modified (ISO 8601 format).                   |

## Errors

**400** - Invalid input

| Property   | Type             | Required | Description                                                                                                                          |
| ---------- | ---------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| `@context` | `object`         | -        |                                                                                                                                      |
| `@id`      | `string`         | Yes      |                                                                                                                                      |
| `@type`    | `string`         | Yes      |                                                                                                                                      |
| `title`    | `string \| null` | -        | A short, human-readable summary of the problem.                                                                                      |
| `detail`   | `string \| null` | -        | A human-readable explanation specific to this occurrence of the problem.                                                             |
| `status`   | `number \| null` | -        |                                                                                                                                      |
| `instance` | `string \| null` | -        | A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced. |
| `type`     | `string`         | -        | A URI reference that identifies the problem type                                                                                     |

**403** - Access denied. The caller is missing one or more identity permissions required for this operation.

| Property             | Type       | Required | Description                                                                                                                                |
| -------------------- | ---------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `@context`           | `object`   | -        |                                                                                                                                            |
| `@id`                | `string`   | Yes      |                                                                                                                                            |
| `@type`              | `string`   | Yes      |                                                                                                                                            |
| `type`               | `string`   | -        |                                                                                                                                            |
| `title`              | `string`   | -        |                                                                                                                                            |
| `status`             | `integer`  | -        |                                                                                                                                            |
| `detail`             | `string`   | -        |                                                                                                                                            |
| `missingPermissions` | `string[]` | -        | Identity permissions that the caller is missing for this operation. Present only when the 403 is caused by a denied identity:* permission. |

**422** - An error occurred

| Property     | Type             | Required | Description |
| ------------ | ---------------- | -------- | ----------- |
| `@context`   | `object`         | -        |             |
| `@id`        | `string`         | Yes      |             |
| `@type`      | `string`         | Yes      |             |
| `status`     | `integer`        | -        |             |
| `violations` | `object[]`       | -        |             |
| `detail`     | `string`         | -        |             |
| `type`       | `string`         | -        |             |
| `title`      | `string \| null` | -        |             |
| `instance`   | `string \| null` | -        |             |

## Examples

### Example request

```bash
curl -X POST 'https://<tenant>.product-management.flowkiwi.net/rest/api/purchase_offers' \
  -H 'Authorization: Bearer {token}' \
  -H 'X-Flowkiwi-Organization-Id: <org_id>' \
  -H 'Accept: application/ld+json' \
  -H 'Content-Type: application/ld+json' \
  -d '{
  "status": "/rest/api/statuses/ACTIVE",
  "taxExcludedPrice": {
    "amount": "6.50",
    "currency": "EUR"
  },
  "discountTaxExcludedPrice": {
    "amount": "6.00",
    "currency": "EUR"
  },
  "startsAt": "2026-03-01T00:00:00+00:00",
  "endsAt": "2026-03-31T23:59:59+00:00",
  "country": "/rest/api/countries/019af8c2-3d4e-7f50-8a61-2b3c4d5e6f70",
  "tax": "/rest/api/taxes/019af8c3-4e5f-7061-9b72-3c4d5e6f7081",
  "variant": "/rest/api/products/019af93e-420e-79f8-800b-6680f03dce20/variants/019af940-5a6b-7c8d-9e0f-1a2b3c4d5e6f",
  "supplier": "/rest/api/suppliers/019af8c5-6a7b-7c8d-9e0f-4d5e6f708192"
}'
```

### Example response

```json
{
  "@context": "string",
  "@id": "string",
  "@type": "Purchase.Offer",
  "id": "019af8e1-2b3c-7d4e-9f50-6b7c8d9e0f10",
  "status": "/rest/api/statuses/DRAFT",
  "taxExcludedPrice": {
    "amount": "9.8",
    "currency": "EUR"
  },
  "taxExcludedPricePerUnit": {
    "amount": "14",
    "currency": "EUR",
    "unit": "l",
    "value": 1
  },
  "price": {
    "amount": "9.8",
    "currency": "EUR"
  },
  "pricePerUnit": {
    "amount": "14",
    "currency": "EUR",
    "unit": "l",
    "value": 1
  },
  "discountPrice": {
    "amount": "9.8",
    "currency": "EUR"
  },
  "discountPricePerUnit": {
    "amount": "14",
    "currency": "EUR",
    "unit": "l",
    "value": 1
  },
  "discountTaxExcludedPrice": {
    "amount": "9.8",
    "currency": "EUR"
  },
  "discountTaxExcludedPricePerUnit": {
    "amount": "14",
    "currency": "EUR",
    "unit": "l",
    "value": 1
  },
  "startsAt": "2026-03-01T00:00:00+00:00",
  "endsAt": "2026-03-31T23:59:59+00:00",
  "country": "/rest/api/countries/00000000-0000-0000-0000-000000000000",
  "tax": "/rest/api/taxes/00000000-0000-0000-0000-000000000000",
  "variant": "/rest/api/products/00000000-0000-0000-0000-000000000000/variants/00000000-0000-0000-0000-000000000000",
  "supplier": "/rest/api/suppliers/00000000-0000-0000-0000-000000000000",
  "createdAt": "2026-01-15T09:30:00+00:00",
  "updatedAt": "2026-02-03T14:45:12+00:00"
}
```
