# Get a job template

> Source: https://docs.clonepartner.com/api-reference/job-templates/get-job-template/

`GET /api/job-templates/{id}`

Returns the template with its parsed DAG and connector definitions.

**Operation ID:** `getJobTemplate`

## 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

Template with DAG

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

- Type: `JobTemplate & object`
- All of:
  - Variant 1:
    - Reference: `JobTemplate`
      - Type: `object`
      - Properties:
        - `id` (`integer`)
        - `name` (`string`)
        - `description` (`string | null`)
          - Nullable: yes
        - `yaml_content` (`string`)
        - `status` (`string`)
          - Allowed values: `active`, `archived`
        - `created_at` (`string`)
          - Format: `date-time`
        - `updated_at` (`string`)
          - Format: `date-time`
  - Variant 2:
    - Type: `object`
    - Properties:
      - `dag` (`object | null`)
        - Nullable: yes
        - Properties:
          - `tasks` (`object`)
            - Additional properties: allowed
          - `levels` (`array<array<string>>`)
            - Items:
              - Type: `array<string>`
              - Items:
                - Type: `string`
      - `connectors` (`object | null`)
        - Nullable: yes
        - Additional properties:
          - Type: `object`
          - Properties:
            - `type` (`string`)

## 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/job-templates/YOUR_ID' \
  --header 'Authorization: Bearer $API_KEY'
```

### JavaScript (fetch)

```javascript
const response = await fetch('https://your-envoy.example.com/api/job-templates/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);
```
