Skip to main content

Order Schema, Identifiers & Creation

Canonical fields, IDs/references, and how to create an order safely.

C
Written by Catalin Fetean
Updated over 3 weeks ago

Audience: Devs, Finance, PMs
Prerequisites: Active contract; logged in
Outcomes: Consistent schema; a saved order with milestones and due dates

Core fields (reference)

Field

Type

Req

Example

id

string

ord_456

contractId

string

ct_123

title

string

“Landing page redesign”

total

integer

150000

currency

ISO-4217

USD

milestones[]

array

see below

status

enum

Created

reference

string

external PO

Milestone

  • id (e.g., m1), name, amount, acceptance (short text), dueAt (UTC)

Deliverable

  • id (e.g., dlv_789), files[] (hash + name + size + MIME), submittedBy, submittedAt, status (submitted/accepted/rejected), notes

IDs & references

  • Internal IDs: ord_, milestones m<n>, deliverables dlv_

  • Add a business reference (PO/ticket) for reconciliation & idempotency

Create an order — UI

Contracts → ActiveCreate order → enter title, currency, total → add milestones (amount, acceptance, dueAt) → Save (autosave every few seconds).

Create an order — API

curl -X POST $API_BASE/api/orders -b cookies.txt \ -H 'Content-Type: application/json' \ -d '{ "contractId":"ct_123", "title":"Landing page redesign", "total":150000, "currency":"USD", "reference":"PO-4421", "milestones":[ {"id":"m1","name":"Wireframes","amount":50000,"acceptance":"Figma links + walkthrough","dueAt":"2025-09-01T00:00:00Z"}, {"id":"m2","name":"Final design","amount":100000,"acceptance":"Assets + styleguide","dueAt":"2025-09-15T00:00:00Z"} ] }'

Validation

  • Sum of milestone amounts ≤ total

  • Unique milestone IDs

  • Currency must be ISO-4217

Edge cases

  • No milestones supplied → add later

  • Duplicate reference409 (if idempotency enforced)

QA checklist

  • Create, fetch, list, export

  • Storage in UTC, display in user locale

Runbook: “Sum of milestones exceeds total”

  • Adjust amounts or total; re-save

Did this answer your question?