Skip to content
NewNexus 2.0 is here, and it’s open source. Read the launch post

API reference

Routines

Routines: work your agent does for you without being asked, such as a morning brief. A routine has an owner, a trigger, an action, proactivity and caps. It runs as its owner only, reads and notifies only, and owns one Runtime schedule whose slots each start one job. It is its owner's, and its organization's owners' and admins' to read, pause and delete; to anyone else it does not exist.

View as Markdown

List routines

get/v1/routines

Your routines, newest first, at most 200. With all=true, the organization's: its owners and admins only. Each carries its schedule's next run.

routines.useEvery memberTry it in the API Explorer

Parameters

  • allquery · "true" | "false"

    true: every member's routines (owners and admins)

Responses

200OKapplication/json

  • routinesarray of Routinerequired
    • idstringrequired

      rtn_ and 32 hex characters

    • titlestringrequired
    • ownerIdstringrequired

      The person it runs as.

    • teamIdstring

      The team its model calls go to; absent when its owner is in none.

    • executor"gateway"required

      gateway: each slot is a Runtime job. Desktop routines come with W4 step 2.

    • triggerRoutineTriggerrequired
      • kind"schedule" | "watch"required

        schedule runs on a time; watch checks watch every everySeconds. event, webhook and manual come later.

      • everySecondsinteger

        Every N seconds from the routine's creation. Not with at. A watch needs it: it checks at most every 10 minutes.

        min 600 · max 604800

      • watchRoutineWatch

        What a watch trigger checks. The agent reads it as you, and tells you once it is met.

        • source"github_pull" | "github_issue" | "spend_today"required

          github_pull: the pull request target is merged or closed. github_issue: the issue target changes state. spend_today: your own AI spend today passes overUsd. Today is the UTC day, whatever the routine's timezone.

        • targetstring

          A repository and a number, owner/repo#N. With github_pull and github_issue only.

          pattern ^[A-Za-z0-9_.-]{1,100}/[A-Za-z0-9_.-]{1,100}#[1-9][0-9]{0,9}$

        • overUsdstring

          An amount above zero in US dollars, as a decimal string with at most six decimals (root rule 9). With spend_today only.

      • atstring

        A local time, HH:MM, 24-hour. Not with everySeconds.

        pattern ^([01][0-9]|2[0-3]):[0-5][0-9]$

      • daysarray of "mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun"

        The days at runs on, in week order; every day when absent.

      • timezonestring

        An IANA name; UTC when absent.

      • catchUp"latest" | "none"

        After downtime: latest runs the newest missed slot (the default), none runs none.

    • actionRoutineActionrequired
      • kind"brief" | "notify"required

        brief: what changed in your open pull requests, your assigned issues and the channels you follow, read through your own connectors. notify, a watch's action: you are told its condition is met. Both read only.

    • proactivityRoutineProactivityrequired
      • notify"always" | "on_change" | "digest"

        When a run speaks up; always by default.

      • writes"never"

        A routine reads and notifies only. ask_first waits for Policy PO1.

    • capsRoutineCapsrequired
      • maxRunsPerDayinteger

        Runs a day, counted in the trigger's time zone. A slot past it is skipped.

        min 1 · max 144

    • reportTo"slack"required
    • state"active" | "paused"required
    • pausedReason"owner" | "admin"
    • scheduleIdstring

      Its Runtime schedule (sch_…).

    • nextRunAtstring (date-time)

      Its schedule's next slot; absent while paused.

    • lastRunAtstring (date-time)

      Its schedule's last slot.

    • deliveryRoutineDeliveryrequired
      • availablebooleanrequired

        Whether this Gateway can deliver the routine's action now.

      • codestring

        Why not: routine_brief_unavailable or routine_watch_unavailable.

      • reasonstring
    • createdVia"api" | "cli" | "ui" | "slack" | "desktop" | "agent"required
    • versionintegerrequired
    • createdAtstring (date-time)required
    • updatedAtstring (date-time)required

400`all` is not `true` or `false`.application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

401No credential (`missing_credential`), or a credential Gateway does not accept (`invalid_credential`).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

403The key does not hold `products.use` (`role_required`), it is not a person's (`routine_agent_refused`), or a member who is not an owner or admin asked for `all`.application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

503Routines are off on this Gateway (`routines_disabled`): they need `NEXUS_ROUTINES` and `NEXUS_SCHEDULER`. The route still mounts.application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

Errors

StatusCodeWhen
400invalid_request_errorA field is missing or not valid; the message names it
400`all` is not `true` or `false`.
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).
429rate_limit_errorToo many requests from this key in a minute
503Routines are off on this Gateway (`routines_disabled`): they need `NEXUS_ROUTINES` and `NEXUS_SCHEDULER`. The route still mounts.

Example

curl
curl "$NEXUS_URL/v1/routines" \
  -H "Authorization: Bearer $NEXUS_API_KEY"

Create routine

post/v1/routines

Create a routine for yourself: a schedule trigger and the brief action. It runs as you and no one else, reads and notifies only (writes: never), and reports to your Slack direct messages. Gateway records it and its Runtime schedule (source: routine:<id>), whose slots each start one job. The brief is not available yet: delivery.available is false with routine_brief_unavailable, and each slot's job ends without reading or sending anything. A person owns at most 50 routines in an organization. team (or x-nexus-team) names the team its model calls go to.

routines.useEvery memberTry it in the API Explorer

Parameters

  • Idempotency-Keyheader · string

    Send the same key again to retry safely: the request runs once. See Idempotency keys.

Request body · application/json

  • titlestring

    Morning brief when absent; Watch for a watch.

    min length 1 · max length 200

  • triggerRoutineTriggerrequired
    • kind"schedule" | "watch"required

      schedule runs on a time; watch checks watch every everySeconds. event, webhook and manual come later.

    • everySecondsinteger

      Every N seconds from the routine's creation. Not with at. A watch needs it: it checks at most every 10 minutes.

      min 600 · max 604800

    • watchRoutineWatch

      What a watch trigger checks. The agent reads it as you, and tells you once it is met.

      • source"github_pull" | "github_issue" | "spend_today"required

        github_pull: the pull request target is merged or closed. github_issue: the issue target changes state. spend_today: your own AI spend today passes overUsd. Today is the UTC day, whatever the routine's timezone.

      • targetstring

        A repository and a number, owner/repo#N. With github_pull and github_issue only.

        pattern ^[A-Za-z0-9_.-]{1,100}/[A-Za-z0-9_.-]{1,100}#[1-9][0-9]{0,9}$

      • overUsdstring

        An amount above zero in US dollars, as a decimal string with at most six decimals (root rule 9). With spend_today only.

    • atstring

      A local time, HH:MM, 24-hour. Not with everySeconds.

      pattern ^([01][0-9]|2[0-3]):[0-5][0-9]$

    • daysarray of "mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun"

      The days at runs on, in week order; every day when absent.

    • timezonestring

      An IANA name; UTC when absent.

    • catchUp"latest" | "none"

      After downtime: latest runs the newest missed slot (the default), none runs none.

  • actionRoutineActionrequired
    • kind"brief" | "notify"required

      brief: what changed in your open pull requests, your assigned issues and the channels you follow, read through your own connectors. notify, a watch's action: you are told its condition is met. Both read only.

  • proactivityRoutineProactivity
    • notify"always" | "on_change" | "digest"

      When a run speaks up; always by default.

    • writes"never"

      A routine reads and notifies only. ask_first waits for Policy PO1.

  • capsRoutineCaps
    • maxRunsPerDayinteger

      Runs a day, counted in the trigger's time zone. A slot past it is skipped.

      min 1 · max 144

  • reportTo"slack"

    Your Slack direct messages; the default.

  • teamstring

    The team its model calls go to, by slug or id; your default team when absent.

Responses

201Created: the routine and its scheduleapplication/json

  • idstringrequired

    rtn_ and 32 hex characters

  • titlestringrequired
  • ownerIdstringrequired

    The person it runs as.

  • teamIdstring

    The team its model calls go to; absent when its owner is in none.

  • executor"gateway"required

    gateway: each slot is a Runtime job. Desktop routines come with W4 step 2.

  • triggerRoutineTriggerrequired
    • kind"schedule" | "watch"required

      schedule runs on a time; watch checks watch every everySeconds. event, webhook and manual come later.

    • everySecondsinteger

      Every N seconds from the routine's creation. Not with at. A watch needs it: it checks at most every 10 minutes.

      min 600 · max 604800

    • watchRoutineWatch

      What a watch trigger checks. The agent reads it as you, and tells you once it is met.

      • source"github_pull" | "github_issue" | "spend_today"required

        github_pull: the pull request target is merged or closed. github_issue: the issue target changes state. spend_today: your own AI spend today passes overUsd. Today is the UTC day, whatever the routine's timezone.

      • targetstring

        A repository and a number, owner/repo#N. With github_pull and github_issue only.

        pattern ^[A-Za-z0-9_.-]{1,100}/[A-Za-z0-9_.-]{1,100}#[1-9][0-9]{0,9}$

      • overUsdstring

        An amount above zero in US dollars, as a decimal string with at most six decimals (root rule 9). With spend_today only.

    • atstring

      A local time, HH:MM, 24-hour. Not with everySeconds.

      pattern ^([01][0-9]|2[0-3]):[0-5][0-9]$

    • daysarray of "mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun"

      The days at runs on, in week order; every day when absent.

    • timezonestring

      An IANA name; UTC when absent.

    • catchUp"latest" | "none"

      After downtime: latest runs the newest missed slot (the default), none runs none.

  • actionRoutineActionrequired
    • kind"brief" | "notify"required

      brief: what changed in your open pull requests, your assigned issues and the channels you follow, read through your own connectors. notify, a watch's action: you are told its condition is met. Both read only.

  • proactivityRoutineProactivityrequired
    • notify"always" | "on_change" | "digest"

      When a run speaks up; always by default.

    • writes"never"

      A routine reads and notifies only. ask_first waits for Policy PO1.

  • capsRoutineCapsrequired
    • maxRunsPerDayinteger

      Runs a day, counted in the trigger's time zone. A slot past it is skipped.

      min 1 · max 144

  • reportTo"slack"required
  • state"active" | "paused"required
  • pausedReason"owner" | "admin"
  • scheduleIdstring

    Its Runtime schedule (sch_…).

  • nextRunAtstring (date-time)

    Its schedule's next slot; absent while paused.

  • lastRunAtstring (date-time)

    Its schedule's last slot.

  • deliveryRoutineDeliveryrequired
    • availablebooleanrequired

      Whether this Gateway can deliver the routine's action now.

    • codestring

      Why not: routine_brief_unavailable or routine_watch_unavailable.

    • reasonstring
  • createdVia"api" | "cli" | "ui" | "slack" | "desktop" | "agent"required
  • versionintegerrequired
  • createdAtstring (date-time)required
  • updatedAtstring (date-time)required

400A body that is not a routine, or a malformed `Idempotency-Key`.application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

401No credential (`missing_credential`), or a credential Gateway does not accept (`invalid_credential`).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

403The key does not hold `routines.use` (`role_required`), or it is not a person's own key, Nexus UI or an agent link its person granted `routines.use` (`routine_agent_refused`). A module's scoped key, a service account and a sandbox are refused the same way. An agent link's routine writes nothing: any `proactivity.writes` but `never` is `routine_agent_writes_refused`.application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

409You own 50 routines in this organization (`routine_limit`), or the `Idempotency-Key`'s first request still runs.application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

422A routine Gateway does not build yet or cannot run (`invalid_routine`): a trigger other than `schedule`, both or neither of `everySeconds` and `at`, an interval under 600 s, an unknown time zone or day, an action other than `brief`, a `reportTo` other than `slack`. `writes: ask_first` is `routine_writes_unavailable`: it waits for Policy's approval records (PO1).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

503Routines are off on this Gateway (`routines_disabled`): they need `NEXUS_ROUTINES` and `NEXUS_SCHEDULER`. The route still mounts.application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

Errors

StatusCodeWhen
400invalid_request_errorA field is missing or not valid; the message names it
400A body that is not a routine, or a malformed `Idempotency-Key`.
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
409You own 50 routines in this organization (`routine_limit`), or the `Idempotency-Key`'s first request still runs.
409idempotency_in_progressA request with the same Idempotency-Key is still running
409idempotency_interruptedThe first request with this Idempotency-Key was cut off and may have run in part
422A routine Gateway does not build yet or cannot run (`invalid_routine`): a trigger other than `schedule`, both or neither of `everySeconds` and `at`, an interval under 600 s, an unknown time zone or day, an action other than `brief`, a `reportTo` other than `slack`. `writes: ask_first` is `routine_writes_unavailable`: it waits for Policy's approval records (PO1).
422idempotency_key_reusedThe Idempotency-Key was used with a different request
429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).
429rate_limit_errorToo many requests from this key in a minute
503Routines are off on this Gateway (`routines_disabled`): they need `NEXUS_ROUTINES` and `NEXUS_SCHEDULER`. The route still mounts.

Example

curl
curl -X POST "$NEXUS_URL/v1/routines" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "trigger": {
      "kind": "schedule"
    },
    "action": {
      "kind": "brief"
    }
  }'

Get routine

get/v1/routines/{id}

A routine, with its schedule's next run and its last slot.

routines.useEvery memberTry it in the API Explorer

Parameters

  • idpath · stringrequired

    The routine's id (rtn_…), as POST /v1/routines answered it

Responses

200OKapplication/json

  • idstringrequired

    rtn_ and 32 hex characters

  • titlestringrequired
  • ownerIdstringrequired

    The person it runs as.

  • teamIdstring

    The team its model calls go to; absent when its owner is in none.

  • executor"gateway"required

    gateway: each slot is a Runtime job. Desktop routines come with W4 step 2.

  • triggerRoutineTriggerrequired
    • kind"schedule" | "watch"required

      schedule runs on a time; watch checks watch every everySeconds. event, webhook and manual come later.

    • everySecondsinteger

      Every N seconds from the routine's creation. Not with at. A watch needs it: it checks at most every 10 minutes.

      min 600 · max 604800

    • watchRoutineWatch

      What a watch trigger checks. The agent reads it as you, and tells you once it is met.

      • source"github_pull" | "github_issue" | "spend_today"required

        github_pull: the pull request target is merged or closed. github_issue: the issue target changes state. spend_today: your own AI spend today passes overUsd. Today is the UTC day, whatever the routine's timezone.

      • targetstring

        A repository and a number, owner/repo#N. With github_pull and github_issue only.

        pattern ^[A-Za-z0-9_.-]{1,100}/[A-Za-z0-9_.-]{1,100}#[1-9][0-9]{0,9}$

      • overUsdstring

        An amount above zero in US dollars, as a decimal string with at most six decimals (root rule 9). With spend_today only.

    • atstring

      A local time, HH:MM, 24-hour. Not with everySeconds.

      pattern ^([01][0-9]|2[0-3]):[0-5][0-9]$

    • daysarray of "mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun"

      The days at runs on, in week order; every day when absent.

    • timezonestring

      An IANA name; UTC when absent.

    • catchUp"latest" | "none"

      After downtime: latest runs the newest missed slot (the default), none runs none.

  • actionRoutineActionrequired
    • kind"brief" | "notify"required

      brief: what changed in your open pull requests, your assigned issues and the channels you follow, read through your own connectors. notify, a watch's action: you are told its condition is met. Both read only.

  • proactivityRoutineProactivityrequired
    • notify"always" | "on_change" | "digest"

      When a run speaks up; always by default.

    • writes"never"

      A routine reads and notifies only. ask_first waits for Policy PO1.

  • capsRoutineCapsrequired
    • maxRunsPerDayinteger

      Runs a day, counted in the trigger's time zone. A slot past it is skipped.

      min 1 · max 144

  • reportTo"slack"required
  • state"active" | "paused"required
  • pausedReason"owner" | "admin"
  • scheduleIdstring

    Its Runtime schedule (sch_…).

  • nextRunAtstring (date-time)

    Its schedule's next slot; absent while paused.

  • lastRunAtstring (date-time)

    Its schedule's last slot.

  • deliveryRoutineDeliveryrequired
    • availablebooleanrequired

      Whether this Gateway can deliver the routine's action now.

    • codestring

      Why not: routine_brief_unavailable or routine_watch_unavailable.

    • reasonstring
  • createdVia"api" | "cli" | "ui" | "slack" | "desktop" | "agent"required
  • versionintegerrequired
  • createdAtstring (date-time)required
  • updatedAtstring (date-time)required

401No credential (`missing_credential`), or a credential Gateway does not accept (`invalid_credential`).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

403The key does not hold `products.use` (`role_required`), or it is not a person's own key or Nexus UI (`routine_agent_refused`): an agent link creates a routine only after the person's confirm card, which is not built yet. A module's scoped key, a service account and a sandbox are refused the same way.application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

404No such routine you may see (`not_found`). A routine is its owner's, and its organization's owners' and admins' to read, pause and delete. Another member's routine, and another organization's, is as absent as a missing one.application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

503Routines are off on this Gateway (`routines_disabled`): they need `NEXUS_ROUTINES` and `NEXUS_SCHEDULER`. The route still mounts.application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

Errors

StatusCodeWhen
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
404not_foundNothing matches the path in your organization
404No such routine you may see (`not_found`). A routine is its owner's, and its organization's owners' and admins' to read, pause and delete. Another member's routine, and another organization's, is as absent as a missing one.
429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).
429rate_limit_errorToo many requests from this key in a minute
503Routines are off on this Gateway (`routines_disabled`): they need `NEXUS_ROUTINES` and `NEXUS_SCHEDULER`. The route still mounts.

Example

curl
curl "$NEXUS_URL/v1/routines/<id>" \
  -H "Authorization: Bearer $NEXUS_API_KEY"

Update routine

patch/v1/routines/{id}

Pause (state: paused) or resume (state: active) a routine. A pause stops its schedule first, so no slot after it starts a job. A resume runs from the next slot after now and replays nothing. The owner does both. An owner or admin of the organization may pause someone else's routine, and may not resume it. Pausing twice is the same as once.

routines.useEvery memberTry it in the API Explorer

Parameters

  • idpath · stringrequired

    The routine's id (rtn_…), as POST /v1/routines answered it

  • Idempotency-Keyheader · string

    Send the same key again to retry safely: the request runs once. See Idempotency keys.

Request body · application/json

  • state"paused" | "active"required

Responses

200OKapplication/json

  • idstringrequired

    rtn_ and 32 hex characters

  • titlestringrequired
  • ownerIdstringrequired

    The person it runs as.

  • teamIdstring

    The team its model calls go to; absent when its owner is in none.

  • executor"gateway"required

    gateway: each slot is a Runtime job. Desktop routines come with W4 step 2.

  • triggerRoutineTriggerrequired
    • kind"schedule" | "watch"required

      schedule runs on a time; watch checks watch every everySeconds. event, webhook and manual come later.

    • everySecondsinteger

      Every N seconds from the routine's creation. Not with at. A watch needs it: it checks at most every 10 minutes.

      min 600 · max 604800

    • watchRoutineWatch

      What a watch trigger checks. The agent reads it as you, and tells you once it is met.

      • source"github_pull" | "github_issue" | "spend_today"required

        github_pull: the pull request target is merged or closed. github_issue: the issue target changes state. spend_today: your own AI spend today passes overUsd. Today is the UTC day, whatever the routine's timezone.

      • targetstring

        A repository and a number, owner/repo#N. With github_pull and github_issue only.

        pattern ^[A-Za-z0-9_.-]{1,100}/[A-Za-z0-9_.-]{1,100}#[1-9][0-9]{0,9}$

      • overUsdstring

        An amount above zero in US dollars, as a decimal string with at most six decimals (root rule 9). With spend_today only.

    • atstring

      A local time, HH:MM, 24-hour. Not with everySeconds.

      pattern ^([01][0-9]|2[0-3]):[0-5][0-9]$

    • daysarray of "mon" | "tue" | "wed" | "thu" | "fri" | "sat" | "sun"

      The days at runs on, in week order; every day when absent.

    • timezonestring

      An IANA name; UTC when absent.

    • catchUp"latest" | "none"

      After downtime: latest runs the newest missed slot (the default), none runs none.

  • actionRoutineActionrequired
    • kind"brief" | "notify"required

      brief: what changed in your open pull requests, your assigned issues and the channels you follow, read through your own connectors. notify, a watch's action: you are told its condition is met. Both read only.

  • proactivityRoutineProactivityrequired
    • notify"always" | "on_change" | "digest"

      When a run speaks up; always by default.

    • writes"never"

      A routine reads and notifies only. ask_first waits for Policy PO1.

  • capsRoutineCapsrequired
    • maxRunsPerDayinteger

      Runs a day, counted in the trigger's time zone. A slot past it is skipped.

      min 1 · max 144

  • reportTo"slack"required
  • state"active" | "paused"required
  • pausedReason"owner" | "admin"
  • scheduleIdstring

    Its Runtime schedule (sch_…).

  • nextRunAtstring (date-time)

    Its schedule's next slot; absent while paused.

  • lastRunAtstring (date-time)

    Its schedule's last slot.

  • deliveryRoutineDeliveryrequired
    • availablebooleanrequired

      Whether this Gateway can deliver the routine's action now.

    • codestring

      Why not: routine_brief_unavailable or routine_watch_unavailable.

    • reasonstring
  • createdVia"api" | "cli" | "ui" | "slack" | "desktop" | "agent"required
  • versionintegerrequired
  • createdAtstring (date-time)required
  • updatedAtstring (date-time)required

400`state` is not `paused` or `active`.application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

401No credential (`missing_credential`), or a credential Gateway does not accept (`invalid_credential`).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

403Not a person's key (`routine_agent_refused`), or an admin resuming someone else's routine (`routine_resume_refused`).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

404No such routine you may see (`not_found`). A routine is its owner's, and its organization's owners' and admins' to read, pause and delete. Another member's routine, and another organization's, is as absent as a missing one.application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

503Routines are off on this Gateway (`routines_disabled`): they need `NEXUS_ROUTINES` and `NEXUS_SCHEDULER`. The route still mounts.application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

Errors

StatusCodeWhen
400invalid_request_errorA field is missing or not valid; the message names it
400`state` is not `paused` or `active`.
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
404not_foundNothing matches the path in your organization
404No such routine you may see (`not_found`). A routine is its owner's, and its organization's owners' and admins' to read, pause and delete. Another member's routine, and another organization's, is as absent as a missing one.
409idempotency_in_progressA request with the same Idempotency-Key is still running
409idempotency_interruptedThe first request with this Idempotency-Key was cut off and may have run in part
422idempotency_key_reusedThe Idempotency-Key was used with a different request
429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).
429rate_limit_errorToo many requests from this key in a minute
503Routines are off on this Gateway (`routines_disabled`): they need `NEXUS_ROUTINES` and `NEXUS_SCHEDULER`. The route still mounts.

Example

curl
curl -X PATCH "$NEXUS_URL/v1/routines/<id>" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "state": "paused"
  }'

Delete routine

DEL/v1/routines/{id}

Delete a routine and its schedule: its owner, or an owner or admin of the organization. The schedule goes first, so no slot after it starts a job. A job already started runs to its end.

routines.useEvery memberTry it in the API Explorer

Parameters

  • idpath · stringrequired

    The routine's id (rtn_…), as POST /v1/routines answered it

  • Idempotency-Keyheader · string

    Send the same key again to retry safely: the request runs once. See Idempotency keys.

Responses

200OKapplication/json

  • idstringrequired
  • deletedbooleanrequired

401No credential (`missing_credential`), or a credential Gateway does not accept (`invalid_credential`).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

403The key does not hold `products.use` (`role_required`), or it is not a person's own key or Nexus UI (`routine_agent_refused`): an agent link creates a routine only after the person's confirm card, which is not built yet. A module's scoped key, a service account and a sandbox are refused the same way.application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

404No such routine you may see (`not_found`). A routine is its owner's, and its organization's owners' and admins' to read, pause and delete. Another member's routine, and another organization's, is as absent as a missing one.application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

503Routines are off on this Gateway (`routines_disabled`): they need `NEXUS_ROUTINES` and `NEXUS_SCHEDULER`. The route still mounts.application/json

  • errorobject
    • messagestringrequired
    • typestringrequired

      The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.

    • codestring

      Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.

    • paramstring

      model when the error is a model refusal (a code starting with model_); absent otherwise.

    • nexusobject

      Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.

    • minimumstring

      On a 426 cli_too_old only: the oldest nexus CLI version Gateway supports.

Errors

StatusCodeWhen
401authentication_errorNo key, or a key Gateway does not accept
403role_requiredYour role does not have this permission
404not_foundNothing matches the path in your organization
404No such routine you may see (`not_found`). A routine is its owner's, and its organization's owners' and admins' to read, pause and delete. Another member's routine, and another organization's, is as absent as a missing one.
409idempotency_in_progressA request with the same Idempotency-Key is still running
409idempotency_interruptedThe first request with this Idempotency-Key was cut off and may have run in part
422idempotency_key_reusedThe Idempotency-Key was used with a different request
429Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap).
429rate_limit_errorToo many requests from this key in a minute
503Routines are off on this Gateway (`routines_disabled`): they need `NEXUS_ROUTINES` and `NEXUS_SCHEDULER`. The route still mounts.

Example

curl
curl -X DELETE "$NEXUS_URL/v1/routines/<id>" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"