Connect to StepZen

How to get your endpoint URL, API key and use API testing tools like Postman.

After your API is up and running, you will likely want to connect to it via your application's frontend or an API testing tool like Postman. In order to do so, you'll need to use your StepZen API key. This is available on your My Account page. This topic explains how to use it.

Get Your Endpoint URL

The stepzen start command will automatically open a browser with a GraphiQL editor to test your API. The editor will already have a connection open to the project that is deployed on StepZen. It will also provide you the URL you'll need to connect to your API via your frontend application or API testing tool in two places:

  • The bottom-right-hand side of the GraphiQL editor as shown here:

    endpoint in GraphiQL

  • As output from the stepzen start command:

Deploying to StepZen...... done

Successfully deployed api/example at 4:22:19 PM

Your endpoint is available at https://myaccount.stepzen.net/api/example/__graphql

The sections below show how to use that endpoint in your frontend or via popular API testing tools.

You can see a full list of all the APIs you've deployed to StepZen by running stepzen list schemas from the command line.

Get Your StepZen API Key

In order to connect to StepZen from outside of the GraphiQL editor launched by stepzen start, you'll need to use your API key. This is always accessible via your My Account page, which has three items:

  • Your account name: Your endpoint URL will always start with your account name in the following format https://{ACCOUNT}.stepzen.net.
  • Your admin API key: This key allows you to make changes to your account, such as deploying new or updated code to StepZen. This is the key you enter when logging into the StepZen CLI that allows commands like stepzen start to automatically deploy your API and connect to it.
  • Your API key: This key is needed to connect to the APIs you deploy to StepZen. Querying your APIs, whether via code or an API testing tool, requires that you pass this key via the Authorization header in the following format:
Authorization: apikey {APIKEY}

The following sections show some examples of connecting to a StepZen API.

Call Your StepZen API From JavaScript

It's important that you do not expose your API key publicly. Therefore, you must not call your StepZen API directly from the browser as anyone could inspect the request and gain access to your API key. Instead, invoke the API call on the server or via a serverless function, both of which can be written in Node.js.

Connect Using API Testing Tools

Although stepzen start provides a very helpful GraphiQL editor for testing your API, you may want to use some other popular tools:

Postman

Follow the steps below to set up Postman to connect to your StepZen GraphQL API:

  1. Select the Authorization option beneath the endpoint URL.
  2. Set Type to API Key.
  3. Populate the options as follows, replacing {APIKEY} with your actual API key:
  • Key: Authorization
  • Value: apikey {APIKEY}
  • Add to: Header

    Postman should look as follows:

Setting up Postman

After your Authorization settings are configured, you can add your GraphQL query under Body > GraphQL.

Connecting GraphQL Playground

GraphQL Playground is a popular desktop GraphQL IDE.

Follow the steps below to set up GraphQL Playground to connect to your StepZen GraphQL API:

  1. Open a new workspace using a URL endpoint in the following format:
https://{ACCOUNT}.stepzen.net/api/example/__graphql
  1. Click on the HTTP Headers tab at the bottom of the Playground, and configure your API Key as follows, replacing {APIKEY} with your actual API key:
{
  "Authorization": "apikey {APIKEY}"
}

The GraphQL Playground should look as follows:

GraphQL Playground

Now you will be able to inspect and query your GraphQL endpoint running on StepZen.

This site uses cookies: By using this website, you consent to our use of cookies in accordance with our Website Terms of Use and Cookie Policy.