Add a reader group: who's in it is worked out from your users' properties each time they read, by its conditions.
Needs a read + write key.
Tuti APIUsers
Add a reader group: who's in it is worked out from your users' properties each time they read, by its conditions.
Needs a read + write key.
/groupsAuthorization Bearer token
application/json · object · required
namestring · 1–50 charactersrequiredIts name; its key comes from it and never changes
descriptionstring · at most 300 charactersAn optional description, what it's for, for the team
Default: ""
conditionsarray of object · 1–10 itemsrequiredWho's in it: conditions on your users' properties (set by SSO tokens' properties and users.sync), at least one and up to 10. Values compare as text, exactly; a list property matches when one of its items does (for the negative ones, when none does), and a missing one matches only the negative ones and is_not_set. An SSO token's groups is the groups property: { "property": "groups", "op": "is", "value": "beta" }
Option 1objectpropertystring · 1–64 charactersrequiredThe user property it looks at, by name
opstringrequiredWhether the property is, is_not, contains or excludes a text
One of"is""is_not""contains""excludes"
valuestring · 1–200 charactersrequiredThe text it compares with
Option 2objectpropertystring · 1–64 charactersrequiredThe user property it looks at, by name
opstringrequiredWhether the property is_any_of or is_none_of a list
One of"is_any_of""is_none_of"
valuearray of string · 1–50 itemsrequiredThe texts it compares with, up to 50
Each item: 1–200 characters
Option 3objectpropertystring · 1–64 charactersrequiredThe user property it looks at, by name
opstringrequiredWhether the property is set; these take no value
One of"is_set""is_not_set"
matchstringall (the default) needs every condition to match a user, any one of them
Default: "all"
One of"all""any"
200The new group, with who's in it nowapplication/json · ReaderGroup
The new group, with who's in it now
keystringrequiredIts key: from its name when made, it never changes, and names it in these paths and on tabs, collections and articles (groups)
namestringrequiredIts name
descriptionstringrequiredWhat it's for, for the team; empty if none
conditionsarray of GroupConditionrequiredWho's in it: one of your app's users is when their properties match all of these, or any one (match)
propertystringrequiredThe user property it looks at, by name
opstringrequiredHow it compares the property with value
One of"is""is_not""is_any_of""is_none_of""contains""excludes""is_set""is_not_set"
valuestring or array of stringThe text it compares with, or a list for is_any_of and is_none_of; none for is_set and is_not_set
Option 1stringOption 2array of stringmatchstringrequiredall of the conditions must match, or any one
One of"all""any"
readersintegerrequiredHow many of your users are in it now
samplearray of stringrequiredThe names of the first 3 of them, by name
400The request isn't valid: a field is missing, has the wrong type or is out of range, or the body isn't a JSON object. The message names the field.application/json · Error
errorobjectrequiredcodestringrequiredWhat went wrong, for code to check: stays the same
messagestringrequiredWhat went wrong, for a person: may change
401No API key was sent, or it isn't valid: it was revoked, or whoever created it left the team.application/json · Error
errorobjectrequiredcodestringrequiredWhat went wrong, for code to check: stays the same
messagestringrequiredWhat went wrong, for a person: may change
402The project's plan doesn't include this or is at its limit, it's out of AI credits, or a payment didn't go through. The message says what's needed.application/json · Error
errorobjectrequiredcodestringrequiredWhat went wrong, for code to check: stays the same
messagestringrequiredWhat went wrong, for a person: may change
403It isn't allowed: the key is read-only, its creator isn't a project owner or admin where only they may, only a person can do it in the app, a setting is off, or someone's address isn't confirmed. The code says which.application/json · Error
errorobjectrequiredcodestringrequiredWhat went wrong, for code to check: stays the same
messagestringrequiredWhat went wrong, for a person: may change
429Too many requests: past 600 a minute per key, try again after the seconds in the Retry-After header. Some operations have limits of their own (their description gives them), whose 429 has no Retry-After.application/json · Error
errorobjectrequiredcodestringrequiredWhat went wrong, for code to check: stays the same
messagestringrequiredWhat went wrong, for a person: may change
500Something went wrong on Tuti's side. Try again in a moment.application/json · Error
errorobjectrequiredcodestringrequiredWhat went wrong, for code to check: stays the same
messagestringrequiredWhat went wrong, for a person: may change
curl 'https://tuti.so/api/v1/groups' \
--request POST \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Pro customers",
"conditions": [
{
"property": "plan",
"op": "is_any_of",
"value": [
"pro",
"enterprise"
]
},
{
"property": "support_tier",
"op": "is_set"
}
]
}'const response = await fetch("https://tuti.so/api/v1/groups", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
"name": "Pro customers",
"conditions": [
{
"property": "plan",
"op": "is_any_of",
"value": [
"pro",
"enterprise"
]
},
{
"property": "support_tier",
"op": "is_set"
}
]
}),
});
const text = await response.text();import requests
response = requests.post(
"https://tuti.so/api/v1/groups",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
data="{\n \"name\": \"Pro customers\",\n \"conditions\": [\n {\n \"property\": \"plan\",\n \"op\": \"is_any_of\",\n \"value\": [\n \"pro\",\n \"enterprise\"\n ]\n },\n {\n \"property\": \"support_tier\",\n \"op\": \"is_set\"\n }\n ]\n}",
)
print(response.text){
"key": "pro-customers",
"name": "Pro customers",
"description": "Customers on a paid plan",
"conditions": [
{
"property": "plan",
"op": "is_any_of",
"value": [
"pro",
"enterprise"
]
}
],
"match": "all",
"readers": 42,
"sample": [
"Sam from Acme"
]
}{
"error": {
"code": "invalid_input",
"message": "title: Title is too short"
}
}{
"error": {
"code": "unauthorized",
"message": "This API key isn't valid or was revoked"
}
}{
"error": {
"code": "plan_required",
"message": "A custom domain needs the Pro plan. See Settings → Billing."
}
}{
"error": {
"code": "forbidden",
"message": "This key can only read. Create a read + write key to change things."
}
}{
"error": {
"code": "rate_limited",
"message": "Up to 600 requests a minute per key"
}
}{
"error": {
"code": "internal_error",
"message": "Something went wrong"
}
}