February 20, 2025 32174b4 Edit this page

SDKs and Libraries 🗄️ Archived

Official SDKs and community libraries for popular programming languages

SDKs and Libraries

Official and community-maintained SDKs for interacting with our API.

Official SDKs

Python SDK

Install via pip:

pip install example-sdk

Quick Start:

from example_sdk import ExampleClient

# Initialize client
client = ExampleClient(api_key='your_api_key')

# Create a resource
resource = client.resources.create(
    name='My Resource',
    type='standard'
)

# List resources
resources = client.resources.list(
    page=1,
    per_page=50,
    filter={'status': 'active'}
)

# Get a resource
resource = client.resources.get('res_123')

# Update a resource
updated = client.resources.update(
    'res_123',
    name='Updated Name'
)

# Delete a resource
client.resources.delete('res_123')

Advanced Usage:

# Async support
import asyncio
from example_sdk import AsyncExampleClient

async def main():
    client = AsyncExampleClient(api_key='your_api_key')
    
    # Concurrent requests
    resources = await asyncio.gather(
        client.resources.get('res_1'),
        client.resources.get('res_2'),
        client.resources.get('res_3')
    )
    
    await client.close()

asyncio.run(main())

Documentation: python-sdk.example.com

JavaScript/TypeScript SDK

Install via npm:

npm install @example/sdk

Quick Start:

const { ExampleClient } = require('@example/sdk');

// Initialize client
const client = new ExampleClient({
  apiKey: 'your_api_key'
});

// Create a resource
const resource = await client.resources.create({
  name: 'My Resource',
  type: 'standard'
});

// List resources
const resources = await client.resources.list({
  page: 1,
  perPage: 50,
  filter: { status: 'active' }
});

// Get a resource
const resource = await client.resources.get('res_123');

// Update a resource
const updated = await client.resources.update('res_123', {
  name: 'Updated Name'
});

// Delete a resource
await client.resources.delete('res_123');

TypeScript:

import { ExampleClient, Resource } from '@example/sdk';

const client = new ExampleClient({
  apiKey: process.env.API_KEY!
});

// Type-safe resource creation
const resource: Resource = await client.resources.create({
  name: 'My Resource',
  type: 'standard'
});

// Typed responses
const resources: Resource[] = await client.resources.list();

Documentation: js-sdk.example.com

Go SDK

Install via go get:

go get github.com/example/go-sdk

Quick Start:

package main

import (
    "context"
    "fmt"
    "log"
    
    "github.com/example/go-sdk"
)

func main() {
    client := sdk.NewClient("your_api_key")
    ctx := context.Background()
    
    // Create a resource
    resource, err := client.Resources.Create(ctx, &sdk.ResourceCreateParams{
        Name: "My Resource",
        Type: "standard",
    })
    if err != nil {
        log.Fatal(err)
    }
    
    // List resources
    resources, err := client.Resources.List(ctx, &sdk.ResourceListParams{
        Page:    1,
        PerPage: 50,
    })
    if err != nil {
        log.Fatal(err)
    }
    
    // Get a resource
    resource, err = client.Resources.Get(ctx, "res_123")
    if err != nil {
        log.Fatal(err)
    }
    
    // Update a resource
    updated, err := client.Resources.Update(ctx, "res_123", &sdk.ResourceUpdateParams{
        Name: sdk.String("Updated Name"),
    })
    if err != nil {
        log.Fatal(err)
    }
    
    // Delete a resource
    err = client.Resources.Delete(ctx, "res_123")
    if err != nil {
        log.Fatal(err)
    }
}

Documentation: go-sdk.example.com

Ruby SDK

Install via gem:

gem install example-sdk

Quick Start:

require 'example_sdk'

# Initialize client
client = ExampleSDK::Client.new(api_key: 'your_api_key')

# Create a resource
resource = client.resources.create(
  name: 'My Resource',
  type: 'standard'
)

# List resources
resources = client.resources.list(
  page: 1,
  per_page: 50,
  filter: { status: 'active' }
)

# Get a resource
resource = client.resources.get('res_123')

# Update a resource
updated = client.resources.update(
  'res_123',
  name: 'Updated Name'
)

# Delete a resource
client.resources.delete('res_123')

Documentation: ruby-sdk.example.com

PHP SDK

Install via composer:

composer require example/sdk

Quick Start:

<?php

require 'vendor/autoload.php';

use Example\SDK\Client;

// Initialize client
$client = new Client('your_api_key');

// Create a resource
$resource = $client->resources->create([
    'name' => 'My Resource',
    'type' => 'standard'
]);

// List resources
$resources = $client->resources->list([
    'page' => 1,
    'per_page' => 50,
    'filter' => ['status' => 'active']
]);

// Get a resource
$resource = $client->resources->get('res_123');

// Update a resource
$updated = $client->resources->update('res_123', [
    'name' => 'Updated Name'
]);

// Delete a resource
$client->resources->delete('res_123');

Documentation: php-sdk.example.com

Community SDKs

Java

Maven:

<dependency>
    <groupId>com.example</groupId>
    <artifactId>example-sdk</artifactId>
    <version>1.0.0</version>
</dependency>

GitHub: github.com/community/java-sdk

C#/.NET

NuGet:

dotnet add package Example.SDK

GitHub: github.com/community/dotnet-sdk

Rust

Cargo:

[dependencies]
example-sdk = "0.1.0"

GitHub: github.com/community/rust-sdk

SDK Features

All official SDKs include:

  • ✅ Full API coverage
  • ✅ Type safety (where applicable)
  • ✅ Automatic retries with exponential backoff
  • ✅ Request/response logging
  • ✅ Pagination helpers
  • ✅ Webhook signature verification
  • ✅ File upload support
  • ✅ Comprehensive documentation
  • ✅ Active maintenance

Error Handling

All SDKs provide consistent error handling:

Python

from example_sdk import ExampleClient, APIError, RateLimitError

client = ExampleClient(api_key='your_api_key')

try:
    resource = client.resources.get('res_123')
except RateLimitError as e:
    print(f"Rate limited. Retry after: {e.retry_after}")
except APIError as e:
    print(f"API error: {e.message}")
    print(f"Status code: {e.status_code}")
    print(f"Error code: {e.error_code}")

JavaScript

const { ExampleClient, APIError, RateLimitError } = require('@example/sdk');

const client = new ExampleClient({ apiKey: 'your_api_key' });

try {
  const resource = await client.resources.get('res_123');
} catch (error) {
  if (error instanceof RateLimitError) {
    console.log(`Rate limited. Retry after: ${error.retryAfter}`);
  } else if (error instanceof APIError) {
    console.log(`API error: ${error.message}`);
    console.log(`Status code: ${error.statusCode}`);
    console.log(`Error code: ${error.errorCode}`);
  }
}

Configuration

Timeouts

# Python
client = ExampleClient(
    api_key='your_api_key',
    timeout=30  # seconds
)
// JavaScript
const client = new ExampleClient({
  apiKey: 'your_api_key',
  timeout: 30000  // milliseconds
});

Retry Configuration

# Python
client = ExampleClient(
    api_key='your_api_key',
    max_retries=3,
    backoff_factor=2
)
// JavaScript
const client = new ExampleClient({
  apiKey: 'your_api_key',
  maxRetries: 3,
  backoffFactor: 2
});

Custom Base URL

# Python (for testing/development)
client = ExampleClient(
    api_key='your_api_key',
    base_url='https://sandbox-api.example.com'
)

Migration Guides

Upgrading from v1 to v2

See our migration guide for detailed upgrade instructions.

Contributing

Want to contribute to an SDK? Check out our contribution guidelines.

Support