> ## Documentation Index
> Fetch the complete documentation index at: https://developer.tyms.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Integration Examples

> Integrate with Zapier, Make, and other platforms

> [!NOTE]
>
> Examples below use the **production** base URL (`https://api.tyms.io/v1/adam`). For pre-production testing, use `https://staging-api.tyms.io/v1/adam` with sandbox keys — see [Environments](https://developer.tyms.io/introduction.md#environments). Email [developer@tyms.io](mailto:developer@tyms.io) to request sandbox access.

## Zapier Integration

### Setup

1. **Create a Zapier App**: Use the HTTP Request action
2. **Authentication**: Configure API key in Zapier's authentication settings
3. **Triggers**: Use webhooks or polling to detect new records
4. **Actions**: Create records using POST endpoints with AI prompts

### Example: Create Invoice Trigger

```javascript Zapier Code theme={null}
const response = await fetch('https://api.tyms.io/v1/adam/invoices', {
  method: 'POST',
  headers: {
    'X-API-Key': bundle.authData.api_key,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    prompt: `Create an invoice for ${bundle.inputData.customer} for $${bundle.inputData.amount} for ${bundle.inputData.description}`
  })
});

return response.json();
```

## Make (Integromat) Integration

### Setup

1. **HTTP Module**: Configure with base URL `https://api.tyms.io/v1/adam`
2. **Authentication**: Add API key header (`X-API-Key`)
3. **Data Mapping**: Map your data to API request format
4. **Error Handling**: Handle API errors appropriately

### Example: HTTP Request Configuration

* **Method**: POST
* **URL**: `https://api.tyms.io/v1/adam/invoices`
* **Headers**:
  * `X-API-Key`: Your API key
  * `Content-Type`: `application/json`
* **Body**:

```json theme={null}
{
  "prompt": "{{1.prompt}}"
}
```

## cURL Examples

### Create Invoice

```bash cURL theme={null}
curl -X POST "https://api.tyms.io/v1/adam/invoices" \
  -H "X-API-Key: your_secret_key" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Create an invoice for ABC Company for $1,000 for consulting services"
  }'
```

### Update Invoice Payment

```bash cURL theme={null}
curl -X POST "https://api.tyms.io/v1/adam/invoices/invoice-uuid/payments" \
  -H "X-API-Key: your_secret_key" \
  -H "Content-Type: application/json" \
  -d '{
    "payments": [
      {
        "amount_paid": 500.00,
        "category": "Bank Transfer",
        "date": "2024-01-20"
      }
    ]
  }'
```

### Get Contacts

```bash cURL theme={null}
curl -X GET "https://api.tyms.io/v1/adam/contacts?page=1&limit=20" \
  -H "X-API-Key: your_secret_key"
```

## JavaScript/Node.js Example

```javascript Node.js theme={null}
const axios = require('axios');

const apiClient = axios.create({
  baseURL: 'https://api.tyms.io/v1/adam',
  headers: {
    'X-API-Key': 'your_secret_key',
    'Content-Type': 'application/json'
  }
});

// Create invoice
async function createInvoice(prompt) {
  try {
    const response = await apiClient.post('/invoices', {
      prompt: prompt
    });
    return response.data;
  } catch (error) {
    console.error('Error creating invoice:', error.response?.data || error.message);
    throw error;
  }
}

// Get invoices
async function getInvoices(page = 1, limit = 20) {
  try {
    const response = await apiClient.get('/invoices', {
      params: { page, limit }
    });
    return response.data;
  } catch (error) {
    console.error('Error fetching invoices:', error.response?.data || error.message);
    throw error;
  }
}
```

## Python Example

```python Python theme={null}
import requests

class TymsAPI:
    def __init__(self, api_key):
        self.base_url = 'https://api.tyms.io/v1/adam'
        self.headers = {
            'X-API-Key': api_key,
            'Content-Type': 'application/json'
        }
    
    def create_invoice(self, prompt):
        response = requests.post(
            f'{self.base_url}/invoices',
            headers=self.headers,
            json={'prompt': prompt}
        )
        response.raise_for_status()
        return response.json()
    
    def get_invoices(self, page=1, limit=20):
        response = requests.get(
            f'{self.base_url}/invoices',
            headers=self.headers,
            params={'page': page, 'limit': limit}
        )
        response.raise_for_status()
        return response.json()

# Usage
api = TymsAPI('your_secret_key')
invoice = api.create_invoice('Create an invoice for ABC Company for $1,000')
```

## Important Notes

* **Dates**: Use ISO 8601 (`YYYY-MM-DD`) in structured JSON where an endpoint requires a date field.
* **Amounts**: In structured JSON, use numeric amounts without currency symbols.
* **Timezone**: Defaults are documented in [Concepts](https://developer.tyms.io/concepts.md); validated business profile includes `timezone`.
* **AI creates**: Invoice, bill, expense, income, journal, contact, chart-of-accounts, and **`POST /bank-transactions/upload`** all use natural-language **`prompt`** (bank upload **requires** it — not a raw `transactions[]` bulk JSON importer). See [Create bank transactions (AI)](https://developer.tyms.io/api-reference/bank-transactions/create-bank-transactions-ai.md).
* **Partners**: New businesses are provisioned with [Register business](https://developer.tyms.io/api-reference/partners/register-business.md); day-to-day calls use each business’s `tyms_sk_...`.
* **UUID resolution**: Updates and deletes accept `uuid` or `source_uuid` where documented ([Overview](https://developer.tyms.io/api-reference/overview.md#uuid-resolution)).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.