---
title: Worked examples
description: Common flows end to end — reading an order, managing entities, notes, quotes and production.
---

Every example assumes these two variables:

```bash
BASE="https://next.amfg.ai/engine-service/public-api/v1"
AUTH="Authorization: <secret>"
```

## Read an order and its parts

```bash
curl "$BASE/project?limit=1" -H "$AUTH"                                   # list confirmed orders
curl "$BASE/project/1001" -H "$AUTH"                                      # by id
curl "$BASE/project/lookup?projectSid=ACME-ORDER-1001" -H "$AUTH"        # by id, customId, projectSid or ticketSid
curl "$BASE/ticket-model?ticketId=1001" -H "$AUTH"                        # parts of that order
```

A part (`GET /ticket-model/2001`), trimmed:

```json
{
  "id": 2001,
  "ticketModelSid": "ACME-ORDER-1001-1",
  "ticketId": "1001",
  "quantity": 1,
  "statusName": "Quoted",
  "price": "250.00",
  "currencyCode": "USD",
  "sourceModelName": "bracket.stl",
  "productionTimes": {
    "cycleTime": 12.5,
    "programmingTime": 30,
    "setupTime": 15,
    "services": [
      {"id": 5001, "name": "Milling", "cycleTime": 12.5, "programmingTime": 30, "setupTime": 15}
    ]
  }
}
```

`productionTimes` comes from the last price calculation, with totals for the part and a breakdown per service. `PUT /ticket-model/:id` with new production parameters waits for the recalculation but returns only `{id}`, so read the new times with a follow-up `GET`.

Part geometry comes from `GET /model-version?ticketModelId=2001`. The `ticketModelId` filter is required there.

## Create, update and delete an entity

```bash
curl -X POST "$BASE/machine-group" -H "$AUTH" -H 'Content-Type: application/json' -d '{
  "name": "my group", "description": "", "customId": "mg-1",
  "technologyId": 3001, "size": {"x": 100, "y": 100, "z": 100}, "properties": {}
}'
# {"id": 4001}

curl -X PUT "$BASE/machine-group/4001" -H "$AUTH" -H 'Content-Type: application/json' -d '{
  "name": "my group v2", "description": "", "properties": {},
  "technologyId": 3001, "sizeX": 120, "sizeY": 120, "sizeZ": 120
}'
# {"id": 4001}

curl -X DELETE "$BASE/machine-group/4001" -H "$AUTH"
# {"id": 4001}
```

The update sends the whole record, as described in [Conventions](/engine-service/public-api/v1/docs/conventions#updates). Leaving out `sizeZ` returns a `400`.

## Production notes and meeting notes

```bash
curl -X POST "$BASE/production-note" -H "$AUTH" -H 'Content-Type: application/json' \
  -d '{"ticketModelIds": [2001], "text": "note"}'
# [{"id": "6001", "text": "note", "ticketModelIds": [2001]}]

curl -X POST "$BASE/meeting-note" -H "$AUTH" -H 'Content-Type: application/json' \
  -d '{"ticketId": "1001", "contactEmails": ["buyer@example.com"], "date": "2026-08-03", "text": "note"}'
# {"id": "6002"}
```

`contactEmails` must belong to a customer on that ticket, otherwise the call returns `404 Customer not found`.

## Create a quote

`POST /ticket/:ticketId/quote` sends the quote. It does not create a draft. These fields are required:

| Field | Type | Note |
| --- | --- | --- |
| `customerId` | number | The ticket's customer |
| `userId` | number | The user sending the quote. The secret identifies an App, not a user, so you must supply one. |
| `deliveryMethodName` | string | Must be a delivery option for the shipping address |
| `dueDateName` | string | Must exist in the App |
| `pdfTemplateName` | string | Must exist in the App |
| `currencyCode` | string | For example `USD` |
| `languageCode` | string | For example `en` |

`PUT /ticket-quote/:id` accepts `{"state": "accepted"}` or `{"state": "rejected"}`.

## Send to production

```bash
curl -X PUT "$BASE/ticket/1002/send-to-production" -H "$AUTH" -H 'Content-Type: application/json' \
  -d '{"ticketQuoteVersionId": "7001"}'
```

The call returns when production has accepted the order. Business rules come back as controlled errors, for example `422 {"code": 422, "message": "Customer not assigned"}`.
