---
updatedAt: 2026-04-23T13:29:19.000Z
agentTools:
  projectIndex: https://developer.xentral.com/llms.txt
---

# Create positions for invoice

Adds invoice positions

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "Xentral API",
    "version": "v0.1",
    "description": "Xentral is an ERP platform.",
    "contact": {
      "name": "Xentral",
      "url": "https://xentral.com",
      "email": "api@xentral.com"
    }
  },
  "tags": [
    {
      "name": "Invoice",
      "description": "An invoice is a commercial document issued by a seller to a buyer relating to a sale transaction and indicating the products, quantities, and agreed-upon prices for products or services the seller had provided the buyer."
    }
  ],
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Bearer token obtained in POST /tokens endpoint or pregenerated in the system."
      }
    }
  },
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "servers": [
    {
      "url": "https://{xentralId}.xentral.biz",
      "description": "Your Xentral Instance",
      "variables": {
        "xentralId": {
          "default": "xentral"
        }
      }
    },
    {
      "url": "https://{domain}",
      "description": "Xentral at a custom domain",
      "variables": {
        "domain": {
          "default": "xentral.com"
        }
      }
    }
  ],
  "x-readme": {
    "samples-languages": []
  },
  "paths": {
    "/api/v1/invoices/{id}/positions": {
      "post": {
        "tags": [
          "Invoice"
        ],
        "operationId": "invoice.createPositions",
        "summary": "Create positions for invoice",
        "description": "Adds invoice positions",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "description": "The resource's identifier.",
            "schema": {
              "type": "string",
              "pattern": "\\d+",
              "example": "17",
              "description": "Resource identifier."
            }
          }
        ],
        "requestBody": {
          "description": "Invoice positions object\n\n The following payload structure is available:\n\nWhen a position has `salesOrderPosition.id` in the payload then product, quantity, price, vatCategory, taxRate, discounts are optional. The optional values override the values fetched from a sales order position\n\nWhen `salesOrderPosition.id` is not present in the payload or null, then product, quantity, price, vatCategory, taxRate, discounts are required",
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "properties": {
                    "salesOrderPosition": {
                      "description": "Nullable reference to another resource",
                      "type": "object",
                      "additionalProperties": false,
                      "nullable": true,
                      "required": [
                        "id"
                      ],
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "\\d+",
                          "example": "17",
                          "description": "Resource identifier."
                        }
                      },
                      "example": {
                        "id": "1337"
                      }
                    },
                    "product": {
                      "description": "Reference to another resource",
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "id"
                      ],
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "\\d+",
                          "example": "17",
                          "description": "Resource identifier."
                        }
                      },
                      "example": {
                        "id": "1337"
                      }
                    },
                    "quantity": {
                      "description": "The quantity for the position",
                      "type": "string",
                      "format": "float",
                      "example": "2.0"
                    },
                    "price": {
                      "description": "Money object with amount and currency",
                      "example": {
                        "amount": "13.37",
                        "currency": "EUR"
                      },
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "amount": {
                          "description": "A string representing the amount",
                          "type": "string",
                          "format": "float",
                          "example": "24.99"
                        },
                        "currency": {
                          "type": "string",
                          "pattern": "[A-Z]{3}",
                          "enum": [
                            "EUR",
                            "USD",
                            "JPY",
                            "BGN",
                            "CZK",
                            "DKK",
                            "GBP",
                            "HUF",
                            "PLN",
                            "RON",
                            "SEK",
                            "CHF",
                            "ISK",
                            "NOK",
                            "HRK",
                            "RUB",
                            "TRY",
                            "AUD",
                            "BRL",
                            "CAD",
                            "CNY",
                            "HKD",
                            "IDR",
                            "ILS",
                            "INR",
                            "KRW",
                            "MXN",
                            "MYR",
                            "NZD",
                            "PHP",
                            "SGD",
                            "THB",
                            "ZAR",
                            "ARS",
                            "CLP",
                            "SAR",
                            "AED",
                            "QAR"
                          ],
                          "description": "Currency matches one of currency values as specified in ISO-4217.",
                          "example": "PLN"
                        }
                      }
                    },
                    "deliveryDate": {
                      "description": "The VAT category that applies to the position",
                      "type": "string",
                      "format": "date",
                      "example": "2024-12-23"
                    },
                    "discounts": {
                      "description": "Discounts applied to position",
                      "type": "object",
                      "additionalProperties": false,
                      "properties": {
                        "totalPercent": {
                          "description": "The percentage discount applied to position",
                          "type": "string",
                          "format": "float",
                          "nullable": true,
                          "example": "38.45"
                        }
                      },
                      "example": {
                        "totalPercent": "38.45"
                      }
                    }
                  }
                }
              },
              "examples": {
                "Create invoice positions": {
                  "value": [
                    {
                      "product": {
                        "id": "1"
                      },
                      "quantity": "1.0",
                      "price": {
                        "amount": "100.00",
                        "currency": "EUR"
                      },
                      "deliveryDate": "2024-12-23"
                    },
                    {
                      "salesOrderPosition": {
                        "id": "2"
                      }
                    }
                  ]
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Resource successfully created response",
            "headers": {
              "Location": {
                "schema": {
                  "type": "string",
                  "example": "https://example.xentral.biz/api/users/17"
                },
                "description": "URI of the created resource"
              }
            },
            "content": {
              "text/html": {
                "schema": {
                  "type": "string",
                  "enum": [
                    ""
                  ],
                  "nullable": true
                }
              }
            }
          },
          "400": {
            "description": "IETF RFC 9457 Problem API compliant response",
            "content": {
              "application/problem+json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "type",
                        "title",
                        "violations"
                      ],
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "https://api.xentral.biz/problems/request-validation"
                          ]
                        },
                        "title": {
                          "type": "string",
                          "minLength": 1,
                          "example": "Request payload validation failed."
                        },
                        "violations": {
                          "oneOf": [
                            {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "example": {
                                  "username": [
                                    "This value should not be blank."
                                  ],
                                  "email": [
                                    "This value is not a valid email address."
                                  ]
                                }
                              },
                              "description": "This field will be a mirrored request payload with only invalid fields and values replaced by error messages."
                            },
                            {
                              "type": "object",
                              "example": {
                                "_": [
                                  "This value should contain at most `9` elements."
                                ]
                              },
                              "description": "This field will be a mirrored request payload with only invalid fields and values replaced by error messages."
                            }
                          ]
                        }
                      }
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "type",
                        "title",
                        "messages"
                      ],
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "https://api.xentral.biz/problems/generic-validation"
                          ]
                        },
                        "title": {
                          "type": "string",
                          "minLength": 1
                        },
                        "messages": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "type",
                        "title",
                        "messages"
                      ],
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "https://api.xentral.biz/problems/conflict"
                          ]
                        },
                        "title": {
                          "type": "string",
                          "minLength": 1
                        },
                        "messages": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "type",
                        "title",
                        "items"
                      ],
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "https://api.xentral.biz/problems/conflictItems"
                          ]
                        },
                        "title": {
                          "type": "string",
                          "minLength": 1
                        },
                        "items": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": [
                              "id",
                              "title",
                              "messages"
                            ],
                            "properties": {
                              "id": {
                                "type": "integer"
                              },
                              "title": {
                                "type": "string",
                                "minLength": 1
                              },
                              "messages": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "type",
                        "title",
                        "scopes"
                      ],
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "https://developer.xentral.com/reference/problems#token-scopes"
                          ]
                        },
                        "title": {
                          "type": "string",
                          "minLength": 1
                        },
                        "scopes": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "type",
                        "title",
                        "messages"
                      ],
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "https://api.xentral.biz/problems/generic-validation"
                          ]
                        },
                        "title": {
                          "type": "string",
                          "minLength": 1
                        },
                        "messages": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unable to authenticate the client",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "description": "Error message explaining why the request failed.",
                      "example": "Missing required scopes: customer:create."
                    }
                  }
                },
                "example": {
                  "message": "Missing required scopes: customer:create."
                }
              },
              "text/html": {
                "schema": {
                  "type": "string",
                  "example": "Unauthorized"
                }
              }
            }
          },
          "403": {
            "description": "Unable to authorize the client"
          },
          "404": {
            "description": "Resource was not found or not enough access privileges"
          },
          "415": {
            "description": "Resource representation send in the request is not supported."
          },
          "429": {
            "description": "Too many API calls made."
          }
        }
      }
    }
  }
}
```