Strait Docs
Guides

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

Job groups are enabled by default.

Create a Job Group

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

curl -H "Authorization: Bearer $API_KEY" \
  https://strait.dev/v1/job-groups?project_id=proj_123

Update a Job Group

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

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:

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:

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

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

Was this page helpful?

On this page