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.
1. Install
Section titled “1. Install”brew install hungovercoders/tap/apicmacOS and Linux. The tap is hungovercoders/homebrew-tap;
the cask installs the binary, the man pages and shell completions, and
brew upgrade follows releases.
go install github.com/hungovercoders/apic/cmd/apic@latest # Go 1.25.7 or newerWithout Homebrew:
curl -fsSL https://raw.githubusercontent.com/hungovercoders/apic/main/install.sh | sh| APIC_VERSION=v1.2.3 sh pins a version, | APIC_INSTALL_DIR=~/bin sh
chooses where it lands; the variable goes before sh, which runs the
installer. The installer verifies the release checksum.
Each release has packages for Debian and Ubuntu, Fedora and RHEL, and Alpine, for amd64 and arm64, with the man pages and shell completions:
V=0.2.0 # the release, without the vA=amd64 # or arm64BASE=https://github.com/hungovercoders/apic/releases/download/v$V
curl -fsSLO "$BASE/apic_${V}_linux_${A}.deb" && sudo dpkg -i "apic_${V}_linux_${A}.deb" # Debian, Ubuntucurl -fsSLO "$BASE/apic_${V}_linux_${A}.rpm" && sudo rpm -i "apic_${V}_linux_${A}.rpm" # Fedora, RHELcurl -fsSLO "$BASE/apic_${V}_linux_${A}.apk" && apk add --allow-untrusted "apic_${V}_linux_${A}.apk" # AlpineThere is no apt, yum or apk repository, so upgrading means installing
the next release’s package. The packages are listed in checksums.txt
with the archives; verifying.md checks them the same way.
The apk is unsigned, hence --allow-untrusted: check its checksum first.
irm https://raw.githubusercontent.com/hungovercoders/apic/main/install.ps1 | iexIt installs apic.exe into %LOCALAPPDATA%\Programs\apic, verifies
the release checksum, and adds the directory to your user PATH.
$env:APIC_VERSION = "v1.2.3" pins a version, $env:APIC_INSTALL_DIR
chooses the directory and $env:APIC_NO_MODIFY_PATH = "1" leaves PATH
alone. The zip is also on GitHub Releases
to install by hand.
docker run --rm -v "$PWD:/work" ghcr.io/hungovercoders/apic versionThe image is the binary on scratch, about 16 MB (about 7 MB to pull),
for amd64 and arm64.
The project directory is mounted at /work; see
the cookbook for CI systems that run
containers.
Check it with apic version.
2. See it work before writing anything
Section titled “2. See it work before writing anything”apic ui --demoThat 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:
apic run login whoami -C apic-demoapic run todos.http -C apic-demo --keep-goingapic run jobs.http -C apic-demo # submit a job and poll it to doneapic test -C apic-demoRead 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.
3. Create a project
Section titled “3. Create a project”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:
apic init api --base-url https://dev.example.com --env devapi/ 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: devhttp-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:
apic import openapi.yaml -o api4. Write requests
Section titled “4. Write requests”api/auth.http:
### Log in and keep the token# @name login# @assert status == 200# @capture token = body.$.access_tokenPOST {{baseUrl}}/auth/loginContent-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.$.idPOST {{baseUrl}}/usersContent-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:
cd apiapic validateapic listapic list user # only requests matching "user"5. Run requests
Section titled “5. Run requests”apic run get-userThe 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/#e101So log in (or add # @ref login to get-user and apic does this for you;
see dependencies):
apic run loginPOST https://dev.example.com/auth/login200 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:
apic run get-userapic run get-user --env staging # separate session, needs its own loginapic describe get-user # see where each variable comes fromapic session # what is capturedapic session clear # forget itOverride anything for one run:
apic run get-user --var userId=7Run a whole file in order as a flow. It stops at the first failure and exits 1 if anything failed:
apic run users.httpapic run users.http --keep-going6. Use the output in scripts
Section titled “6. Use the output in scripts”apic run get-user --body-only | jq .emailapic 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:
| Code | Meaning |
|---|---|
| 0 | ok |
| 1 | an assertion or capture failed |
| 2 | usage, parse error, unknown request or missing variable |
| 3 | network error or timeout |
7. Put it in CI
Section titled “7. Put it in CI”- 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.
8. Add authentication
Section titled “8. Add authentication”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.
9. Describe behaviour in Gherkin
Section titled “9. Describe behaviour in Gherkin”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} existsPOST {{baseUrl}}/usersContent-Type: application/json
{"name": "{{name}}", "email": "{{name}}@example.com"}
### Fetch a user# @name get-user# @step I fetch the userGET {{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"apic test # features/ under the projectapic test --format junit --output report.xmlSee testing.md for the full vocabulary.
10. Hand it to an agent
Section titled “10. Hand it to an agent”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:
claude mcp add api -- apic mcp --dir ./api --env devSee 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
.httpdialect 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