# createTransferAdvice mutation


`createTransferAdvice` 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 a transfer advice and opens it, in one transaction. Call it when goods must be moved
from one warehouse (or bin) to another.

#### Permissions

Requires the `transferAdvice.write` permission, with both warehouses in your API key's
warehouse scope and the company in its legal-entity scope.

#### Repeated calls

`requestId` makes a retry after a lost response safe.

- The same `requestId` with the same input returns the existing transfer advice with
  `created: false`.
- The same `requestId` with different input returns `CONFLICT` with `extensions.reason`
  `REQUEST_ID_REUSED`.

#### Errors

- A failed call creates nothing: no draft and no number.
- An error about one line carries the line's index in `extensions.addIndex`.
- A line without a `targetLocationId` in a bin-to-bin transfer advice returns `VALIDATION`
  with `extensions.reason` `TRANSFER_ADVICE_TARGET_BIN_REQUIRED`.

#### Good to know

- The transfer advice moves no stock. Once it is open, each line reserves at the source
  warehouse what is free of the quantity it instructs.
- When the source and target warehouses are the same, the transfer advice moves goods from bin
  to bin inside one warehouse, and every line needs a `targetLocationId`.

> An error whose path runs below this field does not mean the call failed: the transfer 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`: [`CreatePublicTransferAdviceInput!`](/chameleoon-max/type/create-public-transfer-advice-input) · required

## Returns

[`CreatePublicTransferAdviceResult!`](/chameleoon-max/type/create-public-transfer-advice-result)

## Example

**Mutation**

```graphql
mutation createTransferAdvice($input: CreatePublicTransferAdviceInput!) {
  createTransferAdvice(input: $input) {
    created
    advice {
      id
      number
      status
      state
      sourceWarehouseId
      targetWarehouseId
    }
  }
}
```

**Variables**

```json
{
  "input": {
    "requestId": "example",
    "sourceWarehouseId": "00000000-0000-4000-8000-000000000001",
    "targetWarehouseId": "00000000-0000-4000-8000-000000000001",
    "lines": [
      {
        "variantId": "00000000-0000-4000-8000-000000000001",
        "quantity": "10.00"
      }
    ]
  }
}
```

**Response**

```json
{
  "data": {
    "createTransferAdvice": {
      "created": true,
      "advice": {
        "id": "00000000-0000-4000-8000-000000000001",
        "number": "example",
        "status": "DRAFT",
        "state": "DRAFT",
        "sourceWarehouseId": "00000000-0000-4000-8000-000000000001",
        "targetWarehouseId": "00000000-0000-4000-8000-000000000001"
      }
    }
  }
}
```

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