# Automation Route Handler

`GET /api/zapier/{method}/{resource}`

This is a routing method that maps to specific Zapier endpoints. Use the direct endpoints (poll_get, test_get, resources_get) instead.

- **Group:** Automation
- **Since:** v0.0.0
- **Authentication:** `authtoken` header, created under Setup > API > API Management
- **HTML version:** /apiguide/automation/zapier-route-handler/

## Headers

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `authtoken` | String | **required** | Authentication token, generated from admin area |
| `Authorization` | String | optional | Bearer token (alternative to authtoken header) |

## Parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `method` | String | **required** | Method name (poll, test, resources) |
| `resource` | String | optional | Resource name (customers, invoices, leads, tasks, tickets) - required for poll and test methods |

## Example request

```bash
curl -X GET "https://yoursite.com/api/zapier/poll/customers" \
  -H "authtoken: YOUR_API_TOKEN"
```

## Success response

### Success-Response:

```json
HTTP/1.1 200 OK
{
  "status": true,
  "data": [
    { "key": "customers", "label": "Customers", "description": "New or updated customers" },
    { "key": "invoices", "label": "Invoices", "description": "New or updated invoices" },
    { "key": "leads", "label": "Leads", "description": "New or updated leads" },
    { "key": "tasks", "label": "Tasks", "description": "New or updated tasks" },
    { "key": "tickets", "label": "Tickets", "description": "New or updated support tickets" }
  ]
}
```

## Error responses

### Error-Response:

```json
HTTP/1.1 404 Not Found
{
  "error": "Method not found: invalid_get"
}
```

---

Perfex CRM REST API by Themesic Interactive. Full reference: /apiguide/
