Skip to main content
POST
/
v1
/
orders
Create Order
curl --request POST \
  --url https://api.example.com/v1/orders \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "type": "<string>",
  "customerId": "<string>",
  "locationId": "<string>",
  "scheduledAt": "<string>",
  "services": [
    {
      "id": "<string>",
      "quantity": 123,
      "staffId": "<string>"
    }
  ],
  "notes": "<string>",
  "sendConfirmation": true
}
'

Create Order

Create a new order, booking, or enquiry.

Endpoint

POST /v1/orders

Authentication

Authorization
string
required
Bearer token with orders:write scope

Request Body

type
string
required
Order type: booking, sale, enquiry
customerId
string
required
Customer ID for the order
locationId
string
required
Location ID where service occurs
scheduledAt
string
Scheduled date/time (ISO 8601) - required for bookings
services
array
required
Array of services/products
notes
string
Order notes
sendConfirmation
boolean
default:"true"
Send confirmation email to customer

Request Example

curl -X POST "https://api.tiquo.co/v1/orders" \
  -H "Authorization: Bearer sk_live_xxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "booking",
    "customerId": "cust_xyz789",
    "locationId": "loc_def456",
    "scheduledAt": "2024-01-25T10:00:00Z",
    "services": [
      {
        "id": "svc_123",
        "quantity": 1,
        "staffId": "staff_abc"
      }
    ],
    "notes": "Requested morning appointment"
  }'

Response Example

{
  "success": true,
  "data": {
    "id": "ord_new123",
    "type": "booking",
    "status": "confirmed",
    "customerId": "cust_xyz789",
    "locationId": "loc_def456",
    "scheduledAt": "2024-01-25T10:00:00Z",
    "duration": 60,
    "services": [
      {
        "id": "svc_123",
        "name": "Consultation",
        "price": 75.00,
        "quantity": 1,
        "staffId": "staff_abc",
        "staffName": "Jane Smith"
      }
    ],
    "subtotal": 75.00,
    "tax": 6.56,
    "total": 81.56,
    "paymentStatus": "pending",
    "notes": "Requested morning appointment",
    "confirmationSent": true,
    "createdAt": "2024-01-20T14:30:00Z"
  }
}

Availability Check

Before creating a booking, check availability:
POST /v1/availability/check
{
  "locationId": "loc_def456",
  "serviceId": "svc_123",
  "date": "2024-01-25",
  "staffId": "staff_abc"
}

Validation Rules

FieldRule
typeRequired: booking, sale, or enquiry
customerIdMust exist
locationIdMust exist and be active
scheduledAtRequired for bookings, future date
servicesAt least one required

Errors

CodeDescription
400Validation error
401Invalid API key
403Missing orders:write scope
404Customer or location not found
409Time slot unavailable

409 Conflict Example

{
  "success": false,
  "error": {
    "code": "conflict",
    "message": "The requested time slot is not available",
    "availableSlots": [
      "2024-01-25T11:00:00Z",
      "2024-01-25T14:00:00Z"
    ]
  }
}

Code Examples

const response = await fetch('https://api.tiquo.co/v1/orders', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${apiKey}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    type: 'booking',
    customerId: 'cust_xyz789',
    locationId: 'loc_def456',
    scheduledAt: '2024-01-25T10:00:00Z',
    services: [{ id: 'svc_123', quantity: 1 }]
  })
});

const { data: order } = await response.json();
console.log('Created order:', order.id);