Skip to content
apigent import

apigent import

Import requests from OpenAPI, Insomnia, Bruno, Postman, HAR or a native apigent export. The format is detected from the file unless you force it with --format: an extension used by one format (.bru, .har, .gurl) decides on its own, and for .json the document’s top-level keys decide (openapi, Postman info + item, Insomnia _type/resources, HAR log, Yaak collections).

Synopsis

apigent import <path> [flags]
apigent import --list

Supported inputs (apigent import --list):

ExtensionFormat
.yaml, .ymlOpenAPI/Swagger 3.x
.jsonOpenAPI, Postman, Insomnia, HAR, Yaak (detected from the content)
.bruBruno
.harHAR (HTTP Archive)
.gurlNative apigent request or collection export

Flags

FlagShortDefaultDescription
--force-ffalseOverwrite existing requests with the same name
--format--fmtdetectedImport as openapi, postman, insomnia, har, bruno, yaak or gurl
--list-lfalseList all supported formats
--base-urlspec serverOpenAPI only: URL to use instead of the spec’s first server, e.g. '{{BASE_URL}}'
--collection-cnonePut the requests in this collection, created if missing (in the .apigent/ project when there is one)
--passphrasenonePassphrase for decrypting native collection exports (or set APIGENT_IMPORT_PASSPHRASE)

Aliases

  • imp

Examples

Import an OpenAPI spec

apigent import ./api.yaml

Import an OpenAPI spec into a project collection that follows the environment

apigent init
apigent import ./openapi.json --collection my-api --base-url '{{BASE_URL}}' --force
apigent env create local --var BASE_URL=http://localhost:3000 --var token=- --secret token
apigent run getUserById --env local --var id=42

An imported OpenAPI request is runnable as is: path parameters and required query parameters are {{name}} placeholders, bearer auth uses {{token}}, and JSON bodies are filled from the schema’s examples, defaults and types.

Re-import a Postman collection, overwriting existing requests

apigent import ./my-collection.json --force

Import a teammate’s collection export

apigent import ./payments.gurl --passphrase "$TEAM_SECRET"

Related commands