Skip to main content
This guide shows how to query GraphQL endpoints using HttpClient from @injectivelabs/utils.

Setup

Authentication

If your GraphQL endpoint requires authentication, set the headers:

Making a Query

Structure your GraphQL query as a JSON string with query and optional variables:

Complete Example

Error Handling

GraphQL responses may contain errors even with a 200 status code. Always check for errors:
Last modified on March 30, 2026