Skip to content
Get started

GraphQL Proxy

Access the GraphQL API through Bounty Lab's infrastructure with built-in rate limit protection.

Bounty Lab provides a transparent proxy to the GraphQL API, allowing you to query data in real-time without worrying about rate limits, token management, or API complexity.

  • No Token Required: Use your Bounty Lab API key instead
  • Rate Limit Protection: We handle rate limiting for you
  • Real-Time Data: Get the latest data directly from the source
  • Full GraphQL Access: Use any GraphQL query (read-only)
  • Simplified Authentication: Single authentication method across all services

Use the GraphQL proxy when you need:

  • Real-time data (Bounty Lab’s cached data can be up to 48 hours old)
  • Data not available in our RAW or SEARCH endpoints
  • Custom GraphQL queries for specific use cases

Cost: 50 credits per query. For cost optimization, prefer RAW (1 credit) or SEARCH (1 credit) endpoints when possible.


Without Bounty Lab, you need to:

  1. Create a personal access token
  2. Manage rate limits yourself (5,000 points per hour)
  3. Handle authentication headers
  4. Deal with rate limit errors and implement backoff logic
Terminal window
# Direct GraphQL API call
curl -H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-X POST \
-d '{"query":"{ viewer { login name } }"}' \
https://api.github.com/graphql

With Bounty Lab:

  1. Use your Bounty Lab API key
  2. We handle rate limiting automatically
  3. Simple authentication
  4. No token management needed
Terminal window
# Bounty Lab GraphQL Proxy
curl -H "Authorization: Bearer YOUR_BOUNTYLAB_API_KEY" \
-H "Content-Type: application/json" \
-X POST \
-d '{"query":"{ viewer { login name } }"}' \
https://api.bountylab.io/api/github/graphql

  • A Bounty Lab account
  • An API key with GITHUB_GRAPHQL service enabled
  • Sufficient credits (50 credits per query)

The endpoint accepts standard GraphQL queries using POST requests:

Endpoint: https://api.bountylab.io/api/github/graphql

Method: POST

Headers:

  • Authorization: Bearer YOUR_API_KEY
  • Content-Type: application/json (Required)

Important: The Content-Type: application/json header is required for all requests. Without it, the API will not be able to parse your request body and will return an error.

Body:

{
"query": "YOUR_GRAPHQL_QUERY",
"variables": {}
}

Fetch detailed information about a user.

Bounty Lab Proxy:

Terminal window
curl -H "Authorization: Bearer bl_YourBountyLabKey456..." \
-H "Content-Type: application/json" \
-X POST \
-d '{
"query": "query($login: String!) { user(login: $login) { login name bio company location followers { totalCount } repositories { totalCount } } }",
"variables": {"login": "torvalds"}
}' \
https://api.bountylab.io/api/github/graphql

Response:

{
"data": {
"user": {
"login": "torvalds",
"name": "Linus Torvalds",
"bio": "Creator of Linux",
"company": "Linux Foundation",
"location": "Portland, OR",
"followers": {
"totalCount": 182500
},
"repositories": {
"totalCount": 8
}
}
}
}

Fetch information about a specific repository including stars, forks, and languages.

Bounty Lab Proxy:

Terminal window
curl -H "Authorization: Bearer bl_YourBountyLabKey456..." \
-H "Content-Type: application/json" \
-X POST \
-d '{
"query": "query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { name description stargazerCount forkCount languages(first: 5) { nodes { name } } primaryLanguage { name } } }",
"variables": {"owner": "facebook", "name": "react"}
}' \
https://api.bountylab.io/api/github/graphql

Response:

{
"data": {
"repository": {
"name": "react",
"description": "The library for web and native user interfaces",
"stargazerCount": 228000,
"forkCount": 46500,
"languages": {
"nodes": [
{ "name": "JavaScript" },
{ "name": "HTML" },
{ "name": "CSS" }
]
},
"primaryLanguage": {
"name": "JavaScript"
}
}
}
}

Search for repositories matching specific criteria.

Bounty Lab Proxy:

Terminal window
curl -H "Authorization: Bearer bl_YourBountyLabKey456..." \
-H "Content-Type: application/json" \
-X POST \
-d '{
"query": "query($query: String!) { search(query: $query, type: REPOSITORY, first: 10) { nodes { ... on Repository { name owner { login } stargazerCount description } } } }",
"variables": {"query": "language:rust stars:>1000"}
}' \
https://api.bountylab.io/api/github/graphql

Example 4: Get User’s Recent Contributions

Section titled “Example 4: Get User’s Recent Contributions”

Fetch a user’s recent contribution activity.

Bounty Lab Proxy:

Terminal window
curl -H "Authorization: Bearer bl_YourBountyLabKey456..." \
-H "Content-Type: application/json" \
-X POST \
-d '{
"query": "query($login: String!) { user(login: $login) { contributionsCollection { totalCommitContributions totalIssueContributions totalPullRequestContributions totalPullRequestReviewContributions } } }",
"variables": {"login": "tj"}
}' \
https://api.bountylab.io/api/github/graphql

Response:

{
"data": {
"user": {
"contributionsCollection": {
"totalCommitContributions": 1250,
"totalIssueContributions": 89,
"totalPullRequestContributions": 234,
"totalPullRequestReviewContributions": 156
}
}
}
}

Here’s how to use the proxy in a Node.js application:

const fetchGraphQL = async (query, variables = {}) => {
const response = await fetch("https://api.bountylab.io/api/github/graphql", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.BOUNTYLAB_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ query, variables }),
});
const data = await response.json();
if (data.errors) {
throw new Error(`GraphQL Error: ${JSON.stringify(data.errors)}`);
}
return data.data;
};
// Usage
const getUserInfo = async (username) => {
const query = `
query($login: String!) {
user(login: $login) {
login
name
bio
followers {
totalCount
}
}
}
`;
return await fetchGraphQL(query, { login: username });
};
// Call it
getUserInfo("torvalds").then(console.log);

Using the proxy in Python:

import requests
import os
def fetch_graphql(query, variables=None):
"""Fetch data via Bounty Lab's GraphQL proxy."""
response = requests.post(
'https://api.bountylab.io/api/github/graphql',
json={'query': query, 'variables': variables or {}},
headers={
'Authorization': f'Bearer {os.environ["BOUNTYLAB_API_KEY"]}',
'Content-Type': 'application/json'
}
)
data = response.json()
if 'errors' in data:
raise Exception(f"GraphQL Error: {data['errors']}")
return data['data']
# Usage
query = """
query($login: String!) {
user(login: $login) {
login
name
bio
followers {
totalCount
}
}
}
"""
result = fetch_graphql(query, {'login': 'torvalds'})
print(result)

Always use GraphQL variables instead of string interpolation:

Good:

query($login: String!) {
user(login: $login) { ... }
}

Bad:

query {
user(login: "hardcoded") { ... }
}

GraphQL allows you to specify exactly which fields you need:

Good (only get what you need):

{
user(login: "torvalds") {
login
name
}
}

Bad (requesting unnecessary data):

{
user(login: "torvalds") {
login
name
bio
company
location
email
websiteUrl
... # lots of fields you don't use
}
}

The GraphQL proxy costs 50 credits per query. Use our RAW or SEARCH endpoints (1 credit each) when they provide the data you need.

Example:

  • Need user profile data? Use /api/raw/user/:username (1 credit)
  • Need to search repositories? Use /api/search/repos (1 credit)
  • Need real-time data or custom query? Use GraphQL proxy (50 credits)

Always check for errors in the response:

const data = await response.json();
if (data.errors) {
console.error("GraphQL errors:", data.errors);
// Handle errors appropriately
}

  • Cost: 50 credits per query
  • This is significantly higher than RAW (1 credit) or SEARCH (1 credit) endpoints
  • Use GraphQL proxy only when necessary
  • We handle rate limiting for you
  • You’re only limited by your Bounty Lab credit balance
  • No need to track rate limit points
  1. Batch multiple queries into one when possible
  2. Use pagination efficiently
  3. Cache responses on your end when appropriate
  4. Consider using RAW/SEARCH endpoints for common queries

The proxy provides read-only access. You cannot:

  • Create, update, or delete repositories
  • Create issues or pull requests
  • Modify user settings
  • Perform any mutations

Very complex queries may be rejected due to complexity limits.