Skip to content
AI Inbx
Esc
↑↓navigate↵open⌘Jpreview

Create a pacing rule

Creates a pacing rule. An hours rule holds mail outside the weekly windows you declare, evaluated in the rule’s own timezone. A limit rule caps sends per rolling window against a scope — the rule as a whole, or per sender address, sending domain, recipient, or recipient domain. An empty match array applies the rule to every send. space_id makes the rule read one space’s mail alone; workspace rules apply to every space and stack on top. An enabled rule counts against the plan’s active custom pacing rules: with none left the request fails with 402 allowance_reached, and a workspace with no plan with 402 plan_required. A rule created with enabled false takes nothing until it is switched on.

POST/pacing-rules
Authorization
AuthorizationBearer token (API key) · headerrequired

Pass an AI Inbx API key as a Bearer token.

Header parameters
AIInbx-Workspacestring

Workspace id from GET /workspaces, for an OAuth token that reaches several.

min length 1
Request body
requiredapplication/json
One of:
object
namestringrequired

The rule's name.

min length 1 · max length 120
space_idstring

Which space a created resource goes in. Omitted, the workspace itself.

matches ^[a-z]+_[0-9a-f]{32}$
enabledboolean

Whether the rule applies. A disabled one holds nothing and takes no plan allowance.

matchobject[]required

Which sends the rule reads, such as [{"field":"to","pattern":"..."}]. [] is every send.

max items 50
Show properties
Array of object
fieldstringrequired
Allowed:fromtoeither
patternstringrequired
min length 1 · max length 320
kindstringrequired

hours holds mail outside weekly windows.

scheduleobjectrequired

An hours rule's weekly windows, such as {"timezone":"Europe/Berlin","windows":[{"days":[1,2,3,4,5],"start_minute":540,"end_minute":1020}]}.

Show properties
timezonestringrequired
min length 1
windowsobject[]required
Show properties
Array of object
daysinteger[]required
min items 1
start_minuteintegerrequired
min 0 · max 1440
end_minuteintegerrequired
min 0 · max 1440
jitterobject
Show properties
open_early_minutesintegerrequired
min 0 · max 60
open_late_minutesintegerrequired
min 0 · max 60
close_early_minutesintegerrequired
min 0 · max 60
close_late_minutesintegerrequired
min 0 · max 60
object
namestringrequired

The rule's name.

min length 1 · max length 120
space_idstring

Which space a created resource goes in. Omitted, the workspace itself.

matches ^[a-z]+_[0-9a-f]{32}$
enabledboolean

Whether the rule applies. A disabled one holds nothing and takes no plan allowance.

matchobject[]required

Which sends the rule reads, such as [{"field":"to","pattern":"..."}]. [] is every send.

max items 50
Show properties
Array of object
fieldstringrequired
Allowed:fromtoeither
patternstringrequired
min length 1 · max length 320
kindstringrequired

limit caps sends per rolling window.

limitobjectrequired

A limit rule's cap, such as {"scope":"to_domain","amount":100,"per_seconds":3600}.

Show properties
scopestringrequired
Allowed:rulefrom_addressfrom_domainto_addressto_domain
amountintegerrequired
min 1 · max 1000000
per_secondsintegerrequired
min 1 · max 2678400
Responses
201

The pacing rule was created.

One of:
object
idstringrequired
matches ^[a-z]+_[0-9a-f]{32}$
namestringrequired
space_idstring | nullrequired

Which space a resource is in. Null is the workspace itself — what every resource of a workspace that has no spaces says.

Show properties
Any of:
string
string
null
null
enabledbooleanrequired
builtinbooleanrequired
matchobject[]required
Show properties
Array of object
fieldstringrequired
Allowed:fromtoeither
patternstringrequired
min length 1 · max length 320
created_atstring<date-time>required
matches ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
kindstringrequired
scheduleobjectrequired
Show properties
timezonestringrequired
min length 1
windowsobject[]required
Show properties
Array of object
daysinteger[]required
min items 1
start_minuteintegerrequired
min 0 · max 1440
end_minuteintegerrequired
min 0 · max 1440
jitterobjectrequired
Show properties
open_early_minutesintegerrequired
min 0 · max 60
open_late_minutesintegerrequired
min 0 · max 60
close_early_minutesintegerrequired
min 0 · max 60
close_late_minutesintegerrequired
min 0 · max 60
object
idstringrequired
matches ^[a-z]+_[0-9a-f]{32}$
namestringrequired
space_idstring | nullrequired

Which space a resource is in. Null is the workspace itself — what every resource of a workspace that has no spaces says.

Show properties
Any of:
string
string
null
null
enabledbooleanrequired
builtinbooleanrequired
matchobject[]required
Show properties
Array of object
fieldstringrequired
Allowed:fromtoeither
patternstringrequired
min length 1 · max length 320
created_atstring<date-time>required
matches ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
kindstringrequired

limit caps sends per rolling window.

limitobjectrequired

A limit rule's cap, such as {"scope":"to_domain","amount":100,"per_seconds":3600}.

Show properties
scopestringrequired
Allowed:rulefrom_addressfrom_domainto_addressto_domain
amountintegerrequired
min 1 · max 1000000
per_secondsintegerrequired
min 1 · max 2678400
400

The request is invalid.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
401

The API key is missing or invalid.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
402

The workspace has no plan (plan_required), or its plan's allowance is used up (allowance_reached).

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
403

The API key or token does not have the required scope, or the token is connected as an inbox and the operation is not one an inbox may use.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
404

The requested resource does not exist.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
409

The request conflicts with the resource's current state.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
413

The request body or attachments are too large.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
415

The request body is not JSON.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
422

The request body failed validation.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
429

The organisation's request budget is spent (too_many_requests), or an upstream mail provider is throttling (rate_limited).

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
500

An internal error occurred.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
502

An upstream mail provider failed.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
503

The service is temporarily unavailable.

typestringrequired
titlestringrequired
statusintegerrequired
min -9007199254740991 · max 9007199254740991
detailstringrequired
codestringrequired
request_idstringrequired
issuesobject[]
Show properties
Array of object
pathstringrequired
messagestringrequired
Request
import AIInbx from "aiinbx"

const aiinbx = new AIInbx()

const response = await aiinbx.pacingRules.create({
  name: "Business hours",
  kind: "hours",
  match: [{ field: "from", pattern: "*@mail.example.com" }],
  schedule: {
    timezone: "Europe/Berlin",
    windows: [{ days: [1, 2, 3, 4, 5], start_minute: 540, end_minute: 1020 }],
  },
})
Response
{
  "id": "string",
  "name": "string",
  "space_id": "string",
  "enabled": true,
  "builtin": true,
  "match": [
    {
      "field": "from",
      "pattern": "string"
    }
  ],
  "created_at": "2019-08-24T14:15:22Z",
  "kind": "hours",
  "schedule": {
    "timezone": "string",
    "windows": [
      {
        "days": [
          0
        ],
        "start_minute": 0,
        "end_minute": 0
      }
    ],
    "jitter": {
      "open_early_minutes": 0,
      "open_late_minutes": 0,
      "close_early_minutes": 0,
      "close_late_minutes": 0
    }
  }
}