Create an order

このページは 日本語 ではまだ利用できません。デフォルトの言語 (English) で表示しています。

Create an order

POSThttps://api.cekat.ai/api/orders

Creates an order and its invoice. Identify the customer with conversation_id, contact_id or phone_number; if no contact matches, a new one is created from phone_number and display_name.

For each product, send a product_id from your catalog (its catalog name and price are used) or a product_name and price for a custom item. The grand total (subtotal − discount + shipping fee + VAT) must be between 1 and 9,999,999,999.

Authorization

api_keystringheaderrequired

Your Cekat API key, from Settings → Developers & API in the Cekat dashboard.

Authorizationstringheader

Alternative to api_key: send the same key as Bearer YOUR_API_KEY.

Body application/jsonrequired

payment_methodstringrequired
Available options: manual, xendit, custom
orders_productsobject[]required
min items: 1
Show child attributes
product_idstring<uuid>

A catalog product. Leave out for a custom item.

product_namestring

Name of a custom item.

pricenumber

Price of a custom item.

quantityinteger
default: 1
conversation_idstring<uuid>
contact_idstring<uuid>
phone_numberstring
display_namestring

Required with phone_number when the contact is new.

emailstring<email>
bank_account_numberstring

Required for manual. A payment bank account set up in Cekat.

custom_invoice_urlstring<uri>

Required for custom.

discountnumber
default: 0min: 0
shipping_feenumber
default: 0min: 0
vatnumber
default: 0min: 0
addressstring
notesstring
idstring<uuid>

Optional order ID (UUID v4) to use instead of a generated one.

created_atstring<date-time>

Optional order date, for importing past orders.

Response

201
400
401
404
429

Order and invoice created.

messagestring
dataOrder

An order with its contact, products and invoices. Additional fields may be present.

Show child attributes
idstring<uuid>
order_numberinteger
created_atstring<date-time>
order_statusstring
Available options: pending, processing, shipping, cancelled, completed
payment_methodstring
Available options: manual, xendit, custom
subtotalnumber
discountnumber
shipping_feenumber
vatnumber
grand_totalnumber
currencystring | null
addressstring | null
notesstring | null
contact_idstring<uuid>
conversation_idstring<uuid> | null
contactobject
Show child attributes
idstring<uuid>
display_namestring
phone_numberstring | null
emailstring | null
cekat_orders_productsOrderProduct[]
Show child attributes
idstring<uuid>
product_idstring<uuid> | null
product_namestring
quantityinteger
pricenumber
invoicesInvoice[]

The order's invoices, newest first.

Show child attributes
idstring
statusstring
Available options: PENDING, PAID, EXPIRED, SETTLED
amountnumber
is_sentboolean | null
expiry_datestring | null
created_atstring<date-time>

A required field is missing, or a value is out of range.

successboolean
messagestring
statusCodeinteger
errorobject
Show child attributes
messagestring
correlationIdstring

Request ID. Include it when contacting Cekat support.

The API key is missing or invalid.

successboolean
messagestring
statusCodeinteger
errorobject
Show child attributes
messagestring
correlationIdstring

Request ID. Include it when contacting Cekat support.

The bank account was not found.

successboolean
messagestring
statusCodeinteger
errorobject
Show child attributes
messagestring
correlationIdstring

Request ID. Include it when contacting Cekat support.

Rate limit exceeded. Wait and retry.

messagestring
POST/api/orders
cURL
JavaScript
Python
PHP
curl --request POST \
  --url 'https://api.cekat.ai/api/orders' \
  --header 'api_key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "payment_method": "manual",
  "orders_products": [
    {
      "product_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "product_name": "Kopi Susu",
      "price": 10000,
      "quantity": 1
    }
  ]
}'
const response = await fetch('https://api.cekat.ai/api/orders', {
  method: 'POST',
  headers: { 'api_key': 'YOUR_API_KEY', 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "payment_method": "manual",
    "orders_products": [
      {
        "product_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "product_name": "Kopi Susu",
        "price": 10000,
        "quantity": 1
      }
    ]
  })
});

const data = await response.json();
console.log(data);
import requests

url = "https://api.cekat.ai/api/orders"
headers = {"api_key": "YOUR_API_KEY"}
payload = {
    "payment_method": "manual",
    "orders_products": [
        {
            "product_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
            "product_name": "Kopi Susu",
            "price": 10000,
            "quantity": 1
        }
    ]
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://api.cekat.ai/api/orders',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => ['api_key: YOUR_API_KEY', 'Content-Type: application/json'],
  CURLOPT_POSTFIELDS => json_encode([
    'payment_method' => 'manual',
    'orders_products' => [[
      'product_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
      'product_name' => 'Kopi Susu',
      'price' => 10000,
      'quantity' => 1
    ]]
  ]),
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
Response
201
400
401
404
429
{
  "message": "<string>",
  "data": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "order_number": 1,
    "created_at": "2026-01-15T09:30:00Z",
    "order_status": "pending",
    "payment_method": "manual",
    "subtotal": 10000,
    "discount": 10000,
    "shipping_fee": 10000,
    "vat": 10000,
    "grand_total": 10000,
    "currency": "<string>",
    "address": "<string>",
    "notes": "<string>",
    "contact_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "conversation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "contact": {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "display_name": "Jane Doe",
      "phone_number": "6281234567890",
      "email": "[email protected]"
    },
    "cekat_orders_products": [
      {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "product_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "product_name": "Kopi Susu",
        "quantity": 1,
        "price": 10000
      }
    ],
    "invoices": [
      {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "status": "PENDING",
        "amount": 10000,
        "payment_link": "<string>",
        "pdf_link": "<string>",
        "is_sent": true,
        "expiry_date": "2026-01-15",
        "paid_at": "2026-01-15T09:30:00Z",
        "created_at": "2026-01-15T09:30:00Z"
      }
    ]
  }
}
{
  "success": true,
  "message": "<string>",
  "statusCode": 1,
  "error": {
    "message": "<string>"
  },
  "correlationId": "<string>"
}
{
  "success": true,
  "message": "<string>",
  "statusCode": 1,
  "error": {
    "message": "<string>"
  },
  "correlationId": "<string>"
}
{
  "success": true,
  "message": "<string>",
  "statusCode": 1,
  "error": {
    "message": "<string>"
  },
  "correlationId": "<string>"
}
{
  "message": "<string>"
}