# Get a trigger

> Source: https://docs.clonepartner.com/api-reference/triggers/get-trigger/

`GET /api/triggers/{id}`

Get a trigger

**Operation ID:** `getTrigger`

## Authentication

### Option 1

- **BearerAuth** (`http bearer`)
  API key token. Create via POST /api/api-keys. Format: `envoy_<hex>`

### Option 2

- **CookieAuth** (`apiKey`)
  Session cookie set after login + TOTP verification

## Path parameters

- `id` — `integer`, `required`
  Resource ID

## Success responses

### 200

Trigger details

**Content type:** `application/json`

- Reference: `Trigger`
  - Type: `object`
  - Properties:
    - `id` (`integer`)
    - `job_id` (`integer`)
    - `task_key` (`string | null`)
      - Nullable: yes
    - `type` (`string`) — cron repeats on a cron expression; one_off fires once at the datetime in cron_expression then auto-disables.
      - Description: cron repeats on a cron expression; one_off fires once at the datetime in cron_expression then auto-disables.
      - Allowed values: `cron`, `one_off`
    - `cron_expression` (`string | null`) — 5-field cron expression for type=cron; ISO-8601 datetime (UTC) for type=one_off.
      - Description: 5-field cron expression for type=cron; ISO-8601 datetime (UTC) for type=one_off.
      - Nullable: yes
    - `arguments` (`string | null`) — JSON-encoded arguments
      - Description: JSON-encoded arguments
      - Nullable: yes
    - `enabled` (`integer`)
      - Allowed values: `0`, `1`
    - `last_triggered_at` (`string | null`)
      - Format: `date-time`
      - Nullable: yes
    - `created_at` (`string`)
      - Format: `date-time`
    - `updated_at` (`string`)
      - Format: `date-time`

## Error responses

### 404

Resource not found

**Content type:** `application/json`

- Reference: `Error`
  - Type: `object`
  - Properties:
    - `error` (`string`)
      - Example: `NOT_FOUND`
    - `message` (`string`)
      - Example: `Resource not found`

Example:

```json
{
  "error": "NOT_FOUND",
  "message": "Resource not found"
}
```

## Examples

### cURL

```bash
curl --request GET \
  --url 'https://your-envoy.example.com/api/triggers/YOUR_ID' \
  --header 'Authorization: Bearer $API_KEY'
```

### JavaScript (fetch)

```javascript
const response = await fetch('https://your-envoy.example.com/api/triggers/YOUR_ID', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
  },
});

if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = response.status === 204 ? null : await response.json();
console.log(data);
```
