Generate Artifacts

SDKs

Generating SDKs from Your API

Vaktum can automatically generate Software Development Kits (SDKs) from your API definition, making it easier for developers to integrate with your API.

What are API SDKs?

API SDKs (Software Development Kits) are pre-built packages that simplify the process of integrating with an API. They provide:

  • Type-safe client libraries
  • Pre-configured API endpoints
  • Authentication handling
  • Request/response serialization
  • Error handling

Supported SDK Languages

Vaktum can generate SDKs for various programming languages:

  • JavaScript/TypeScript (Node.js, Browser)
  • Python
  • Java
  • C#/.NET
  • Go
  • Ruby
  • PHP
  • Swift
  • Kotlin
  • Rust

Generating SDKs

Via Vaktum.com

  1. Navigate to the APIs section of Vaktum.com
  2. Select your API
  3. Go to the "Artifacts" tab
  4. Click "Generate SDK"
  5. Select your target language and configuration options
  6. Click "Generate" to create the SDK
  7. Download the generated SDK package

Via Vaktum CLI

You can also generate SDKs using the Vaktum CLI:

🖥️ Shell
vaktum generate sdk --api <Path to your API file> --language typescript --output ./sdk

Via Vaktum API

Generate SDKs programmatically using the Vaktum API:

🖥️ Shell
curl -X POST "https://api.vaktum.com/v1/artifacts/sdk" \
  -H "X-API-KEY: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "apiId": "your-api-id",
    "language": "typescript",
    "options": {
      "npmName": "my-api-client",
      "supportsES6": true
    }
  }'

SDK Features

Generated SDKs include:

  • Type Definitions: Strongly typed interfaces for requests and responses
  • API Client: Pre-configured client with all API endpoints
  • Authentication: Built-in support for API authentication methods
  • Documentation: Inline documentation and usage examples
  • Error Handling: Structured error responses with appropriate types

SDK Customization Options

When generating SDKs, you can customize various aspects:

  • Package Name: Define the name for the SDK package
  • Version: Set the initial version number
  • License: Specify the license for the SDK
  • Dependencies: Configure specific dependency versions
  • Language Features: Enable/disable language-specific features

Installing and Using Generated SDKs

TypeScript Example

// Install the SDK
// npm install my-api-client

// Import the client
import { ApiClient } from 'my-api-client';

// Create and configure the client
const client = new ApiClient({
  baseUrl: 'https://api.example.com',
  apiKey: 'your-api-key'
});

// Use the client
async function getUserProfile(userId) {
  try {
    const response = await client.users.getUserById(userId);
    console.log(response.data);
  } catch (error) {
    console.error('API Error:', error.message);
  }
}

Python Example

# Install the SDK
# pip install my-api-client

# Import the client
from my_api_client import ApiClient

# Create and configure the client
client = ApiClient(
    base_url="https://api.example.com",
    api_key="your-api-key"
)

# Use the client
def get_user_profile(user_id):
    try:
        response = client.users.get_user_by_id(user_id)
        print(response.data)
    except Exception as e:
        print(f"API Error: {str(e)}")

SDK Versioning and Updates

When your API evolves, you can regenerate SDKs to keep them in sync:

  1. Update your API definition in Vaktum
  2. Regenerate the SDK with the same configuration
  3. Increment the SDK version number
  4. Publish the updated SDK

For detailed information on generated artifacts, see the API Docs section.