CLI Reference

Run collections, import/export, and integrate with CI/CD.

npm install -g @apiark/cli

apiark run

Run all requests in a collection or folder sequentially.

apiark run <collection-path>

Flags

--env <name>Use a specific environment
--data <file>Data-driven testing with CSV, JSON, or YAML file
--reporter <type>Output format: json, junit, html (default: json)
--delay <ms>Delay between requests in milliseconds
--iterations <n>Number of times to run the collection
--bailStop on first failure

Example

$ apiark run ./my-api --env production --reporter junit
$ apiark run ./my-api/users --data users.csv --iterations 3

apiark import

Import a collection from another tool.

apiark import <file>

Flags

--format <type>Source format: postman, insomnia, openapi, bruno, har, curl
--output <dir>Output directory (default: current directory)

Example

$ apiark import postman-collection.json --format postman
$ apiark import openapi.yaml --format openapi --output ./my-api

apiark export

Export a collection to another format.

apiark export <collection-path>

Flags

--format <type>Target format: postman, openapi
--output <file>Output file path

Example

$ apiark export ./my-api --format postman --output my-api.postman.json
$ apiark export ./my-api --format openapi --output openapi.yaml

apiark lint

Validate collection YAML files for errors and warnings.

apiark lint <collection-path>

Example

$ apiark lint ./my-api

apiark mock

Start a local mock server based on collection examples.

apiark mock <collection-path>

Flags

--port <number>Port to listen on (default: 4000)

Example

$ apiark mock ./my-api --port 8080

Exit Codes

0All tests passed
1One or more tests failed
2Collection or file not found
3Invalid configuration
4Network error