# Netsware: the complete guide for AI agents Version: API v1, OpenAPI 1.2.0. Generated from the same source as the API itself, so every field and example here is real. Short index: https://app.netsware.com/llms.txt · OpenAPI: https://app.netsware.com/openapi.json · Human docs: https://app.netsware.com/docs This guide is for an AI assistant (Claude, ChatGPT, Cursor, Copilot, an agent framework…) that has been given a Netsware API key by its user. Read it once, then you can set up and run Netsware for the user without guessing. --- # Part 1: What Netsware is Netsware answers two questions and acts on them: 1. **Is a business open right now?** For any country and timezone: working days, opening hours, weekends that differ by country, and public holidays (national, and regional for some countries). 2. **When should this HTTP call happen?** Netsware calls a URL (the user's "send", "sync", "export" or "notify" endpoint) at the right moment: once, on a repeating cron, or as a timed sequence. A job can be tied to business hours, so a run that falls on a weekend, after hours or on a public holiday is held back (deferred) and fires at the next opening minute instead. Think of Netsware as an alarm clock that only rings when the business is open. It does not send emails or messages itself: it calls the user's own endpoint that does the work. ## The building blocks - **Schedule** (id `sch_…`): a reusable definition of "when we are open": open days, one open and close time, timezone, country (and optional region) for holidays. Example: Tokyo office, Mon–Fri 10:00–18:30, Japanese holidays closed. - **Job** (id `job_…`): an HTTP call Netsware makes for the user. Types: `once` (at run_at), `recurring` (cron), `sequence` (steps with delays). Optional: tie it to one or more schedules, a retry policy (one-time jobs and sequence steps only; a recurring job is not retried within a run, it alerts and runs again at its next cron time), timeout, headers, JSON payload, success rules, failure alerts. - **Deferral**: when a job tied to a schedule comes due while the schedule is closed, Netsware moves it to the schedule's next open minute. It is logged with a reason, counted in deferred_runs, fires a `job.scheduled` webhook, and never uses up the retry budget. A missing schedule fails safe (the job is deferred, not fired at the wrong time). - **Run**: one execution of a job, with its attempts (retries), HTTP status, duration and error. History is kept 7/30/60/90 days depending on plan. - **Group** (id `grp_…`): a folder for jobs. - **Variable**: a reusable value, used in a job as `{{NAME}}` inside url, headers or payload. A secret variable is write-only: it can be used but never read back. An unknown `{{NAME}}` fails the run with an error naming it. - **Webhook endpoint** (id `wep_…`): the user's https URL that receives events (job failed, job recovered, schedule opened…), signed with a secret. **Doctrine: webhooks push, the API reads.** Webhooks tell the user's systems what just happened, in real time. The API is the source of truth for state and history. If a webhook was missed (receiver down), reconcile with GET /v1/runs and GET /v1/metrics instead of assuming nothing happened. --- # Part 2: Rules for agents 1. **Authenticate** with the header `X-API-Key: nw_live_…` (the full key the user gave you) on every request, never as Authorization: Bearer. A read-only key can read but not change anything. Base URL https://app.netsware.com. JSON bodies need `Content-Type: application/json`. 2. **Start with `GET /v1`** if unsure; it lists every endpoint. Use `GET /v1/usage` to learn the user's plan and limits before creating many things. 3. **Never guess a field.** Use the reference in Part 6. If a request fails, the reply tells you exactly what to change (Part 4). 4. **Ask the user before anything destructive or costly**: DELETE of any kind, `permanent=true`, turning schedules off, pausing jobs, or creating more than a handful of jobs at once. Read and check freely. 5. **Times: always say both zones.** Jobs and schedules run in the timezone you give them (IANA names like Asia/Tokyo). When you report a time to the user, give it in the target zone and in the user's own zone, e.g. "Fri 10:00 Tokyo (6:30 IST)". Every job reply has next_run_at (UTC) and next_run_at_local. 6. **Secrets**: put tokens and passwords in a secret variable (`PUT /v1/variables` with is_secret true and allowed_destinations set to the target host), then reference `{{NAME}}` in headers or payload. Never put a secret directly in a job, and never echo it back to the user. 7. **Schedule updates are a full replace**: `GET /v1/schedules/{id}` first, change what you need, send every field to `PUT`. Job updates are partial: send only what changes. 8. **Prove it works**: after creating a job, run `POST /v1/jobs/{id}/trigger` once when the user agrees (it uses one execution from the plan, shown as "test" in GET /v1/usage), and show the result and the next run time. 9. **Ids**: keep the full ids the API returns (`sch_…`, `job_…`, `grp_…`, `wep_…`). The `sch_` prefix is optional when you send a schedule id. 10. **Lists are paginated**: `page` (from 1) and `limit` (max 100). Follow next_page / has_more until done. 11. **Respect limits**: on HTTP 429 wait (see the Retry-After header) and retry; X-RateLimit-Limit / X-RateLimit-Remaining / X-RateLimit-Reset tell you the per-minute budget. --- # Part 3: Recipes (step by step) ## Recipe A: Send only during a country's business hours User: "My emails are ready. Send them in Tokyo business hours, weekdays 10:00 to 18:30, skip Japanese holidays." What you need from the user: the URL that triggers their sending (their "send now" endpoint), any token it needs, how often to call it during the window (once at opening, or every N minutes), and whether to skip holidays. 1. Create the schedule: POST /v1/schedules {"name":"Tokyo office hours","country_code":"JP","timezone":"Asia/Tokyo","days":["MON","TUE","WED","THU","FRI"],"open_time":"10:00","close_time":"18:30","respect_holidays":true} → keep the returned id (sch_…). 2. Store the token as a secret: PUT /v1/variables {"name":"SEND_TOKEN","value":"","is_secret":true,"allowed_destinations":["api.example.com"]} 3. Create the job tied to the schedule (every 15 minutes, only while open): POST /v1/jobs {"type":"recurring","name":"Send email batch","url":"https://api.example.com/send","method":"POST","timezone":"Asia/Tokyo","cron":"*/15 * * * *","headers":{"Authorization":"Bearer {{SEND_TOKEN}}"},"business_hours_schedule_id":"sch_…"} For a single send at opening time use "cron":"0 10 * * MON-FRI" instead. 4. With the user's OK, test once: POST /v1/jobs/{id}/trigger. Report the result. 5. Confirm: GET /v1/schedules/{sch}/check tells whether Tokyo is open now and when it next opens; report next_run_at_local in Tokyo time and in the user's time. ## Recipe B: Make an existing cron skip weekends and public holidays 1. Create a schedule for the country with the working days and hours (Recipe A step 1). Use 00:00 to 23:59 if only weekends and holidays matter. 2. Attach it to the job: PUT /v1/jobs/{id} {"business_hours_schedule_id":"sch_…"} Runs that fall outside it are now deferred to the next open minute. ## Recipe C: Tell me when a job fails (and when it is fixed) 1. POST /v1/webhooks/endpoints {"url":"https://example.com/netsware-events","events":[{"product":"scheduled_jobs","event":"job.failed"},{"product":"scheduled_jobs","event":"job.recovered"}]} 2. Save the returned secret (shown once) and verify every delivery (Part 5). 3. Or, without code: the user adds a channel (Email, Slack, Telegram, Discord, Google Chat, Microsoft Teams) in the dashboard under Notifications and ticks it on the job there. If the user gives you a channel id, you can attach it yourself with notify_channel_ids. ## Recipe D: What broke and why? 1. GET /v1/runs?status=failed&since=24h → failed runs across all jobs. 2. GET /v1/jobs/{id}/logs?status=failed → that job's history. 3. GET /v1/jobs/{id}/runs/{run_id} → every attempt: HTTP status, response, timing, error. 4. Explain the cause in plain words. After the user fixes it: POST /v1/jobs/{id}/retry. Held-back runs (not failures) are in GET /v1/runs?status=deferred. ## Recipe E: Is a place open? Which days are holidays? - Right now: GET /v1/check?timezone=Asia/Tokyo&country=JP&open_time=09:00&close_time=18:00 - At a given moment: add timestamp=2026-11-10T23:00:00+05:30 (any offset; Netsware converts). - Holidays: GET /v1/holidays?country=JP&year=2026 · countries and their timezones/weekends: GET /v1/hours/meta/countries · states/regions: GET /v1/hours/meta/regions?country=US ## Recipe F: A one-off call at a local time POST /v1/jobs {"type":"once","name":"Launch reminder","url":"https://example.com/remind","timezone":"Europe/Berlin","run_at":"2026-12-01T09:00:00"} ## Recipe G: Several offices Create one schedule per office (or one call with "timezones":[...] or, on Pro, "regions":[...]). Then either - tie a job to all of them: "business_hours_schedule_ids":["sch_a","sch_b"],"business_hours_match":"any" (runs when at least one is open) or "all" (only when every one is open); or - ask: GET /v1/schedules/resolve?schedule_ids=sch_a,sch_b&match=any ## Recipe H: How much of the plan is used? GET /v1/usage (this month vs limits) and GET /v1/metrics?window=30d (daily totals). --- # Part 4: Errors, and how to fix them yourself Every error has the same JSON shape (the // notes are explanations, not part of the reply): { "error": "validation_error", // stable code "message": "2 problems: name is required; ...", // every problem, named "fields": [{"path":"name","message":"name is required"}], "usage": {"endpoint":"POST /v1/schedules","params":{"name":"required, string, in body. ..."},"example":"POST /v1/schedules {...}"}, "docs": "https://app.netsware.com/docs#schedules" } How to recover: read `fields`, compare with `usage.params`, copy the shape of `usage.example`, fix and send again. Do not retry an unchanged request. Status codes: - 400 the request could not be used as sent: unreadable JSON (invalid_body), a malformed list query (invalid_query), or a value rejected with its own code (e.g. invalid_timezone, invalid_region, url_not_allowed). Has usage. - 401 no key or a bad key. The reply's `help` says how to authenticate. - 403 a read-only key tried to write, or the plan does not include this (e.g. a country's holidays, regions, more retries). The message names the plan needed: tell the user. - 404 the id is not in this account, or an unknown path. For a mistyped path the reply has `did_you_mean`. - 405 the path exists but not with this method. The Allow header and `allowed_methods` list what works, with usage for each. - 409 the job is running right now; try again shortly. - 415 send Content-Type: application/json. - 422 validation_error: a field is missing or has the wrong type or format. Same status on every endpoint. Also used when a well-formed value is not acceptable (e.g. invalid_cron, a group id that is not the user's, a retry count above the plan). Has fields + usage. Decide what to do from the `error` code, not from the number alone. - 429 rate limit or monthly quota reached; wait for Retry-After, or tell the user about the monthly limit. - 5xx a problem on Netsware's side; retry later with backoff. --- # Part 5: Webhooks (events pushed to the user) Events you can subscribe to: job.completed, job.failed, job.retry, job.recovered, job.scheduled, job.cancelled, job.paused, job.resumed, schedule.opened, schedule.closed, schedule.holiday, schedule.activated, schedule.deactivated. Each event belongs to a product: job.* events to "scheduled_jobs", schedule.* events to "business_hours". - job.failed: a run failed after its retries. job.recovered: a job succeeded right after a failure ("back to green"). - job.scheduled: a run was planned or deferred (includes deferred_reason and the new next_run_at). - schedule.opened / schedule.closed / schedule.holiday: a schedule changed state. Every delivery is a POST with JSON {event, event_id (evt_…, stable across retries, use it to ignore duplicates), occurred_at, data {...}} and these headers: - X-Netsware-Event: the event name - X-Netsware-Timestamp: unix seconds - X-Netsware-Signature: sha256=." with the endpoint secret> Verify by computing the same HMAC over the raw body, comparing in constant time, and rejecting old timestamps. The netsware-sdk packages (npm and PyPI) include a verifyWebhook helper. Failed deliveries are retried (immediately, after 5 minutes, after 30 minutes); see them with GET /v1/webhooks/endpoints/{id}/deliveries. --- # Part 6: Endpoint reference (every endpoint, every field) ## Business Hours ### GET /v1/check Is it open? Check business hours at an instant. Read-only. Ad-hoc check without saving anything: give hours, a country and a timezone; get open/closed, the reason and the next opening. For a saved schedule use GET /v1/schedules/{id}/check. Also served at: /v1/hours/check. Fields: - timezone (query; required; string): IANA timezone, e.g. Asia/Tokyo. - country (query; required; string): ISO alpha-2 country for public holidays, e.g. JP. - timestamp (query; optional; string; default: now): Instant to check, ISO 8601 with offset, e.g. 2026-11-10T23:00:00+05:30. - open_time (query; optional; string; default: 09:00): Opening time HH:MM. - close_time (query; optional; string; default: 18:00): Closing time HH:MM. Earlier than open_time means overnight (22:00 to 06:00). Cannot equal open_time. - days (query; optional; string; one of: MON, TUE, WED, THU, FRI, SAT, SUN; default: MON,TUE,WED,THU,FRI): Comma-separated open days. - region (query; optional; string): State/region code for regional holidays, e.g. CA. Any plan, for the countries your plan covers: Essentials its 10 countries, paid plans all countries. Example: GET /v1/check?timezone=Asia/Tokyo&country=JP&open_time=10:00&close_time=18:30 Success: HTTP 200. Returns: {open, reason (open|before_hours|after_hours|weekend|public_holiday|closed|disabled), holiday_name (only on a holiday, e.g. "Republic Day"), checked_at, local_time, timezone, country, next_open {utc, local, day}}. ### GET /v1/holidays List public holidays for a country and year. Read-only. Also served at: /v1/hours/holidays. Fields: - country (query; required; string): ISO alpha-2 country, e.g. JP. - year (query; required; string): 4-digit year, e.g. 2026. - region (query; optional; string): State/region code for regional holidays. Any plan, for the countries your plan covers: Essentials its 10 countries, paid plans all countries. - type (query; optional; string): Filter by holiday type, e.g. public. Example: GET /v1/holidays?country=JP&year=2026 Success: HTTP 200. Returns: {country, region, year, count, holidays: [{date, name, name_local, type, region}]}. ### GET /v1/hours/meta/countries Supported countries with their timezones and weekends. Read-only. Fields: none. Example: GET /v1/hours/meta/countries Success: HTTP 200. Returns: {countries: [{code, name, timezones, weekend?}]}. weekend uses 0=Sunday … 6=Saturday. ### GET /v1/hours/meta/regions States/regions of a country (for region and regions[]). Read-only. Fields: - country (query; required; string): ISO alpha-2 country, e.g. US. Example: GET /v1/hours/meta/regions?country=US Success: HTTP 200. Returns: {country, regions: {CODE: name}, region_timezones: {CODE: timezone}}. ## Schedules ### GET /v1/schedules List schedules. Read-only. Also served at: /v1/hours/schedules. Fields: - status (query; optional; string; one of: active, disabled, deleted; default: active + disabled): Filter by state. - country (query; optional; string): Filter by ISO alpha-2 country. - page (query; optional; integer; default: 1): Page number, starting at 1. - limit (query; optional; integer; default: 25): Items per page, at most 100. Example: GET /v1/schedules?status=active&limit=50 Success: HTTP 200. Returns: {schedules: [...], page, limit, total, has_more, next_page}. ### POST /v1/schedules Create a business-hours schedule. Changes data (needs a read-write key). A schedule is a reusable "when are we open" definition: days, one open/close time, timezone and country holidays. Jobs can be tied to it so they only run while it is open. Also served at: /v1/hours/schedules. Fields: - name (body; required; string): A name you will recognise, 1 to 100 characters. - country_code (body; required; string): ISO 3166-1 alpha-2 country, e.g. JP, IN, US. Decides which public holidays apply. - timezone (body; required unless timezones[] or regions[] is given; string): IANA timezone the hours are in, e.g. Asia/Tokyo. - timezones (body; optional; array of string): Create one schedule per timezone in one call (max 32). Create only. - regions (body; optional; array of object {code, timezone?}): State mode: one schedule per state/region with its own holidays and timezone (max 32). Any plan, for the countries your plan covers: Essentials its 10 countries, paid plans all countries. Cannot be combined with timezones[] or region. Create only. - region (body; optional; string): State/region code for regional holidays, e.g. CA. Any plan, for the countries your plan covers: Essentials its 10 countries, paid plans all countries. List codes with GET /v1/hours/meta/regions. - days (body; required; array of string; one of: MON, TUE, WED, THU, FRI, SAT, SUN): Open days, e.g. ["MON","TUE","WED","THU","FRI"]. An empty list makes an always-closed schedule. - open_time (body; required; string): Opening time, 24-hour HH:MM, e.g. 09:00. - close_time (body; required; string): Closing time, HH:MM. Earlier than open_time means overnight (22:00 to 06:00). Cannot equal open_time. - respect_holidays (body; optional; boolean; default: true): Treat public holidays of country_code (and region) as closed. Example: POST /v1/schedules {"name":"Tokyo office","country_code":"JP","timezone":"Asia/Tokyo","days":["MON","TUE","WED","THU","FRI"],"open_time":"10:00","close_time":"18:30","respect_holidays":true} Success: HTTP 201. Returns: {id: "sch_…", name, timezone, region, is_active, created_at}. With timezones[]/regions[]: one per entry. ### GET /v1/schedules/stats Count schedules by state. Read-only. Also served at: /v1/hours/schedules/stats. Fields: none. Example: GET /v1/schedules/stats Success: HTTP 200. Returns: {schedules: {total, active, disabled, deleted}}. ### GET /v1/schedules/resolve Combine several schedules: is any / are all open now?. Read-only. Also served at: /v1/hours/schedules/resolve. Fields: - schedule_ids (query; required; string): Comma-separated schedule ids, e.g. sch_a,sch_b. - match (query; optional; string; one of: any, all; default: any): any = open if one is open; all = open only if all are open. Example: GET /v1/schedules/resolve?schedule_ids=sch_a,sch_b&match=all Success: HTTP 200. Returns: {open, match, reason, next_transition {utc, local, day}, next_transition_to, contributing: [{id, name, open, reason}]}. ### GET /v1/schedules/{id} Get one schedule. Read-only. Also served at: /v1/hours/schedules/{id}. Fields: - id (path; required; string): Schedule id, e.g. sch_16f3561f-… (the sch_ prefix is optional). Example: GET /v1/schedules/sch_16f3561f-5788-4478-8ca5-c78ca6066606 Success: HTTP 200. Returns: {id, name, timezone, country_code, region, respect_holidays, is_active, days, open_time, close_time, created_at, updated_at, deleted_at}. ### PUT /v1/schedules/{id} Replace a schedule (send every field, like create). Changes data (needs a read-write key). Full replace: send the same fields as create with a single timezone (timezones[]/regions[] are create-only). Also served at: /v1/hours/schedules/{id}. Fields: - id (path; required; string): Schedule id, e.g. sch_16f3561f-… (the sch_ prefix is optional). - name (body; required; string): A name you will recognise, 1 to 100 characters. - country_code (body; required; string): ISO 3166-1 alpha-2 country, e.g. JP, IN, US. Decides which public holidays apply. - timezone (body; required; string): IANA timezone the hours are in, e.g. Asia/Tokyo. - region (body; optional; string): State/region code for regional holidays, e.g. CA. Any plan, for the countries your plan covers: Essentials its 10 countries, paid plans all countries. List codes with GET /v1/hours/meta/regions. - days (body; required; array of string; one of: MON, TUE, WED, THU, FRI, SAT, SUN): Open days, e.g. ["MON","TUE","WED","THU","FRI"]. An empty list makes an always-closed schedule. - open_time (body; required; string): Opening time, 24-hour HH:MM, e.g. 09:00. - close_time (body; required; string): Closing time, HH:MM. Earlier than open_time means overnight (22:00 to 06:00). Cannot equal open_time. - respect_holidays (body; optional; boolean; default: true): Treat public holidays of country_code (and region) as closed. Example: PUT /v1/schedules/sch_16f3… {"name":"Tokyo office","country_code":"JP","timezone":"Asia/Tokyo","days":["MON","TUE","WED","THU","FRI"],"open_time":"09:00","close_time":"18:00"} Success: HTTP 200. Returns: The updated schedule. ### DELETE /v1/schedules/{id} Delete a schedule (soft by default). Changes data (needs a read-write key). Also served at: /v1/hours/schedules/{id}. Fields: - id (path; required; string): Schedule id, e.g. sch_16f3561f-… (the sch_ prefix is optional). - permanent (query; optional; boolean; default: false): true = delete for good (cannot be undone). Example: DELETE /v1/schedules/sch_16f3… Success: HTTP 200. Returns: {deleted: true, permanent, id}. ### GET /v1/schedules/{id}/check Is this saved schedule open right now?. Read-only. Also served at: /v1/hours/schedules/{id}/check. Fields: - id (path; required; string): Schedule id, e.g. sch_16f3561f-… (the sch_ prefix is optional). Example: GET /v1/schedules/sch_16f3…/check Success: HTTP 200. Returns: {open, reason, local_time, next_open {utc, local, day}, schedule_id}. ### PUT /v1/schedules/{id}/active Turn a schedule on or off. Changes data (needs a read-write key). Also served at: /v1/hours/schedules/{id}/active. Fields: - id (path; required; string): Schedule id, e.g. sch_16f3561f-… (the sch_ prefix is optional). - is_active (body; required; boolean): true = on, false = off. Example: PUT /v1/schedules/sch_16f3…/active {"is_active":false} Success: HTTP 200. Returns: The schedule with its new is_active. ## Jobs ### GET /v1/jobs List jobs. Read-only. Fields: - status (query; optional; string; one of: active, disabled, deleted; default: live jobs): Filter by state. - type (query; optional; string; one of: once, recurring, sequence): Filter by job type. - group (query; optional; string): Filter by group id (grp_…) or none for ungrouped. - search (query; optional; string): Match on name or url. - page (query; optional; integer; default: 1): Page number, starting at 1. - limit (query; optional; integer; default: 25): Items per page, at most 100. Example: GET /v1/jobs?status=active&limit=50 Success: HTTP 200. Returns: {jobs: [...], page, limit, total, has_more, next_page}. ### POST /v1/jobs Create a scheduled HTTP job. Changes data (needs a read-write key). A job calls your url at the right time. Tie it to a schedule (business_hours_schedule_id) and runs that fall outside business hours or on holidays are held back (deferred) until the next opening. Fields: - type (body; required; string; one of: once, recurring, sequence): once = one run at run_at; recurring = repeats on cron; sequence = a series of steps with delays. Cannot be changed later. - name (body; optional; string): A name you will recognise, up to 200 characters. - url (body; required unless type=sequence; string): The URL Netsware calls when the job runs (your "send" endpoint). Use https. Private/internal addresses are refused. - method (body; optional; string; one of: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS; default: POST): HTTP method used to call url. - timezone (body; required unless timezones[] is given; string): IANA timezone that run_at and cron are read in, e.g. Asia/Tokyo. - timezones (body; optional; array of string): Create one job per timezone in one call (max 32). - run_at (body; required when type=once; string): When a once job runs, local date-time in timezone, e.g. 2026-12-01T09:00:00. - cron (body; required when type=recurring; string): Standard 5-field cron in timezone, e.g. "*/15 * * * *" (every 15 min) or "0 10 * * MON-FRI". - steps (body; required when type=sequence; array of object {delay, delay_unit, url, payload?}): Sequence steps: delay (integer ≥ 0) + delay_unit (minutes|hours|days) + url (+ optional payload). Cannot be changed later. - payload (body; optional; object): JSON body sent to url. May contain {{VARIABLE}} references. - headers (body; optional; object): Extra HTTP headers sent to url, e.g. {"Authorization":"Bearer {{SEND_TOKEN}}"}. - business_hours_schedule_id (body; optional; string): Only run while this schedule is open (sch_…). A run due while closed is deferred to the next opening. - business_hours_schedule_ids (body; optional; array of string): Several schedules (sch_…); combine them with business_hours_match. - business_hours_match (body; optional; string; one of: any, all; default: any): any = run when at least one schedule is open; all = only when every schedule is open. - retry (body; optional; object): Retry policy for one-time jobs and sequence steps. A recurring job is not retried within a run: a failed run sends its failure alert and the job runs again at its next scheduled time (the value is accepted but not used). Shape: {attempts 0-10, backoff exponential|fixed, base_seconds 60-1800, max_seconds 300-7200}. Plan limits apply: Essentials 1 attempt, more on Standard and up; exponential backoff needs Pro or Max. Defaults depend on the plan. - timeout_seconds (body; optional; integer; default: 30): Seconds to wait for url to answer, 1 to 300. - success_codes (body; optional; array of integer; default: [200,201,202,204]): HTTP status codes that count as success. - success_match (body; optional; string): Text (or regex) the response body must match to count as success, up to 500 characters. - success_match_mode (body; optional; string; one of: contains, not_contains, regex): How success_match is applied. - timing_mode (body; optional; string; one of: exact, jitter; default: exact): jitter spreads recurring runs randomly by up to jitter_seconds. - jitter_seconds (body; required when timing_mode=jitter; integer): Random spread in seconds, 1 to 3600. - group_id (body; optional; string): Put the job in a group (grp_…). - notify_channel_ids (body; optional; array of string): Notification channels (Email, Slack, Telegram, Discord, Google Chat, Microsoft Teams, webhook; created in the dashboard) to alert when the job fails. - notify_channel_id (body; optional; string): Single-channel form of notify_channel_ids. Example: POST /v1/jobs {"type":"recurring","name":"Send email batch","url":"https://example.com/send","method":"POST","timezone":"Asia/Tokyo","cron":"*/15 * * * *","business_hours_schedule_id":"sch_16f3…"} Success: HTTP 201. Returns: The job: {id: "job_…", status, next_run_at (UTC), next_run_at_local, …}. With timezones[]: {jobs: [...]}. ### GET /v1/jobs/stats Job and run counts. Read-only. Fields: none. Example: GET /v1/jobs/stats Success: HTTP 200. Returns: {total_jobs, total_runs, successful_runs, failed_runs, deferred_runs, success_rate, jobs {...}, runs {...}}. ### GET /v1/jobs/{id} Get one job. Read-only. Fields: - id (path; required; string): Job id, e.g. job_a1f1fec8-…. Example: GET /v1/jobs/job_a1f1… Success: HTTP 200. Returns: The full job including next_run_at, last_run_at and run counters. ### PUT /v1/jobs/{id} Change a job (send only the fields to change). Changes data (needs a read-write key). Partial update. type and sequence steps cannot be changed. Send null to clear a nullable field (e.g. business_hours_schedule_id). Fields: - id (path; required; string): Job id, e.g. job_a1f1fec8-…. - name (body; optional; string): A name you will recognise, up to 200 characters. - url (body; optional; string): The URL Netsware calls when the job runs (your "send" endpoint). Use https. Private/internal addresses are refused. - method (body; optional; string; one of: GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS): HTTP method used to call url. - timezone (body; optional; string): IANA timezone that run_at and cron are read in, e.g. Asia/Tokyo. - run_at (body; optional; string): When a once job runs, local date-time in timezone, e.g. 2026-12-01T09:00:00. - cron (body; optional; string): Standard 5-field cron in timezone, e.g. "*/15 * * * *" (every 15 min) or "0 10 * * MON-FRI". - payload (body; optional; object): JSON body sent to url. May contain {{VARIABLE}} references. - headers (body; optional; object): Extra HTTP headers sent to url, e.g. {"Authorization":"Bearer {{SEND_TOKEN}}"}. - business_hours_schedule_id (body; optional; string): Only run while this schedule is open (sch_…). A run due while closed is deferred to the next opening. - business_hours_schedule_ids (body; optional; array of string): Several schedules (sch_…); combine them with business_hours_match. - business_hours_match (body; optional; string; one of: any, all): any = run when at least one schedule is open; all = only when every schedule is open. - retry (body; optional; object): Retry policy for one-time jobs and sequence steps. A recurring job is not retried within a run: a failed run sends its failure alert and the job runs again at its next scheduled time (the value is accepted but not used). Shape: {attempts 0-10, backoff exponential|fixed, base_seconds 60-1800, max_seconds 300-7200}. Plan limits apply: Essentials 1 attempt, more on Standard and up; exponential backoff needs Pro or Max. Defaults depend on the plan. - timeout_seconds (body; optional; integer): Seconds to wait for url to answer, 1 to 300. - success_codes (body; optional; array of integer): HTTP status codes that count as success. - success_match (body; optional; string): Text (or regex) the response body must match to count as success, up to 500 characters. - success_match_mode (body; optional; string; one of: contains, not_contains, regex): How success_match is applied. - timing_mode (body; optional; string; one of: exact, jitter): jitter spreads recurring runs randomly by up to jitter_seconds. - jitter_seconds (body; required when timing_mode=jitter; integer): Random spread in seconds, 1 to 3600. - group_id (body; optional; string): Put the job in a group (grp_…). - notify_channel_ids (body; optional; array of string): Notification channels (Email, Slack, Telegram, Discord, Google Chat, Microsoft Teams, webhook; created in the dashboard) to alert when the job fails. - notify_channel_id (body; optional; string): Single-channel form of notify_channel_ids. Example: PUT /v1/jobs/job_a1f1… {"cron":"0 10 * * MON-FRI"} Success: HTTP 200. Returns: The updated job. ### DELETE /v1/jobs/{id} Cancel (delete) a job. Changes data (needs a read-write key). Fields: - id (path; required; string): Job id, e.g. job_a1f1fec8-…. Example: DELETE /v1/jobs/job_a1f1… Success: HTTP 200. Returns: The job with status "cancelled". ### PUT /v1/jobs/{id}/pause Pause a job. Changes data (needs a read-write key). Fields: - id (path; required; string): Job id, e.g. job_a1f1fec8-…. Example: PUT /v1/jobs/job_a1f1…/pause Success: HTTP 200. Returns: The job with status "paused". ### PUT /v1/jobs/{id}/resume Resume a paused job. Changes data (needs a read-write key). Fields: - id (path; required; string): Job id, e.g. job_a1f1fec8-…. Example: PUT /v1/jobs/job_a1f1…/resume Success: HTTP 200. Returns: The job with status "scheduled". ### POST /v1/jobs/{id}/trigger Run a job now (manual test run). Changes data (needs a read-write key). Runs once immediately and returns the result. Not available for sequence jobs (use retry). Uses one execution from the plan (shown as "test" in GET /v1/usage). Fields: - id (path; required; string): Job id, e.g. job_a1f1fec8-…. Example: POST /v1/jobs/job_a1f1…/trigger Success: HTTP 200. Returns: {id, run_id, triggered: true, success, http_status, duration_ms, error}. ### POST /v1/jobs/{id}/retry Retry a failed job or sequence. Changes data (needs a read-write key). Fields: - id (path; required; string): Job id, e.g. job_a1f1fec8-…. Example: POST /v1/jobs/job_a1f1…/retry Success: HTTP 200. Returns: The job, queued to run again. Only a failed job can be retried (otherwise error invalid_state). ## Runs & Metrics ### GET /v1/jobs/{id}/logs Run history of one job. Read-only. Fields: - id (path; required; string): Job id, e.g. job_a1f1fec8-…. - status (query; optional; string; one of: success, failed, timeout): Only runs with this outcome. - page (query; optional; integer; default: 1): Page number, starting at 1. - limit (query; optional; integer; default: 25): Items per page, at most 100. Example: GET /v1/jobs/job_a1f1…/logs?status=failed&limit=50 Success: HTTP 200. Returns: {logs: [{run_id, attempt, attempt_number, max_attempts, status, http_status, error_message, duration_ms, executed_at}], pagination {page, limit, total, total_pages, has_next, has_prev}}. History is kept 7/30/60/90 days by plan. ### GET /v1/jobs/{id}/runs/{run_id} One run in detail (every attempt). Read-only. Fields: - id (path; required; string): Job id, e.g. job_a1f1fec8-…. - run_id (path; required; string): Run UUID from the logs. Example: GET /v1/jobs/job_a1f1…/runs/6f1c2c1e-… Success: HTTP 200. Returns: The run and each of its attempts (status, http_status, error, timing). 404 if the run is older than your plan history. ### GET /v1/runs What is broken? Failed or deferred runs across all jobs. Read-only. Fields: - status (query; required; string; one of: failed, deferred): failed = runs that failed; deferred = runs held back outside business hours. - since (query; optional; string; one of: 24h, 48h, 7d; default: 24h): How far back to look (max 7d). - job (query; optional; string): Only this job (job_…). - page (query; optional; integer; default: 1): Page number, starting at 1. - limit (query; optional; integer; default: 25): Items per page, at most 100. Example: GET /v1/runs?status=failed&since=24h&limit=50 Success: HTTP 200. Returns: {data: [{run_id, job_id, job_name, status, http_status, error, occurred_at}], pagination {page, limit, has_next, has_prev, next_page}}. ### GET /v1/metrics Daily monitoring totals. Read-only. Fields: - window (query; optional; string; one of: 24h, 48h, 7d, 30d, 60d, 90d; default: 30d): Period, limited to your plan's history. Example: GET /v1/metrics?window=7d Success: HTTP 200. Returns: {window, from, to, totals {api_calls, job_executions, webhook_deliveries, runs {success, failed, timeout, deferred}}, series: [same per day], current {active_jobs, active_schedules}}. ## Groups ### GET /v1/groups List job groups. Read-only. Fields: - page (query; optional; integer; default: 1): Page number, starting at 1. - limit (query; optional; integer; default: 25): Items per page, at most 100. Example: GET /v1/groups Success: HTTP 200. Returns: {groups: [{id, name, job_count, created_at}], page, limit, total, has_more}. ### POST /v1/groups Create a group. Changes data (needs a read-write key). Fields: - name (body; required; string): Group name, 1 to 100 characters. Example: POST /v1/groups {"name":"Email"} Success: HTTP 201. Returns: {id: "grp_…", name, job_count, created_at}. ### GET /v1/groups/{id} Get one group. Read-only. Fields: - id (path; required; string): Group id, e.g. grp_bbd7aca6-…. Example: GET /v1/groups/grp_bbd7… Success: HTTP 200. Returns: {id, name, job_count, created_at}. ### PATCH /v1/groups/{id} Rename a group. Changes data (needs a read-write key). Fields: - id (path; required; string): Group id, e.g. grp_bbd7aca6-…. - name (body; required; string): New name, 1 to 100 characters. Example: PATCH /v1/groups/grp_bbd7… {"name":"Newsletters"} Success: HTTP 200. Returns: The renamed group. ### DELETE /v1/groups/{id} Delete a group (its jobs become ungrouped). Changes data (needs a read-write key). Fields: - id (path; required; string): Group id, e.g. grp_bbd7aca6-…. Example: DELETE /v1/groups/grp_bbd7… Success: HTTP 200. Returns: {ok: true, id}. ## Variables ### GET /v1/variables List variables (secret values are never returned). Read-only. Fields: - group_id (query; optional; string): Variables of this group; omit for account-wide ones. Example: GET /v1/variables Success: HTTP 200. Returns: {variables: [{name, value (null when secret), is_secret, is_disabled, allowed_destinations, updated_at}]}. ### PUT /v1/variables Create or update a variable. Changes data (needs a read-write key). Use it in a job as {{NAME}} inside url, headers or payload. Secrets are write-only: they can be used but never read back. Fields: - name (body; required; string): UPPER_SNAKE name starting with a letter, e.g. SEND_TOKEN. - value (body; required; string): The value, up to 10,000 characters. - is_secret (body; optional; boolean; default: false): true = write-only, never shown again. - is_disabled (body; optional; boolean; default: false): true = keep it but stop substituting it. - group_id (body; optional; string): Scope the variable to a group (grp_…). - allowed_destinations (body; optional; array of string): Hosts this value may be sent to, e.g. ["api.example.com", ".example.com"] (max 50). Example: PUT /v1/variables {"name":"SEND_TOKEN","value":"…","is_secret":true,"allowed_destinations":["api.example.com"]} Success: HTTP 200. Returns: {name, saved: true}. ### DELETE /v1/variables/{name} Delete a variable. Changes data (needs a read-write key). Fields: - name (path; required; string): Variable name, e.g. SEND_TOKEN. - group_id (query; optional; string): The group it belongs to, if any. Example: DELETE /v1/variables/SEND_TOKEN Success: HTTP 200. Returns: {ok: true}. ## Webhooks ### POST /v1/webhooks/endpoints Register one URL for many events (recommended). Changes data (needs a read-write key). Fields: - url (body; required; string): Your https URL that receives the events. - events (body; required; array of object {product, event}): 1 to 20 of {product: business_hours|scheduled_jobs, event: job.completed|job.failed|job.retry|job.recovered|job.scheduled|job.cancelled|job.paused|job.resumed|schedule.opened|schedule.closed|schedule.holiday|schedule.activated|schedule.deactivated}. Example: POST /v1/webhooks/endpoints {"url":"https://example.com/hook","events":[{"product":"scheduled_jobs","event":"job.failed"}]} Success: HTTP 201. Returns: {endpoint_id: "wep_…", url, events, secret: "whsec_…"}. The secret is shown ONCE: store it to verify X-Netsware-Signature. ### GET /v1/webhooks/endpoints List webhook endpoints. Read-only. Fields: none. Example: GET /v1/webhooks/endpoints Success: HTTP 200. Returns: {endpoints: [{endpoint_id, url, is_active, events, created_at, last_triggered_at}]}. ### PATCH /v1/webhooks/endpoints/{id} Change an endpoint (URL, events, on/off); the secret is kept. Changes data (needs a read-write key). Fields: - id (path; required; string): Webhook endpoint id, e.g. wep_6d0566c2-…. - url (body; optional; string): New https URL. - is_active (body; optional; boolean): false = stop sending. - events (body; optional; array of object {product, event}): Replacement list of 1 to 20 events. Example: PATCH /v1/webhooks/endpoints/wep_6d05… {"is_active":false} Success: HTTP 200. Returns: {ok: true}. ### DELETE /v1/webhooks/endpoints/{id} Delete an endpoint. Changes data (needs a read-write key). Fields: - id (path; required; string): Webhook endpoint id, e.g. wep_6d0566c2-…. Example: DELETE /v1/webhooks/endpoints/wep_6d05… Success: HTTP 200. Returns: {deleted: true}. ### POST /v1/webhooks/endpoints/{id}/test Send a signed test event to an endpoint. Changes data (needs a read-write key). Fields: - id (path; required; string): Webhook endpoint id, e.g. wep_6d0566c2-…. Example: POST /v1/webhooks/endpoints/wep_6d05…/test Success: HTTP 200. Returns: {sent, delivered}: whether the signed webhook.test event was sent and accepted (2xx) by your URL. ### GET /v1/webhooks/endpoints/{id}/deliveries Recent deliveries to an endpoint. Read-only. Fields: - id (path; required; string): Webhook endpoint id, e.g. wep_6d0566c2-…. Example: GET /v1/webhooks/endpoints/wep_6d05…/deliveries Success: HTTP 200. Returns: {deliveries: [...]}: the latest deliveries (up to 50) with event, status code, attempt and time. ### POST /v1/webhooks Register a URL for ONE event (older style; prefer /v1/webhooks/endpoints). Changes data (needs a read-write key). Fields: - product (body; required; string; one of: business_hours, scheduled_jobs): Which product the event belongs to. - event (body; required; string; one of: job.completed, job.failed, job.retry, job.recovered, job.scheduled, job.cancelled, job.paused, job.resumed, schedule.opened, schedule.closed, schedule.holiday, schedule.activated, schedule.deactivated): The event to receive. - url (body; required; string): Your https URL. Example: POST /v1/webhooks {"product":"scheduled_jobs","event":"job.failed","url":"https://example.com/hook"} Success: HTTP 201. Returns: {id: "whk_…", product, event, url, is_active, created_at, secret}. The secret is shown once. ### GET /v1/webhooks List single-event webhooks. Read-only. Fields: none. Example: GET /v1/webhooks Success: HTTP 200. Returns: {webhooks: [{id, product, event, url, is_active, created_at, last_triggered_at}]}. ### DELETE /v1/webhooks/{id} Delete a single-event webhook. Changes data (needs a read-write key). Fields: - id (path; required; string): Single-event webhook id, e.g. whk_…. Example: DELETE /v1/webhooks/whk_… Success: HTTP 200. Returns: {deleted: true, id}. ### GET /v1/webhooks/{id}/deliveries Recent deliveries of a single-event webhook. Read-only. Fields: - id (path; required; string): Single-event webhook id, e.g. whk_…. Example: GET /v1/webhooks/whk_…/deliveries Success: HTTP 200. Returns: {deliveries: [...]}: the latest deliveries (up to 50) with event, status code, attempt and time. ### POST /v1/webhooks/{id}/test Send a signed test event to a single-event webhook. Changes data (needs a read-write key). Fields: - id (path; required; string): Single-event webhook id, e.g. whk_…. Example: POST /v1/webhooks/whk_…/test Success: HTTP 200. Returns: {sent, delivered}: whether the signed webhook.test event was sent and accepted (2xx) by your URL. ## Usage ### GET /v1/usage This month's usage against your plan. Read-only. Fields: none. Example: GET /v1/usage Success: HTTP 200. Returns: {plan, limit, current_month {total_calls, …}, executions {used, limit}, webhook_executions {used, limit}}. --- # Part 7: Plans and limits - Essentials (free): 30 API requests/minute, 20,000 API requests/month, 10,000 job executions/month, 1,000 webhook deliveries/month, 40 scheduled jobs, 20 business-hours schedules, retry.attempts up to 1, run history kept 7 days. - Standard: 120 API requests/minute, 200,000 API requests/month, 100,000 job executions/month, 10,000 webhook deliveries/month, 200 scheduled jobs, 100 business-hours schedules, retry.attempts up to 3, run history kept 30 days. - Pro: 300 API requests/minute, 1,500,000 API requests/month, 750,000 job executions/month, 75,000 webhook deliveries/month, 1,000 scheduled jobs, 500 business-hours schedules, retry.attempts up to 5, run history kept 60 days. - Max: 600 API requests/minute, 4,000,000 API requests/month, 2,000,000 job executions/month, 200,000 webhook deliveries/month, 5,000 scheduled jobs, 2,500 business-hours schedules, retry.attempts up to 10, run history kept 90 days. Exact current numbers for this key: GET /v1/usage. Some features need a plan: more retry attempts and exponential backoff, holidays for more countries, regional (state) holidays, more schedules. A 403 reply names the plan needed. --- # Part 8: SDKs Plain REST works with any HTTP client. Official SDKs: `npm install netsware-sdk` (JavaScript/TypeScript: new Netsware(key), then .hours, .jobs, .groups, .variables, .runs, .metrics, .webhooks, .usage) and `pip install netsware-sdk` (Python: Netsware(api_key=...)). Install steps and tested examples for both: https://netsware.com/sdk