How can i generate a access_token using api_key

I am trying to access ‘’ url by using api_key generating from account management.
With this api_key also i am getting api key ‘401 error with “message”:“missing authentication token in headers”’.
So how can i generate the access_token to pass in the header ?.

1 Like

I got back to trying to using API today, and I keep getting 401 with a newly generated token.

It is very strange that no one is responding to many questions asked on this forum. I understand when open source projects do not have the capacity to respond, but Zenhub is not a free open source project. Very strange…

Hey @fedorov

Can you share some details around the request you are trying to make and your request body?

You can also take a look at our getting started guide which has a few example requests to try out.

1 Like

@Joseph.from.Zenhub thanks for responding!

I am following the documentation, and specifically the link to the Explorer: Explorer | Zenhub Developers. I generated the token as described in the documentation.

When I enter that token in the Explorer page and run the auto-generated example, I am getting this:

Also, the link from the Explorer page is broken.

Do you mind double checking that you have correctly copied your token, and the query you are trying to run? Please also be sure to replace the “WORKSPACE_NAME” with the workspace you are looking for.

I was able to get the same query working using the explorer.

1 Like

@Joseph.from.Zenhub thank you for your help!

As it turns out, I was using incorrect token. Instead of generating the API key in the " GraphQL Personal API Key" section, I created one using " REST API Token" section. This problem is resolved, I appreciate the quick response!

1 Like


Did you correctly included API Key in your request headers?

You can consider this-

curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{ "query": "{ yourGraphQLQueryHere }" }'

using Python with requests:

import requests

url = ""
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_API_KEY"
query = {
    "query": "{ yourGraphQLQueryHere }"

response =, headers=headers, json=query)


using JavaScript with fetch:

const url = "";
const headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_API_KEY"
const query = JSON.stringify({ query: "{ yourGraphQLQueryHere }" });

fetch(url, {
    method: "POST",
    headers: headers,
    body: query
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));