Graph API

Query entities and relationships from your own apps with an API key.

Overview

Access your knowledge system programmatically

The Graph API lets you access your organization's knowledge system from external applications. Query entities, relationships, and graph intelligence to build custom integrations, create visualization tools, or power AI-driven workflows.

Secure Access
API keys with scoped permissions
Fast & Reliable
RESTful endpoints with pagination
Rate Limited
Fair usage with clear limits

Quick Start

Get your first API response in under 60 seconds

Get your first API response in under 60 seconds.

Base URL
https://api.simplyasking.io/functions/v1
1

Get your API key

Go to Account / Org API settings (`/org/api`) and create a key with entities:read scope.

2

Make your first request

Use cURL, JavaScript, or Python to call the API:

cURL
curl -H "Authorization: Bearer gak_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  "https://api.simplyasking.io/functions/v1/graph-api/entities?limit=5"
JavaScript
// Store your API key securely (never hardcode in production)
const API_KEY = 'your-api-key-here';
const BASE_URL = 'https://api.simplyasking.io/functions/v1';

async function listEntities() {
  const response = await fetch(`${BASE_URL}/graph-api/entities?limit=20`, {
    headers: {
      'Authorization': `Bearer ${API_KEY}`,
      'Content-Type': 'application/json',
    },
  });

  if (!response.ok) {
    const error = await response.json().catch(() => ({}));
    throw new Error(`API error: ${response.status} - ${error.message || 'Unknown'}`);
  }

  return response.json();
}

// Usage
const data = await listEntities();
console.log(`Found ${data.entities.length} entities`);
console.log('First entity:', data.entities[0]);
Python
import os
import requests

# Store API key in environment variable (never hardcode in production)
API_KEY = os.environ.get('GRAPH_API_KEY')
BASE_URL = 'https://api.simplyasking.io/functions/v1'

def list_entities():
    try:
        response = requests.get(
            f'{BASE_URL}/graph-api/entities',
            headers={
                'Authorization': f'Bearer {API_KEY}',
                'Content-Type': 'application/json'
            },
            params={'limit': 20}
        )
        response.raise_for_status()
        return response.json()
    except requests.HTTPError as e:
        error_msg = e.response.json().get('message', str(e))
        raise Exception(f'API error: {error_msg}')

# Usage
data = list_entities()
print(f"Found {len(data['entities'])} entities")
print('First entity:', data['entities'][0])
3

Check the response

A successful response looks like this:

JSON Response
{
  "entities": [
    {
      "id": "3f6c2a1e-8b4d-4e2a-9c1f-5d7e8a9b0c12",
      "name": "Acme Corporation",
      "entity_type": null,
      "description": "Global technology company",
      "metadata": null,
      "relationship_count": null,
      "created_at": null,
      "updated_at": null
    },
    {
      "id": "7a1d9e4b-2c3f-4b5a-8d6e-0f1a2b3c4d5e",
      "name": "John Smith",
      "entity_type": null,
      "description": "Chief Technology Officer at Acme",
      "metadata": null,
      "relationship_count": null,
      "created_at": null,
      "updated_at": null
    }
  ],
  "next_cursor": "JTdCJTIyb2Zmc2V0JTIyJTNBMjAlMkMlMjJzb3J0X2J5JTIyJTNBJTIybmFtZSUyMiUyQyUyMnNvcnRfb3JkZXIlMjIlM0ElMjJhc2MlMjIlMkMlMjJuYW1lX2NvbnRhaW5zJTIyJTNBbnVsbCU3RA=="
}

API Endpoints

Available endpoints and required scopes

All endpoints use the base URL https://api.simplyasking.io/functions/v1

EndpointMethodRequired ScopeDescription
/graph-api/entitiesGETentities:readList all entities with pagination
/graph-api/entities/:idGETentities:readGet a single entity by ID
/graph-api/relationshipsGETrelationships:readList relationships between entities
/graph-api/searchPOSTsearch:readText search over entity names and descriptions
/graph-api/traversePOSTtraverse:readTraverse graph from a starting entity
/graph-api/related/:entity_idGETrelationships:readList entities connected to one entity
/graph-api/clustersGETclusters:readNot available yet (returns 403)

Tip

Search and traverse take a JSON request body. Search accepts query and limit (default 20, max 100). Traverse accepts start_entity_id, max_hops (default 2, max 5) and limit (default 50, max 200). Related accepts limit (default 20, max 50). A limit above the maximum returns a 400 error, except on entities, where it is capped at 100.

Creating API Keys

Generate scoped API keys

To use the Graph API, you need to create an API key. Only Admins and Owners can manage API keys. Check your role.

1

Navigate to Graph API

2

Create a key

Click + Create API Key

3

Name and scope

Enter a descriptive name (e.g., "Production Dashboard") and select the scopes (permissions) your key needs.

4

Copy immediately

Click Create Key and copy the key immediately. It is only shown once.

Important

Copy your key immediately: Your API key is only shown once. Copy it and store it securely. If you lose it, you will need to create a new key.

All API keys start with gak_ followed by 40 hexadecimal characters:

gak_a1b2c3d4e5f6789012345678901234567890abcd

Authentication

Include your API key in every request

Include your API key in the Authorization header of every request.

Header
Authorization: Bearer gak_YOUR_API_KEY
cURL
curl -H "Authorization: Bearer gak_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  "https://api.simplyasking.io/functions/v1/graph-api/entities"

Tip

Security Best Practices: Store keys in environment variables, never in code. Never commit API keys to version control. Rotate keys periodically (every 90 days recommended). Delete unused keys immediately. Use separate keys for development and production.

Understanding Scopes

Control what your API key can access

Scopes control what your API key can access. Follow the principle of least privilege and only grant the scopes your application actually needs.

entities:read
List and retrieve entities, optionally filtered by name. Returns the names and descriptions your key can read; fields that cannot be traced to those documents come back null. Filtering by entity type is not available. Most common scope.
relationships:read
List relationships and find related entities. See how entities are connected.
search:read
Search entity names and descriptions by text. Results include only content your key can read. Matching is by text, not by meaning.
traverse:read
Traverse the graph from a starting entity. Walk through connections to discover related entities.
clusters:read
Reserved for entity clusters, which are not available yet. Cluster requests return 403 REQUESTER_SCOPE_REQUIRED.

Pagination

Navigate through large result sets

The entities and relationships lists page with limit and cursor query parameters.

limit
Number of items to return (default: 50, max: 100). On entities a larger value is capped at 100 rather than rejected.
cursor
The next_cursor value from the previous response. Leave it off for the first page.
Fetching page 2
curl -H "Authorization: Bearer gak_YOUR_API_KEY" \
  "https://api.simplyasking.io/functions/v1/graph-api/entities?limit=20&cursor=NEXT_CURSOR_FROM_PAGE_1"

Tip

When next_cursor is null, there are no more pages. offset is not supported: on entities it returns a 400 UNSUPPORTED_ENTITY_FILTER error. An entities cursor only works with the same sort_order and name_contains as the request that returned it. Changing either returns a 400 INVALID_CURSOR error, so start again from the first page. You can change limit between pages.

Rate Limits

60 requests per minute per API key

API keys have rate limits to ensure fair usage and system stability. All plans: 60 requests per minute per API key.

X-RateLimit-Limit
Maximum requests per window
X-RateLimit-Remaining
Requests left in current window
X-RateLimit-Reset
When the window resets (Unix timestamp)
X-Request-ID
Unique request ID (include when reporting issues)

Warning

HTTP 429: Rate Limited: Wait for the time specified in the Retry-After header before making more requests. Implement exponential backoff for best results.

Need higher limits? Upgrade to Command plan for elevated rate limits.

Managing Keys

Edit, regenerate, or delete API keys

Manage your API keys at Account / Org API settings.

Edit Key Name
Click the key name to rename it. Use descriptive names that indicate the key's purpose.
Regenerate Key
If a key is compromised, regenerate it immediately. The old key stops working instantly.
Delete Key
Delete unused keys. This is immediate and cannot be undone. Applications using the key will get auth errors.

Troubleshooting

Common API errors and fixes

HTTP 401: Unauthorized
API key is invalid or missing. Check the Authorization header, verify the key starts with gak_, and confirm it has not been deleted or regenerated.
HTTP 403: Forbidden (Insufficient Scope)
Your key does not have permission for this endpoint. Check the endpoint table for required scopes. Create a new key with the needed scopes.
HTTP 429: Rate Limit Exceeded
Too many requests. Wait for the Retry-After header, implement exponential backoff, cache responses, or use larger limit values.
Common Fixes Checklist
Key not working? Check if regenerated. Empty results? Check that the key has content access to the documents or access groups you expect; a key with no content selected reads nothing. Subscription error? Confirm active billing. CORS error? API calls must come from your backend.

Tip

Still stuck? Include the X-Request-ID from your response headers when contacting support. It helps us locate your request in our logs.
Was this helpful?