Insomnia logo
  • Documentation
  • Download
  • Upgrade
    • Introduction to Insomnia
    • Install Insomnia
    • Send Your First Request
    • Import and Export Data
    • Environment Variables
    • Insomnia Workspaces
    • Insomnia Accounts
    • Forgotten Passwords
    • Change Password
    • Insomnia Teams
    • Insomnia Subscriptions
    • Insomnia Subscription Management
    • Requests
    • Responses
    • Request Collections
    • Request Timeouts
    • Chaining Requests
    • Post CSV Data
    • SOAP Requests
    • gRPC
    • WebSocket Support
    • Get Started with Documents
    • Design Documents
    • Linting
    • GraphQL for OpenAPI
    • Migrate from Designer
    • Unit Testing
    • Stress Testing
    • Sign into Insomnia Cloud
    • Sync Collections with Insomnia Cloud
    • Teams
    • End to End Data Encryption
    • Sync with Git
    • Key Security Features
    • Security Standards
    • Signup and Authentication
    • Analytics Collected
    • Authentication
    • Client Certificates
    • Generate Code Snippet
    • Cookie Management
    • Encoding
    • GraphQL Queries
    • Run in Insomnia Button
    • Key Maps
    • HTTP(S) Proxy
    • Insomnia Configuration File
    • Introduction to Plugins
    • Context Object Reference
    • Template Tags
    • Hooks and Actions
    • Custom Themes
    • FAQ
    • Application Data
    • SSL Validation
    • Password Recovery
    • Introduction to Inso CLI
    • Install Inso CLI
    • CLI Command Reference
      • inso generate config
      • inso run test
      • inso lint spec
      • inso export spec
      • inso script
      • OpenAPI Spec Reference
    • Configuration
    • Inso CLI on Docker
    • Continuous Integration
    • Publish API to Dev Portal
    • Kong Declarative Config (for decK)
    • Kong for Kubernetes

Chaining Requests

Insomnia allows chaining requests, or the ability to extract values from the responses of other requests. Values are passed using Template Tags and Environment Variables.

The following are common use cases for chaining requests:

  • use a token from a login response as an Authorization header
  • use the ID from POST /items in PUT /items/{id}
  • use an entire body from one response in another request

Select Response Tag

In an empty URL bar or following a URL symbol such as / or =, either press CTRL+Space to open the autocomplete dropdown or start typing “response”.

There are three response options:

  • Response - Body Attribute
    • Works on JSON and XML responses, pulling attributes from a response body.

      Use either JSONPath or XPath queries (depending on the Content-Type) to extract specific attributes from a response body. For example, a login request may respond with a JSON object that looks like {"auth_token": "secret-token"}. This allows you to use a JSONPath filter of $.auth_token to reference the token itself in a subsequent request.

  • Response - Raw Body
    • References the entire body contents of a request. This can be useful if you download content in one request that needs to be uploaded in another.
  • Response - Header
    • Pulls specific header values out of a response.

The Response tag can be used anywhere Environment Variables are supported.

Configure a Tag

Click on the tag in the URL bar to configure it. An Edit Tag modal will open. Select options from the first four fields:

  • Function to Perform: select the function to perform or value to reference.
  • Attribute: select the value to perform the action on.
  • Request: select the request to apply the configure onto.
  • Trigger Behavior: select the application behavior that populates the tag. Click on the cog button to select either Static Value or Environment Variable.
  • Live Preview: outputs what the tag populates.

The Edit Tag modal enables you to customize the tag functionality. In the Edit Tag modal, customize the tag functionality.

Edit this page
Report an issue
    COMPANY
  • Insomnia
  • Blog
  • Changelog
  • Pricing
  • Careers
    PRODUCTS
  • Insomnia
  • Inso (CLI)
    RESOURCES
  • Sign In
  • Documentation
  • Support
    LEGAL
  • Privacy Policy
  • Terms & Conditions
© Kong Inc. 2021