Create an invoice for products

POST https://api.zenoti.com/v1/invoices/products

Use this API to generate an invoice after booking the required products.

Before you begin

Permission: Manage API Keys (on the Administrator security object) — Required to access Zenoti APIs.

Endpoint

POST /v1/invoices/products

Base URL: https://api.zenoti.com

Request

Headers

Header Required Description
application_name Yes Name of the application
application_version Yes The version of the application

Query parameters

Parameter Type Required Default Description
center_id string Yes — Mandatory Unique identifier of the center.
guest_id string Yes — Mandatory Unique identifier of the guest who is purchasing the product.
notes string No — Optional Specified notes will be added to the purchase.
products string Yes — Mandatory List of objects that contains purchase details.
products[0].id string No — Optional Unique identifier of the product.
products[0].quantity integer (int32) No — Optional Quantity of the product that is needed to be added to invoice.
products[0].sale_by_id string No — Optional Unique identifier of the employee who is selling the product.
created_by_id string Yes — Mandatory Unique identifier of the employee who created the invoice.

Request body

Field Type Required Description
RAW_BODY string (json) No

Response

Success (201 Created)

{
  "invoice_id": "1e023c27-6792-4cbb-b3e7-fbded3766ca9"
}

Response fields

Field Type Description
invoice_id string

Example

curl --request POST \
  --url 'https://api.zenoti.com/v1/invoices/products?center_id={{center_id}}&guest_id={{guest_id}}&products={{products}}&created_by_id={{created_by_id}}' \
  --header 'Authorization: bearer {{access_token}}' \
  --header 'application_name: Name of the application' \
  --header 'application_version: The version of the application' \
  --header 'Content-Type: application/json' \
  --data '{
  "RAW_BODY": "string"
}'
const response = await fetch('https://api.zenoti.com/v1/invoices/products', {
  method: 'POST',
  headers: {
    'Authorization': 'bearer {{access_token}}',
    'application_name': 'Name of the application',
    'application_version': 'The version of the application',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({ RAW_BODY: 'string' })
});
const data = await response.json();
import requests

response = requests.post(
    'https://api.zenoti.com/v1/invoices/products',
    headers={
        'Authorization': 'bearer {{access_token}}',
        'application_name': 'Name of the application',
        'application_version': 'The version of the application',
    },
    json={'RAW_BODY': 'string'}
)
data = response.json()
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "bearer {{access_token}}");
client.DefaultRequestHeaders.Add("application_name", "Name of the application");
client.DefaultRequestHeaders.Add("application_version", "The version of the application");
var content = new StringContent(
    JsonSerializer.Serialize(new { RAW_BODY = "string" }),
    Encoding.UTF8, "application/json");
var response = await client.PostAsync(
    "https://api.zenoti.com/v1/invoices/products", content);
var data = await response.Content.ReadAsStringAsync();
require 'net/http'
require 'json'

uri = URI('https://api.zenoti.com/v1/invoices/products')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'bearer {{access_token}}'
request['application_name'] = 'Name of the application'
request['application_version'] = 'The version of the application'
request['Content-Type'] = 'application/json'
request.body = { RAW_BODY: 'string' }.to_json
response = http.request(request)
data = JSON.parse(response.body)

Error codes

Status Description
400 400
401 Unauthorized -- invalid or expired access token
429 Too many requests -- rate limit exceeded