Init command
This topic covers the postman init command for the Postman CLI.
postman init
Use the postman init command to set up an AI-ready API project in your local repository. In a single step, it creates the Postman Native Git project structure, can generate a starting API specification from your code, and adds a SKILL.md that teaches AI agents how to build and test the API with the Postman CLI.
When you run postman init, it does the following:
- Detects or creates the
postman/project structure and the.postman/resources.yamlconfiguration file. If thepostman/directory already contains source code,postman initstops without writing anything. - Adds a starting API specification. If your repository already has an OpenAPI, Swagger, or AsyncAPI specification,
postman initadopts it. If not, and your app uses Flask, it derives a starting OpenAPI specification from your routes. If neither applies, it doesn’t add a specification. - Adds a
SKILL.mdguide underpostman/skills/, along with a rootAGENTS.mdfile that points to it, so AI agents know how to build and test the API with the Postman CLI. - If you’re signed in, it offers to create a new Postman workspace and connect your project to it. You can skip this step with
--no-cloud.
In CI, postman init doesn’t create a workspace. In this case, create and connect the workspace locally with postman workspace create, then commit .postman/resources.yaml so your CI builds inherit the connection.
Usage
The path to the repository to set up. Defaults to the current directory.
Options
Specifies which specification is authoritative when more than one could apply.
Don’t derive a specification from your source code.
Sets the visibility of the workspace postman init creates: personal (private to you) or team (shared with your team). If you omit it, postman init prompts you when it offers to create a workspace.
Skips creating and connecting a workspace.
Reports what the command would do without writing anything.
Prints the result of the run as JSON for AI agents to parse, instead of the human-readable report. The JSON includes the project layout, the specification postman init chose, and the changes it made. In this mode, postman init doesn’t create or connect a workspace.
Sends postman init usage analytics to Postman. Requires signing in.
Examples
Exit codes
The postman init command sets a process exit code so scripts, CI pipelines, and AI agents can act on the result. The code isn’t part of the command’s output. To read it, check $? in your shell after the run (for example, echo $?), or let CI use it, where a non-zero code fails the step.
In --json mode, the same code is also in the exitCode field of the output, along with a refusal field. For an agent, read those fields instead of matching messages on the console.
Learn more at Native Git workflows.