Postman CLI context-graph commands (postman context-graph)
Postman CLI context-graph commands (postman context-graph)
This topic covers the postman context-graph commands for the Postman CLI.
Your team’s Context Graph is Postman’s map of your team’s APIs and the dependencies between them. Use the postman context-graph commands to ask it natural-language questions, such as what depends on a given API, and to onboard GitHub repos and Postman workspaces into it. The team a query runs against is derived from your credentials, so there’s no workspace or team option.
These commands require authentication. Sign in with the postman login command, or pass a Postman API key with --api-key.
postman context-graph ask
Submits a natural-language question about your team’s Context Graph and returns an ask ID, which you check later with postman context-graph status. Use --wait to block until the answer arrives and print it. This is usually how you’ll want to run it, whether manually or using automation. Omit --wait only if you want to submit several asks without waiting, or need to poll on your own schedule. If an ask happens to finish before this command returns, it prints the answer instead of an ID.
Usage
The natural-language question to ask about your team’s Context Graph.
Options
Waits for the answer and prints it inline, instead of returning an ask ID.
Returns the ask record without including the answer inline.
How often to poll for the answer, in seconds. Accepts a value from 0.5 to 3600. Requires --wait.
How long to wait for the answer before giving up, in seconds, up to 86400 (24 hours). Requires --wait. If the wait times out, the ask keeps running in Postman, and you can check it later with postman context-graph status.
Prints the ask record as JSON for machine-readable output, instead of a table.
Authenticates with a Postman API key instead of your postman login session. Falls back to the POSTMAN_API_KEY environment variable.
Examples
Exit codes
postman context-graph status
Checks on an ask submitted with postman context-graph ask, without waiting. Provide the ask ID that ask returned. If the ask has finished, it prints the answer. Otherwise, it reports that the ask is still in progress.
Usage
The ID of the ask to check, returned by postman context-graph ask.
Options
Prints the ask record as JSON for machine-readable output, instead of a table.
Authenticates with a Postman API key instead of your postman login session. Falls back to the POSTMAN_API_KEY environment variable.
Examples
Exit codes
postman context-graph ingest
These commands add GitHub repos and Postman workspaces into your team’s Context Graph and check ingestion progress. Use ingest git to index a repo’s code and ingest workspaces to index a workspace’s specs, collections, and environments. To cover both for a Git-linked workspace, run both commands. The --all-git-linked-workspaces option of ingest git only discovers the linked repos and never ingests the workspace itself.
The commands return once each ingestion has started. Use postman context-graph ingest status to check progress. Re-running a command for a repo or workspace reuses its source and starts a fresh ingestion.
postman context-graph ingest git
This command adds GitHub repos into your team’s Context Graph by indexing each repo’s code. The team is derived from your credentials.
Usage
One or more GitHub repo URLs, in HTTPS or git@ SSH form, up to 500 per call. Optional when you pass --all-git-linked-workspaces.
Options
Also adds the repo linked to every Git-linked workspace in your team.
Limits --all-git-linked-workspaces to workspaces with this tag. Repeat the option to pass up to 5 tags. A workspace must match all of them.
Overrides the service’s default TTL, in seconds.
Prints the onboarding response as JSON.
Authenticates with a Postman API key instead of your postman login session. Falls back to the POSTMAN_API_KEY environment variable.
Example
Exit codes
postman context-graph ingest workspaces
This command adds Postman workspaces into your team’s Context Graph by indexing each workspace’s specs, collections, and environments. It doesn’t index the code of a linked repo. Use postman context-graph ingest git for that. Without --workspace, it adds your team’s Git-linked workspaces.
Usage
Options
The ID of a workspace to onboard. Repeat the option to onboard more than one workspace.
Caps how many workspaces this call adds.
Overrides the service’s default TTL, in seconds.
Prints the onboarding response as JSON.
Authenticates with a Postman API key instead of your postman login session. Falls back to the POSTMAN_API_KEY environment variable.
Examples
Exit codes
postman context-graph ingest status
This command checks ingestion progress for your team, or for one source. Without --source, it prints a team-wide summary by each source’s latest job status. It doesn’t wait for ingestion to finish.
Usage
Options
Shows the jobs for one source, by the source ID that ingest git or ingest workspaces printed.
Prints the service response as JSON.
Authenticates with a Postman API key instead of your postman login session. Falls back to the POSTMAN_API_KEY environment variable.