Skip to content

Add a budget alert

POST
/org/budget-alerts
curl --request POST \
--url https://api.asklucy.eu/v1/org/budget-alerts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "scope": { "type": "organization", "group_id": "example" }, "window": "week", "threshold": { "percent": 1, "amount": { "amount": "50.00", "currency": "EUR" } }, "enabled": true, "extra_recipients": [ "hello@example.com" ] }'

Emails the organization’s admins (and any extra recipients) when spending crosses a threshold. Each alert fires at most once per window.

Idempotency-Key
string
<= 255 characters

Any unique string (a UUID works). Retries with the same key return the first result.

Media typeapplication/json
object
scope
required

Whose spending is watched.

object
type
required
string
Allowed values: organization group
group_id

For group.

string | null
window
required
string
Allowed values: week month
threshold
required

Exactly one of percent (of the organization’s monthly budget; only for scope organization with window: month) or amount.

object
percent
integer | null
>= 1 <= 200
amount
One of:
object
amount
required

Decimal amount, e.g. “12.50” (up to 6 decimals for small usage).

string
/^-?[0-9]+(\.[0-9]{1,6})?$/
currency
required
string
Allowed values: EUR
enabled
boolean
default: true
extra_recipients
Array<string>
<= 20 items

Created

Media typeapplication/json
object
id
required
string
scope
required

Whose spending is watched.

object
type
required
string
Allowed values: organization group
group_id

For group.

string | null
window
required
string
Allowed values: week month
threshold
required

Exactly one of percent (of the organization’s monthly budget; only for scope organization with window: month) or amount.

object
percent
integer | null
>= 1 <= 200
amount
One of:
object
amount
required

Decimal amount, e.g. “12.50” (up to 6 decimals for small usage).

string
/^-?[0-9]+(\.[0-9]{1,6})?$/
currency
required
string
Allowed values: EUR
enabled
required
boolean
extra_recipients
required

Emails notified besides the organization’s admins (e.g. finance).

Array<string>
last_triggered_at
string | null format: date-time
created_at
required
string format: date-time

Example

{
"id": "alr_3Mx8Wd",
"scope": {
"type": "organization"
},
"window": "week",
"threshold": {
"amount": {
"amount": "50.00",
"currency": "EUR"
}
}
}

The request is invalid; errors lists what’s wrong.

Media typeapplication/problem+json

RFC 9457 problem details.

object
type
required
string format: uri-reference
title
required
string
status
required
integer
detail
string
instance
string
request_id
string
quota

For quota-exceeded, the window that is used up.

object
window
required
string
Allowed values: five_hours week month
percent_used
required
number
<= 100
resets_at
required

Null for a rolling window that hasn’t started.

string | null format: date-time
limited_by
required

organization when the organization’s budget is closer to running out than the member’s own limit.

string
Allowed values: personal organization
request
One of:

A request as its member sees it, where they asked.

object
id
required
string
status
required
string
Allowed values: pending approved declined withdrawn
created_at
required
string format: date-time
decided_at
required
string | null format: date-time
note
required

What the admin who decided wrote back.

string | null
errors

Field-level problems (400 only).

Array<object>
object
field
required

JSON pointer into the request body.

string
message
required
string

Example

{
"type": "https://docs.asklucy.eu/errors/answer-in-progress",
"quota": {
"window": "five_hours",
"limited_by": "personal",
"request": {
"status": "pending"
}
}
}
X-Request-Id
string

Unique per request; quote it to support.

Missing, expired or invalid token.

Media typeapplication/problem+json

RFC 9457 problem details.

object
type
required
string format: uri-reference
title
required
string
status
required
integer
detail
string
instance
string
request_id
string
quota

For quota-exceeded, the window that is used up.

object
window
required
string
Allowed values: five_hours week month
percent_used
required
number
<= 100
resets_at
required

Null for a rolling window that hasn’t started.

string | null format: date-time
limited_by
required

organization when the organization’s budget is closer to running out than the member’s own limit.

string
Allowed values: personal organization
request
One of:

A request as its member sees it, where they asked.

object
id
required
string
status
required
string
Allowed values: pending approved declined withdrawn
created_at
required
string format: date-time
decided_at
required
string | null format: date-time
note
required

What the admin who decided wrote back.

string | null
errors

Field-level problems (400 only).

Array<object>
object
field
required

JSON pointer into the request body.

string
message
required
string

Example

{
"type": "https://docs.asklucy.eu/errors/answer-in-progress",
"quota": {
"window": "five_hours",
"limited_by": "personal",
"request": {
"status": "pending"
}
}
}
X-Request-Id
string

Unique per request; quote it to support.

The token is valid but lacks the role this needs.

Media typeapplication/problem+json

RFC 9457 problem details.

object
type
required
string format: uri-reference
title
required
string
status
required
integer
detail
string
instance
string
request_id
string
quota

For quota-exceeded, the window that is used up.

object
window
required
string
Allowed values: five_hours week month
percent_used
required
number
<= 100
resets_at
required

Null for a rolling window that hasn’t started.

string | null format: date-time
limited_by
required

organization when the organization’s budget is closer to running out than the member’s own limit.

string
Allowed values: personal organization
request
One of:

A request as its member sees it, where they asked.

object
id
required
string
status
required
string
Allowed values: pending approved declined withdrawn
created_at
required
string format: date-time
decided_at
required
string | null format: date-time
note
required

What the admin who decided wrote back.

string | null
errors

Field-level problems (400 only).

Array<object>
object
field
required

JSON pointer into the request body.

string
message
required
string

Example

{
"type": "https://docs.asklucy.eu/errors/answer-in-progress",
"quota": {
"window": "five_hours",
"limited_by": "personal",
"request": {
"status": "pending"
}
}
}
X-Request-Id
string

Unique per request; quote it to support.