Skip to content

Getting started

This walks through installing apic, describing an API in .http files, logging in once and reusing the token, wiring it into CI, and handing the same files to an AI agent. It takes about ten minutes.

Terminal window
brew install hungovercoders/tap/apic

macOS and Linux. The tap is hungovercoders/homebrew-tap; the cask installs the binary, the man pages and shell completions, and brew upgrade follows releases.

Check it with apic version.

Terminal window
apic ui --demo

That serves a small fake API inside the same process and opens the terminal UI on an example project pointing at it. Press enter to send the request under the cursor, f to run a whole file as a flow, ? for every key, q to quit. Nothing is left behind.

The same example works from the plain CLI: apic demo writes it to ./apic-demo and serves the API, then in another terminal:

Terminal window
apic run login whoami -C apic-demo
apic run todos.http -C apic-demo --keep-going
apic run jobs.http -C apic-demo # submit a job and poll it to done
apic test -C apic-demo

Read apic-demo/auth.http, todos.http, jobs.http and explore.http to see the files behind those commands. Between them they cover login and API keys, a CRUD flow with filtering and a validation error, a job that finishes after a couple of polls, a slow endpoint, a CSV download and a GraphQL query, so every guide in these docs has something to run against.

A project is any directory containing .http files. Keeping them in an api/ folder next to your code works well. apic init writes a working starting point:

Terminal window
apic init api --base-url https://dev.example.com --env dev
api/
apic.yaml
http-client.env.json
http-client.private.env.json
api.http
features/smoke.feature
.gitignore
.claude/skills/apic/ the Agent Skill (--no-skill leaves it out;
.agents/skills/apic/ apic skill install --all adds two more)

apic.yaml sets defaults so you do not repeat flags:

env: dev

http-client.env.json holds per-environment values. $shared applies to every environment.

{
"$shared": { "userId": 42 },
"dev": { "baseUrl": "https://dev.example.com", "user": "alice" },
"staging": { "baseUrl": "https://stg.example.com", "user": "alice" }
}

http-client.private.env.json has the same shape and holds secrets. apic init gitignores it for you. apic masks values from this file wherever it prints variables.

{
"dev": { "password": "s3cret" },
"staging": { "password": "other" }
}

If you already have an OpenAPI document, let apic write the first draft:

Terminal window
apic import openapi.yaml -o api

api/auth.http:

### Log in and keep the token
# @name login
# @assert status == 200
# @capture token = body.$.access_token
POST {{baseUrl}}/auth/login
Content-Type: application/json
{"user": "{{user}}", "password": "{{password}}"}

api/users.http:

### Fetch a user
# @name get-user
# @description Fetch a single user by id
# @assert status == 200
# @assert body.$.id == {{userId}}
GET {{baseUrl}}/users/{{userId}}
Authorization: Bearer {{token}}
Accept: application/json
### Create a user
# @name create-user
# @assert status == 201
# @capture newUserId = body.$.id
POST {{baseUrl}}/users
Content-Type: application/json
{"name": "{{user}}", "email": "{{user}}@example.com"}

These are ordinary .http files. Open them in VS Code with the REST Client extension, in a JetBrains IDE, or in Neovim with kulala, and the “Send Request” action works as usual. apic’s # @ lines are comments to those tools.

Check the files parse, and see what you have:

Terminal window
cd api
apic validate
apic list
apic list user # only requests matching "user"
Terminal window
apic run get-user

The first time, this fails with exit code 2 and tells you why:

error: users.http:6: missing variable
{{token}}: it is captured by request "login"; run `apic run login` first, or pass --var token=...
E101 missing variable · see https://apic.sh/errors/#e101

So log in (or add # @ref login to get-user and apic does this for you; see dependencies):

Terminal window
apic run login
POST https://dev.example.com/auth/login
200 OK · 87 ms · 412 B
{ "access_token": "eyJ..." }
✓ status == 200
↳ token = eyJ...

The token is now in api/.apic/session.json for the dev environment (the directory ignores itself from git). Every later run in dev can use {{token}} until you clear it or log in again:

Terminal window
apic run get-user
apic run get-user --env staging # separate session, needs its own login
apic describe get-user # see where each variable comes from
apic session # what is captured
apic session clear # forget it

Override anything for one run:

Terminal window
apic run get-user --var userId=7

Run a whole file in order as a flow. It stops at the first failure and exits 1 if anything failed:

Terminal window
apic run users.http
apic run users.http --keep-going
Terminal window
apic run get-user --body-only | jq .email
apic run users.http --json | jq -c '{name: .request.name, ok, status: .response.status}'

Exit codes make apic safe in set -e scripts and CI steps:

CodeMeaning
0ok
1an assertion or capture failed
2usage, parse error, unknown request or missing variable
3network error or timeout
.github/workflows/smoke.yml
- uses: hungovercoders/apic/setup-apic@v0
- run: apic validate -C api --format github
- run: apic run auth.http users.http -C api --env staging --json --redact
env:
APIC_VAR_password: ${{ secrets.API_PASSWORD }}

The setup-apic action installs the latest release (or with: version: v0.2.0 to pin one), verifies it against the published checksums, caches it and puts it on PATH, on Linux, macOS and Windows runners. On any other CI system, curl -fsSL https://raw.githubusercontent.com/hungovercoders/apic/main/install.sh | sh does the same job, and where tools come as images there is ghcr.io/hungovercoders/apic. --format github turns each validation problem into an annotation on the pull request at the right line.

APIC_VAR_<name> environment variables override values from the env files, so secrets never need to be in a file on the runner. --redact masks header values, bodies, query values and captures in the stored log; sensitive headers are masked even without it. apic run runs targets in the order given, so auth.http users.http logs in first.

If the API needs more than a bearer token, put it in the file or the project config and apic handles it at send time:

# @auth aws service=execute-api region=eu-west-2
# @auth basic {{user}} {{password}}
# @auth oauth2 tokenUrl={{tokenUrl}} clientId={{clientId}} clientSecret={{clientSecret}}

AWS uses your existing credentials (environment, profiles, SSO via the AWS CLI); OAuth2 tokens are cached and refreshed. See auth.md.

Add phrases to requests and write features; apic runs them with no Cucumber runtime:

### Create a user
# @name create-user
# @step a user named {name} exists
POST {{baseUrl}}/users
Content-Type: application/json
{"name": "{{name}}", "email": "{{name}}@example.com"}
### Fetch a user
# @name get-user
# @step I fetch the user
GET {{baseUrl}}/users/{{userId}}
Feature: Users
Scenario: Fetch a user by id
Given I run "login"
And a user named "alice" exists
When I fetch the user
Then the response status is 200
And the response body "$.name" is "alice"
Terminal window
apic test # features/ under the project
apic test --format junit --output report.xml

See testing.md for the full vocabulary.

Add to your project’s AGENTS.md or CLAUDE.md:

API requests live in api/*.http and are run with apic from the api/ directory:
`apic list --json`, `apic describe <id> --json`, `apic run <id> --json`.
Run `apic run login` once before requests that need {{token}}.

Or register the MCP server so the agent calls requests as tools:

Terminal window
claude mcp add api -- apic mcp --dir ./api --env dev

See agents.md for the details.

  • cheatsheet.md: every directive, selector and operator on one page
  • cookbook.md: worked recipes for CI, AWS, OAuth2, uploads and polling
  • format.md: everything the .http dialect supports
  • cli.md: every command and flag
  • tui.md: the terminal UI
  • faq.md: short answers when something misbehaves

Hosted on Cloudflare, which keeps aggregate traffic statistics. No cookies, no tracking scripts, no per-request logs. Privacy