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

# Job Groups

> Organizing jobs into logical groups for better management.

Job Groups allow you to categorize and organize your jobs into logical sets. This is particularly useful for large projects with many jobs that serve different purposes or belong to different microservices.

## Concepts

A **Job Group** consists of:

* **ID**: A unique identifier for the group.
* **Project ID**: The project the group belongs to.
* **Name**: A human-readable name for the group.
* **Slug**: A URL-friendly identifier for the group.
* **Description**: An optional description of the group's purpose.

## Managing Job Groups

<Note>
  Job groups are enabled by default.
</Note>

### Create a Job Group

```bash theme={null}
curl -X POST https://strait.dev/v1/job-groups \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "project_id": "proj_123",
    "name": "Email Notifications",
    "slug": "email-notifications",
    "description": "Jobs related to sending various email notifications."
  }'
```

### List Job Groups

```bash theme={null}
curl -H "Authorization: Bearer $API_KEY" \
  https://strait.dev/v1/job-groups?project_id=proj_123
```

### Update a Job Group

```bash theme={null}
curl -X PATCH https://strait.dev/v1/job-groups/{groupID} \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Updated Group Name"
  }'
```

### Delete a Job Group

```bash theme={null}
curl -X DELETE https://strait.dev/v1/job-groups/{groupID} \
  -H "Authorization: Bearer $API_KEY"
```

## Assigning Jobs to Groups

When creating or updating a job, you can assign it to a group by providing the `group_id`:

```bash theme={null}
curl -X POST https://strait.dev/v1/jobs \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "project_id": "proj_123",
    "group_id": "{groupID}",
    "name": "Welcome Email",
    "slug": "welcome-email",
    "endpoint_url": "https://api.myapp.com/jobs/welcome-email"
  }'
```

## Listing Jobs by Group

To see all jobs assigned to a specific group:

```bash theme={null}
curl -H "Authorization: Bearer $API_KEY" \
  https://strait.dev/v1/job-groups/{groupID}/jobs
```

<Tip>
  Use Job Groups to group jobs by service (e.g., "Auth Service", "Billing Service") or by function (e.g., "Data Processing", "Webhooks").
</Tip>
