Tags
Tags are essential for mapping a subscriber's journey, from purchases to onboarding. They enable precise user segmentation, detailed queries, and laser-focused marketing.
Tags are essential data labels that help you monitor subscriber journeys—from purchases to onboarding steps—and power granular segmentation alongside dynamic reporting.
| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/fetch/tags | Get Tags |
| POST | /v1/fetch/tags | Create Tag |
The tag model
Tags are lightweight labels that help you group subscribers and drive conditional logic across Bento.
name · string
Human-readable tag name (unique per site).
created_at · datetime
ISO timestamp marking when the tag was created.
discarded_at · datetime | null
Set when a tag is archived or removed.
Get Tags
Returns every tag in your site so you can sync labels to downstream systems or analytics.
cURL
bashcurl -L -u publishableKey:secretKey \
-X GET "https://app.bentonow.com/api/v1/fetch/tags?site_uuid=ExampleID1234" \
-H "Accept: application/json"
JavaScript
javascriptconst axios = require('axios');
let config = {
method: 'get',
url: 'https://app.bentonow.com/api/v1/fetch/tags',
params: { site_uuid: 'ExampleID1234' },
auth: {
username: 'publishableKey',
password: 'secretKey'
},
headers: {
'Accept': 'application/json'
}
};
axios(config)
.then((response) => {
console.log(JSON.stringify(response.data, null, 2));
})
.catch((error) => {
console.error('Error:', error.response ? error.response.data : error.message);
});
Laravel SDK
phpuse Bentonow\BentoLaravel\Facades\Bento;
return Bento::getTags()->json();
Python
pythonfrom bento_api import BentoAPI
import os
api = BentoAPI(
site_uuid=os.getenv('BENTO_SITE_UUID'),
username=os.getenv('BENTO_PUBLISHABLE_KEY'),
password=os.getenv('BENTO_SECRET_KEY')
)
tags = api.get_tags()
C#
csharppublic class TagExample
{
private readonly IBentoTagService _tagService;
public TagExample(IBentoTagService tagService)
{
_tagService = tagService;
}
public async Task TagExamples()
{
var getTagsResponse = await _tagService.GetTagsAsync<dynamic>();
}
}
Go
gotags, err := client.GetTags(ctx)
if err != nil {
log.Fatal(err)
}
for _, tag := range tags {
fmt.Printf("Tag: %s (ID: %s)\n", tag.Attributes.Name, tag.ID)
}
Response
Returns an array of tag resources with metadata for each entry.
Response body
json{
"data": [
{
"id": "1234",
"type": "tags",
"attributes": {
"name": "example_tag",
"created_at": "2024-08-06T05:44:04.444Z",
"discarded_at": null
}
}
]
}
Create Tag
Creates a new tag so you can segment subscribers or trigger automations based on fresh signals.
Required attributes
- tag.name · string
- Tag name to create. Must be unique for your site.
cURL
bashcurl -L -u publishableKey:secretKey \
-X POST "https://app.bentonow.com/api/v1/fetch/tags?site_uuid=ExampleID1234" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
--data-raw '{
"tag": {
"name": "example"
}
}'
JavaScript
javascriptconst axios = require('axios');
let data = {
tag: {
name: 'example'
}
};
let config = {
method: 'post',
url: 'https://app.bentonow.com/api/v1/fetch/tags',
params: { site_uuid: 'ExampleID1234' },
auth: {
username: 'publishableKey',
password: 'secretKey'
},
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
data: JSON.stringify(data)
};
axios(config)
.then((response) => {
console.log(JSON.stringify(response.data, null, 2));
})
.catch((error) => {
console.error('Error:', error.response ? error.response.data : error.message);
});
Laravel SDK
phpuse Bentonow\BentoLaravel\Facades\Bento;
use Bentonow\BentoLaravel\DataTransferObjects\CreateTagData;
$data = new CreateTagData(name: "example tag");
return Bento::createTag($data)->json();
Python
pythonfrom bento_api import BentoAPI
import os
api = BentoAPI(
site_uuid=os.getenv('BENTO_SITE_UUID'),
username=os.getenv('BENTO_PUBLISHABLE_KEY'),
password=os.getenv('BENTO_SECRET_KEY')
)
new_tag = api.create_tag(name="new_customer")
C#
csharppublic class TagExample
{
private readonly IBentoTagService _tagService;
public TagExample(IBentoTagService tagService)
{
_tagService = tagService;
}
public async Task TagExamples()
{
var tagRequest = new TagRequest("example_tag");
var createTagResponse = await _tagService.CreateTagAsync<dynamic>(tagRequest);
}
}
Go
gonewTag, err := client.CreateTag(ctx, "example_tag")
if err != nil {
log.Fatal(err)
}
fmt.Printf("Created new tag: %s\n", newTag.Attributes.Name)
Response
Returns the newly created tag resource.
Response body
json{
"data": {
"id": "1234",
"type": "tags",
"attributes": {
"name": "example_tag",
"created_at": "2024-08-06T05:44:04.444Z",
"discarded_at": null
}
}
}
Need the original Markdown? Open raw file