{
  "info": {
    "name": "Runhooks API",
    "description": "Complete Postman collection for the Runhooks REST API — schedule, manage, and monitor HTTP webhooks programmatically.\n\nBase URL: https://api.runhooks.app/api/v1\n\nSet the `api_key` collection variable to your API key (rh_live_...) before sending requests.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "base_url",
      "value": "https://api.runhooks.app/api/v1",
      "type": "string"
    },
    {
      "key": "api_key",
      "value": "rh_live_xxxxxxxxxxxx",
      "type": "string"
    },
    {
      "key": "job_id",
      "value": "",
      "type": "string"
    },
    {
      "key": "execution_id",
      "value": "",
      "type": "string"
    },
    {
      "key": "alert_id",
      "value": "",
      "type": "string"
    }
  ],
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{api_key}}",
        "type": "string"
      }
    ]
  },
  "item": [
    {
      "name": "Health",
      "item": [
        {
          "name": "Health Check",
          "request": {
            "auth": { "type": "noauth" },
            "method": "GET",
            "url": "{{base_url}}/health",
            "description": "Public endpoint — no authentication required. Returns API status and backing service health."
          }
        }
      ]
    },
    {
      "name": "Account",
      "item": [
        {
          "name": "Register",
          "request": {
            "auth": { "type": "noauth" },
            "method": "POST",
            "url": "{{base_url}}/auth/register",
            "header": [
              { "key": "Content-Type", "value": "application/json" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"me@example.com\",\n  \"password\": \"securepass\",\n  \"name\": \"My Name\"\n}"
            },
            "description": "Create a full account with email and password. Returns JWT tokens and an API key."
          }
        },
        {
          "name": "Register Anonymous",
          "request": {
            "auth": { "type": "noauth" },
            "method": "POST",
            "url": "{{base_url}}/auth/register-anonymous",
            "header": [
              { "key": "Content-Type", "value": "application/json" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"My Server\"\n}"
            },
            "description": "Create an anonymous account — no email required. Returns an API key."
          }
        },
        {
          "name": "Login",
          "request": {
            "auth": { "type": "noauth" },
            "method": "POST",
            "url": "{{base_url}}/auth/login",
            "header": [
              { "key": "Content-Type", "value": "application/json" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"me@example.com\",\n  \"password\": \"securepass\"\n}"
            },
            "description": "Sign in with email and password. Returns JWT access and refresh tokens."
          }
        },
        {
          "name": "Refresh Token",
          "request": {
            "auth": { "type": "noauth" },
            "method": "POST",
            "url": "{{base_url}}/auth/refresh",
            "header": [
              { "key": "Content-Type", "value": "application/json" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"refreshToken\": \"eyJ...\"\n}"
            },
            "description": "Exchange a refresh token for new access and refresh tokens."
          }
        },
        {
          "name": "Get Me",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/auth/me",
            "description": "Get the authenticated user's profile."
          }
        },
        {
          "name": "Rotate API Key",
          "request": {
            "method": "POST",
            "url": "{{base_url}}/auth/rotate-key",
            "description": "Generate a new API key. The old key stops working immediately."
          }
        }
      ]
    },
    {
      "name": "Jobs",
      "item": [
        {
          "name": "Create Job",
          "request": {
            "method": "POST",
            "url": "{{base_url}}/jobs",
            "header": [
              { "key": "Content-Type", "value": "application/json" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"Sync inventory\",\n  \"schedule\": {\n    \"type\": \"cron\",\n    \"expression\": \"*/5 * * * *\"\n  },\n  \"httpConfig\": {\n    \"url\": \"https://api.example.com/sync\",\n    \"method\": \"POST\"\n  },\n  \"retryPolicy\": {\n    \"maxRetries\": 3\n  },\n  \"tags\": [\"prod\"]\n}"
            },
            "description": "Create a new scheduled job."
          }
        },
        {
          "name": "List Jobs",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{base_url}}/jobs?page=1&limit=20",
              "host": ["{{base_url}}"],
              "path": ["jobs"],
              "query": [
                { "key": "page", "value": "1" },
                { "key": "limit", "value": "20" },
                { "key": "status", "value": "active", "disabled": true },
                { "key": "tag", "value": "", "disabled": true },
                { "key": "name", "value": "", "disabled": true }
              ]
            },
            "description": "List your jobs with optional filters and pagination."
          }
        },
        {
          "name": "Get Job",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/jobs/{{job_id}}",
            "description": "Get a single job by ID."
          }
        },
        {
          "name": "Update Job",
          "request": {
            "method": "PATCH",
            "url": "{{base_url}}/jobs/{{job_id}}",
            "header": [
              { "key": "Content-Type", "value": "application/json" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"Updated name\",\n  \"status\": \"paused\"\n}"
            },
            "description": "Update a job. Only include the fields you want to change."
          }
        },
        {
          "name": "Delete Job",
          "request": {
            "method": "DELETE",
            "url": "{{base_url}}/jobs/{{job_id}}",
            "description": "Delete a job permanently."
          }
        },
        {
          "name": "Get Job Executions",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{base_url}}/jobs/{{job_id}}/executions?page=1&limit=20",
              "host": ["{{base_url}}"],
              "path": ["jobs", "{{job_id}}", "executions"],
              "query": [
                { "key": "page", "value": "1" },
                { "key": "limit", "value": "20" },
                { "key": "status", "value": "", "disabled": true }
              ]
            },
            "description": "List executions for a specific job."
          }
        }
      ]
    },
    {
      "name": "Executions",
      "item": [
        {
          "name": "List Executions",
          "request": {
            "method": "GET",
            "url": {
              "raw": "{{base_url}}/executions?page=1&limit=20",
              "host": ["{{base_url}}"],
              "path": ["executions"],
              "query": [
                { "key": "page", "value": "1" },
                { "key": "limit", "value": "20" },
                { "key": "status", "value": "", "disabled": true },
                { "key": "jobId", "value": "", "disabled": true }
              ]
            },
            "description": "List executions across all your jobs."
          }
        },
        {
          "name": "Replay Execution",
          "request": {
            "method": "POST",
            "url": "{{base_url}}/executions/{{execution_id}}/replay",
            "description": "Re-run a past execution immediately."
          }
        }
      ]
    },
    {
      "name": "Alerts",
      "item": [
        {
          "name": "Create Alert",
          "request": {
            "method": "POST",
            "url": "{{base_url}}/alerts",
            "header": [
              { "key": "Content-Type", "value": "application/json" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"All failures\",\n  \"channel\": \"email\",\n  \"target\": \"me@example.com\",\n  \"consecutiveFailuresThreshold\": 1,\n  \"cooldownMinutes\": 60\n}"
            },
            "description": "Create a new alert configuration."
          }
        },
        {
          "name": "List Alerts",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/alerts",
            "description": "List all your alert configurations."
          }
        },
        {
          "name": "Get Alert",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/alerts/{{alert_id}}",
            "description": "Get a single alert configuration by ID."
          }
        },
        {
          "name": "Update Alert",
          "request": {
            "method": "PUT",
            "url": "{{base_url}}/alerts/{{alert_id}}",
            "header": [
              { "key": "Content-Type", "value": "application/json" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"enabled\": false\n}"
            },
            "description": "Update an alert configuration."
          }
        },
        {
          "name": "Delete Alert",
          "request": {
            "method": "DELETE",
            "url": "{{base_url}}/alerts/{{alert_id}}",
            "description": "Delete an alert configuration."
          }
        }
      ]
    },
    {
      "name": "Usage",
      "item": [
        {
          "name": "Get My Usage",
          "request": {
            "method": "GET",
            "url": "{{base_url}}/usage/me",
            "description": "Get your current plan, limits, and usage."
          }
        }
      ]
    }
  ]
}
