Skip to main content

What is the SDK?

The @getgraniteai/ts-sdk package provides a type-safe client for the Granite API. It’s auto-generated from our OpenAPI specification.

Features

Type Safety

Full TypeScript types for all requests and responses

Auto-Generated

Always in sync with the latest API

All Endpoints

Access to 110+ API operations

Zero Dependencies

Lightweight, just fetch-based

Quick Start

import { client } from '@getgraniteai/ts-sdk';

// Configure the client
client.setConfig({
  baseUrl: 'https://api.getgranite.ai',
  credentials: 'include', // For cookie auth
});

// Or with API key
client.setConfig({
  baseUrl: 'https://api.getgranite.ai',
  headers: {
    'X-Granite-API-Key': process.env.GRANITE_API_KEY,
  },
});

// Use the API
const user = await client.getCurrentUser();
console.log(user.email);

Available Operations

The SDK exposes all Granite API operations:
CategoryExamples
AuthloginUser, getCurrentUser, logoutUser
OrganizationscreateOrganization, listOrganizations
ProcesseslistWorkflowJobs, getWorkflowJob
Agent RunsrunAgent, listAgentRuns, cancelAgentRun
API KeyscreateApiKey, listApiKeys, revokeApiKey
AnalyticsgetBatchedAnalytics, getSuccessRate
DriverslistMachines, registerMachine

Next Steps