# Change a draft invoice

`PATCH /invoices/{id}` · Rivier · shop

Change a draft invoice: dates, notes, payment terms, references, the customer and where the goods were delivered.

- Scope: shop:write
- Sdk: shop.invoice.update
- Cli: shop invoice update

## Parameters

- `id` (path, required), string

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "issueDate": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "dueDate": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "supplyDate": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "notes": {
      "type": "string",
      "maxLength": 2000,
      "default": ""
    },
    "paymentTerms": {
      "type": "string",
      "maxLength": 500
    },
    "paymentInstructions": {
      "type": "string",
      "maxLength": 1000
    },
    "buyerReference": {
      "type": "string",
      "maxLength": 120,
      "default": ""
    },
    "purchaseOrder": {
      "type": "string",
      "maxLength": 120,
      "default": ""
    },
    "contact": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "email": {
          "type": "string",
          "format": "email",
          "maxLength": 254
        },
        "addressLines": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 200
          },
          "maxItems": 6,
          "default": []
        },
        "country": {
          "type": "string",
          "pattern": "^[A-Z]{2}$"
        },
        "vatId": {
          "type": "string",
          "maxLength": 30
        },
        "registration": {
          "type": "string",
          "maxLength": 60
        },
        "city": {
          "type": "string",
          "maxLength": 100
        },
        "postalCode": {
          "type": "string",
          "maxLength": 20
        },
        "endpointScheme": {
          "type": "string",
          "pattern": "^[0-9A-Z]{4}$"
        },
        "endpointId": {
          "type": "string",
          "pattern": "^\\S(.{0,48}\\S)?$"
        },
        "paymentAccount": {
          "type": "string",
          "pattern": "^[A-Za-z0-9 ]{4,42}$"
        },
        "paymentBic": {
          "type": "string",
          "pattern": "^[A-Za-z0-9]{8,11}$"
        },
        "language": {
          "type": "string",
          "pattern": "^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$",
          "maxLength": 20
        }
      },
      "required": [
        "name"
      ],
      "additionalProperties": false
    },
    "delivery": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "maxLength": 200
        },
        "addressLines": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 200
          },
          "maxItems": 6,
          "default": []
        },
        "city": {
          "type": "string",
          "maxLength": 100
        },
        "postalCode": {
          "type": "string",
          "maxLength": 20
        },
        "country": {
          "type": "string",
          "pattern": "^[A-Z]{2}$"
        }
      },
      "additionalProperties": false
    },
    "reverseCharge": {
      "type": "boolean",
      "default": false
    }
  },
  "additionalProperties": false
}
```

## Responses

- `200`: Success
- `400`: The request was malformed
- `401`: No valid credential
- `403`: The credential lacks the scope, origin or address
- `429`: Over the key's rate limit; see Retry-After

## Example

```sh
curl -X PATCH 'https://api.rivier.ai/invoices/{id}' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "issueDate": "string",
  "dueDate": "string",
  "supplyDate": "string",
  "notes": "",
  "paymentTerms": "string",
  "paymentInstructions": "string",
  "buyerReference": "",
  "purchaseOrder": ""
}'
```
