API · v1 · stable
CODEMETA OSDeveloper Center
EN
Open console
Tutorial

Create your first ticket with curl

Reading time · 6 minUpdated · 1 May 2026

This tutorial shows the complete path: sign-in, tenant context, POST request with an idempotency key, and what the server response looks like.

Prerequisites

  • Account with the ticket_create permission in the target tenant.
  • A second factor set up (required for session cookies) — or an API key, see Auth & sessions.
  1. Sign-in. Codemeta OS responds to a successful sign-in with a Set-Cookie header. -c cookies.txt stores it locally.

    curl -X POST https://os.codemeta.de/api/auth/sign-in/email \
      -H "Content-Type: application/json" \
      -c cookies.txt \
      -d '{"email":"alice@example.com","password":"…"}'
  2. Set the tenant.

    export TENANT="0192f2c0-8d1c-7a3b-9e4f-d3e7f1a2b5c8"

    You can see which tenant IDs are available to your account in the web interface under Profile or via the profile endpoint.

  3. Generate an idempotency key. On macOS/Linux:

    export IDEM_KEY=$(uuidgen)

    The key is a client-side property. You can send the same key multiple times; on the second call the backend responds with the same result without creating a second record.

  4. Create the ticket.

    curl -X POST https://os.codemeta.de/api/v1/tickets \
      -H "X-Tenant-Id: $TENANT" \
      -H "Content-Type: application/json" \
      -H "X-Idempotency-Key: $IDEM_KEY" \
      -b cookies.txt \
      -d '{
        "title": "Printer stuck in the lobby",
        "description": "Paper jam, cannot be cleared.",
        "priority": "normal"
      }'
  5. Read the response. On success you get 201 Created with the newly created ticket in the body:

    {
      "id": "01938421-…",
      "number": "T-2026-00042",
      "tenantId": "0192f2c0-…",
      "schema": "ticket",
      "version": 1,
      "title": "Printer stuck in the lobby",
      "priority": "normal",
      "status": "open",
      "createdAt": "2026-05-01T09:14:22.531Z",
      "createdBy": "0193…"
    }

    Note down id (for API calls) and number (for communication with users). Learn more under Sequence numbers.

Where to go from here

Search