Tag Value Creation API
curl --request POST \
--url https://api.pazy.io/v1.0/tag/:tagId/valueimport requests
url = "https://api.pazy.io/v1.0/tag/:tagId/value"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.pazy.io/v1.0/tag/:tagId/value', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pazy.io/v1.0/tag/:tagId/value",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.pazy.io/v1.0/tag/:tagId/value"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.pazy.io/v1.0/tag/:tagId/value")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pazy.io/v1.0/tag/:tagId/value")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyTags APIs
Tag Value Creation API
Add a selectable value to an existing dropdown tag
Tag Value Creation API
curl --request POST \
--url https://api.pazy.io/v1.0/tag/:tagId/valueimport requests
url = "https://api.pazy.io/v1.0/tag/:tagId/value"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.pazy.io/v1.0/tag/:tagId/value', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pazy.io/v1.0/tag/:tagId/value",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.pazy.io/v1.0/tag/:tagId/value"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.pazy.io/v1.0/tag/:tagId/value")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pazy.io/v1.0/tag/:tagId/value")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyAuthentication
All requests require an API key in the request headers. Headers:Authorization: Api-Key YOUR_API_KEY
Content-Type: application/json
Request
Content-Type:application/json
This endpoint adds a value to an existing dropdown tag. Use the tag’s slug (from the Tag List API or Tag Creation API) as the tagId path parameter.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
tagId | string | Yes | Slug identifier of the dropdown tag the value belongs to (1–64 characters) |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
value | string | Yes | The tag value to create (1–256 characters) |
alias | string | No | An alias for the tag value (1–64 characters) |
Code Examples
curl -X POST https://api.pazy.io/v1.0/tag/cost-centre/value \
-H "Authorization: Api-Key YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"value": "Engineering",
"alias": "ENG"
}'
const response = await fetch('https://api.pazy.io/v1.0/tag/cost-centre/value', {
method: 'POST',
headers: {
'Authorization': 'Api-Key YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
value: 'Engineering',
alias: 'ENG'
})
});
const result = await response.json();
import requests
url = "https://api.pazy.io/v1.0/tag/cost-centre/value"
headers = {
"Authorization": "Api-Key YOUR_API_KEY",
"Content-Type": "application/json"
}
payload = {
"value": "Engineering",
"alias": "ENG"
}
response = requests.post(url, headers=headers, json=payload)
result = response.json()
Success Response
HTTP Status:200 OK
Response Fields:
| Field | Type | Description |
|---|---|---|
ok | boolean | Indicates whether the request was successful |
created | boolean | Indicates whether the tag value was created |
tagValue | object | The created tag value |
tagValue.id | number | Unique identifier of the created tag value. Use this as tagId in the Invoice List API to filter by this value |
Response Example
{
"ok": true,
"created": true,
"tagValue": {
"id": 1024
}
}
Error Responses
Tag Is Not a Dropdown
Returned when the target tag is not a dropdown tag (values can only be added to dropdown tags). HTTP Status:400 Bad Request
{
"ok": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Tag should be dropdown"
}
}
Tag Value Already Exists
HTTP Status:400 Bad Request
{
"ok": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Tag value already exists"
}
}
Tag Not Found
HTTP Status:404 Not Found
{
"ok": false,
"error": {
"code": "TAG_NOT_FOUND",
"message": "Dropdown tag does not exist"
}
}
Tag Creation Not Allowed
Returned when adding values to this tag is not permitted because an accounting integration is connected and manages this tag. HTTP Status:403 Forbidden
{
"ok": false,
"error": {
"code": "ACCESS_DENIED",
"message": "Tag creation not allowed when accounting is connected"
}
}
Validation Error
Returned when the requiredvalue field is missing.
HTTP Status: 400 Bad Request
{
"ok": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Validation failed: /body: must have required property 'value'"
}
}
Tag Value Creation Failed
In the rare case the value could not be persisted, the response is returned with an HTTP200 OK status, ok: false, and created: false.
HTTP Status: 200 OK
{
"ok": false,
"created": false
}
Access Denied
HTTP Status:403 Forbidden
{
"ok": false,
"error": {
"code": "ACCESS_DENIED",
"message": "Access denied: Only admin and bookkeeper can create this resources"
}
}
Authentication Errors
HTTP Status:401 Unauthorized
{
"ok": false,
"error": {
"code": "MISSING_CREDENTIALS",
"message": "Missing Credentials"
}
}
{
"ok": false,
"error": {
"code": "INVALID_API_KEY",
"message": "Invalid API Key"
}
}
Permission Errors
HTTP Status:403 Forbidden
{
"ok": false,
"error": {
"code": "INSUFFICIENT_PERMISSIONS",
"message": "Permission check failed - PERMISSION_CHECK_FAILED"
}
}
Best Practices
- Values can only be added to
DROPDOWNtags — create the tag with the Tag Creation API usingdataType: "DROPDOWN"first - Always check the
createdflag in addition to the HTTP status; a failure is returned withok: falseandcreated: falseunder a200 OKstatus - Use the returned
tagValue.idto filter transactions (for example, in the Invoice List API) by this tag value - Access is limited to users with tag create permission and an admin or bookkeeper role
Was this page helpful?