SDKs & Libraries

Official and community integrations for the thelawin.dev API.

Official SDKs

Ruby

Available now

gem install thelawin
View on RubyGems →

JavaScript / TypeScript

In development

npm install @thelawin/sdk

Python

In development

pip install thelawin

SDKs Coming Soon

TypeScript, Python, Swift, Dart, Java, Kotlin, and C# SDKs are currently in development and will be published soon. Contact us if you'd like early access.

REST API

The API uses standard REST conventions and can be called from any language with HTTP support. See the API Reference for full documentation.

Example with curl

curl -X POST https://api.thelawin.dev/v1/generate \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $THELAWIN_API_KEY" \
  -d @invoice.json

Example with fetch (JavaScript)

const response = await fetch('https://api.thelawin.dev/v1/generate', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': process.env.THELAWIN_API_KEY
  },
  body: JSON.stringify({
    template: 'minimal',
    invoice: { /* ... */ }
  })
});

const { pdf_base64 } = await response.json();
// Decode Base64 to save as file

Example with requests (Python)

import requests
import base64
import os

response = requests.post(
    'https://api.thelawin.dev/v1/generate',
    headers={
        'Content-Type': 'application/json',
        'X-API-Key': os.environ['THELAWIN_API_KEY']
    },
    json={
        'template': 'minimal',
        'invoice': { ... }
    }
)

pdf_bytes = base64.b64decode(response.json()['pdf_base64'])
with open('invoice.pdf', 'wb') as f:
    f.write(pdf_bytes)

MCP Integration

For AI assistant integration, see the MCP Server documentation.