API command line (syntic api)
Syntic Code is Syntic’s coding agent for the terminal. Its syntic api subcommands add a second job: managing your Syntic API resources from the same binary, without writing code. List models, upload files, run and collect batches, check usage, manage agents and keys, or send any raw request, all from a shell or a CI script.
When to use it
- Exploring the API: see which models you can use and try a request in seconds.
- Operations from CI: upload a file, submit a batch, wait for it and download results in a pipeline step.
- Quick admin tasks: list keys, check this month’s cost, find who has administrator rights.
- Debugging: send exactly the request your code sends and see the full response with headers.
Install and authenticate
Install Syntic Code as usual (see Syntic Code (CLI)). syntic api picks a credential in this order:
| Source | Used for |
|---|---|
--api-key flag | One command. |
SYNTIC_API_KEY environment variable | Workspace commands (models, files, batches, agents, sessions). |
SYNTIC_ADMIN_KEY environment variable | Admin commands (syntic api admin ...). |
Your syntic login session | Workspace commands, when no key is set. Billed to your organization like any Syntic Code use. |
--base-url (or SYNTIC_BASE_URL) changes the host; the default is https://app.syntic.ai/v1.
Commands
| Command | What it does | API |
|---|---|---|
syntic api models list | Models you can use, with context window and prices. | GET /v1/models |
syntic api models get <name> | One model’s details. | GET /v1/models/{id} |
syntic api chat "<prompt>" [--model M] [--system S] | Send one message and print the reply, streamed. | POST /v1/chat/completions |
syntic api tokens count --file request.json | Count input tokens for a request body. | POST /v1/chat/completions/count_tokens |
syntic api files upload <path> --purpose P | Upload a file; prints its id. | POST /v1/files |
syntic api files list / get <id> / download <id> [-o path] / delete <id> | Manage files. | /v1/files |
syntic api batches create --input requests.jsonl | Upload a JSONL file and submit it as a batch. | POST /v1/files, POST /v1/batches |
syntic api batches wait <id> | Block until a batch ends, with a progress line. | GET /v1/batches/{id} |
syntic api batches results <id> [-o results.jsonl] | Download results. | Batch results file |
syntic api batches list / cancel <id> | Manage batches. | /v1/batches |
syntic api agents list / get <id> / apply -f agent.yaml | Read agents; create or update one from a file. | /v1/agents |
syntic api sessions start <agent> "<message>" [--follow] | Start a session and optionally stream its events. | /v1/sessions |
syntic api executions list [--state error] | Recent agent runs. | GET /v1/agents/executions |
syntic api usage [--since 7d] [--by model|workspace|key] | Tokens over time. | Usage report |
syntic api cost [--since 30d] [--by workspace] | Spend over time. | Cost report |
syntic api admin keys list [--unused-since 90d] | Inference keys in the organization. | GET /v1/organizations/api_keys |
syntic api admin keys disable <id> | Switch a key off. | PATCH /v1/organizations/api_keys/{id} |
syntic api admin members list [--role administrator] | Members. | GET /v1/organizations/users |
syntic api admin invite <email> [--role developer] | Invite someone. | POST /v1/organizations/invites |
syntic api request <METHOD> <path> [-d JSON|@file] | Any endpoint, raw. | Any |
Global flags
| Flag | Effect |
|---|---|
--json | Print the raw JSON response instead of a table. Lists are printed as one JSON array with every page fetched. |
--jq <expr> | Filter JSON output with a jq expression (built in; jq need not be installed). |
--include / -i | Also print status line and response headers. |
--beta <flag> | Add a syntic-beta flag. Commands that need one add it automatically. |
--api-version <date> | Send syntic-version. |
--workspace <id> | For admin commands that accept a workspace filter. |
Exit status is 0 on success, 1 for an API error (the error envelope is printed to stderr), and 2 for a usage mistake.
Examples
# What can I use?
syntic api models list
# Nightly batch in CI
BATCH=$(syntic api batches create --input tickets.jsonl --json --jq .id)
syntic api batches wait "$BATCH"
syntic api batches results "$BATCH" -o labelled.jsonl
# This week's tokens per model
syntic api usage --since 7d --by model
# Raw request with headers
syntic api request POST /v1/chat/completions -i \
-d '{"model": "Amara Quick", "stream": false, "messages": [{"role": "user", "content": "ping"}]}'Agent definitions as files
syntic api agents apply -f refund-desk.yaml creates the agent if no agent has that name, or updates it (making a new version) if one does. The file holds the same fields as the agent object:
name: refund-desk
model: Amara S1.2
instructions: |
You handle refund requests for Acme Store.
Look the order up before answering.
tools:
- type: function
function:
name: lookup_order
description: Fetch an order by its id.
parameters:
type: object
properties:
order_id: { type: string }
required: [order_id]
limits:
max_turns: 30--dry-run prints the change without making it, so the command fits a review-then-apply workflow in CI.
Build notes
- The Syntic Code team builds this, not the platform team; it needs the endpoints to exist first.
- Reuse the CLI’s existing credential handling and output formatting; pagination and retries follow the same rules as the SDKs.
- Never print secrets: key and vault commands show prefixes and hints only.