Monica
Log in
API v1
v1
View as Markdown

Add a value

POST /api/v1/value-lists/{valueList}/items

Add a value at the end of a value list.

A list that takes no choices of its own answers 422 on valueList with This value list does not take choices of its own.

Parameters

Sent as JSON. Anything not listed here is ignored.

valueList integer Required

The id of the value list, as List value lists gives it.

label string Optional

What the value says, up to 255 characters. Required, except on the Countries list, where country_code may stand in its place.

country_code string Optional

On the Countries list only, a two letter ISO 3166 code from List countries. Refused on any other list.

Returns

The new value. A list of another account, a list that belongs to one field, and a value of another list answer 404.

data object

The value.

data.type string

Always value_list_item.

data.id integer

The id of the value, which is what a field offering this list stores.

data.attributes object

What the value holds.

data.attributes.label string

What the value says.

data.attributes.country_code string

On the Countries list, its two letter code. Null on every other list.

data.attributes.is_active boolean

Whether the value is offered.

data.attributes.position integer

Its place in the list, counting from 1.

Rate limit

Sixty requests per minute, per user, shared by every key and device. Every answer carries the budget left in X-RateLimit-Remaining.

POST
curl https://my.monicahq.com/api/v1/value-lists/21/items \
-X POST \
-H "Authorization: Bearer $MONICA_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"label": "Staples"
}'
const response = await fetch('https://my.monicahq.com/api/v1/value-lists/21/items', {
method: 'POST',
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
body: JSON.stringify({
label: 'Staples',
}),
})
const data = await response.json()
$response = Http::withToken($token)->post('https://my.monicahq.com/api/v1/value-lists/21/items', [
'label' => 'Staples',
]);
Response 201
{
"data": {
"type": "value_list_item",
"id": 87,
"attributes": {
"label": "Staples",
"country_code": null,
"is_active": true,
"position": 1
}
}
}

Keys act as you, with exactly the access you have. Make one per integration so you can revoke it alone.