# createReceiptAdvice mutation


`createReceiptAdvice` is a GraphQL mutation of the Chameleoon MAX API. Send it as `POST https://max-api.chameleoon.sk/api/v1/graphql` with your API key, see [Chameleoon MAX](/chameleoon-max).

Creates and opens one receipt advice in a single step. Call it when a supplier announces a
delivery to one of your warehouses.

The advice gets its number (`PP-…`) and expects its goods at once. A failed call creates no
draft and takes no number. Every line names its product variant.

#### Permissions

Requires the `advice.write` permission, with the warehouse, its legal entity and the supplier
in your API key's warehouse, legal-entity and partner scope.

#### Repeated calls

`requestId` makes a retry after a lost response safe. A repeat with the same input returns the
advice with `created: false`. A repeat with different input returns `CONFLICT` with the reason
`REQUEST_ID_REUSED`.

#### Errors

- `VALIDATION` with the reason `CURRENCY_MISMATCH` when the currency is not the warehouse's
  valuation currency.
- An error about a line names the line's index in `extensions.addIndex`.

> An error whose path runs below this field does not mean the call failed: the receipt advice
> was created, so do not retry. See [`Mutation`](/chameleoon-max/mutations).

Costs 1 point plus 1 per line and 1 per parameter, plus its selection.

## Arguments

- `input`: [`CreateReceiptAdviceInput!`](/chameleoon-max/type/create-receipt-advice-input) · required

## Returns

[`CreateReceiptAdviceResult!`](/chameleoon-max/type/create-receipt-advice-result)

## Example

**Mutation**

```graphql
mutation createReceiptAdvice($input: CreateReceiptAdviceInput!) {
  createReceiptAdvice(input: $input) {
    created
    advice {
      id
      number
      kind
      status
      state
      supplierId
    }
  }
}
```

**Variables**

```json
{
  "input": {
    "requestId": "example",
    "supplierId": "00000000-0000-4000-8000-000000000001",
    "warehouseId": "00000000-0000-4000-8000-000000000001",
    "kind": "DELIVERY_NOTE",
    "lines": [
      {
        "variantId": "00000000-0000-4000-8000-000000000001",
        "quantity": "10.00"
      }
    ]
  }
}
```

**Response**

```json
{
  "data": {
    "createReceiptAdvice": {
      "created": true,
      "advice": {
        "id": "00000000-0000-4000-8000-000000000001",
        "number": "example",
        "kind": "DELIVERY_NOTE",
        "status": "DRAFT",
        "state": "DRAFT",
        "supplierId": "00000000-0000-4000-8000-000000000001"
      }
    }
  }
}
```

Values are illustrative: replace IDs and codes with your own before you send the call.
