Tallyfy’s Tags API allows you to create and manage organization-scoped labels with unique titles…
Create tag
POST /organizations/{org_id}/tags
Creates a new tag in the specified organization.
Replace {org_id} with your Organization ID.
Authorization: Bearer {your_access_token}Accept: application/jsonX-Tallyfy-Client: APIClientContent-Type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
title | string | Yes | Tag name. Must be unique within the org. Can’t exceed 30 characters. |
color | string | No | Hex color code, exactly 7 characters (e.g., #3498db). |
{ "title": "High Priority", "color": "#e74c3c"}const accessToken = 'YOUR_PERSONAL_ACCESS_TOKEN';const orgId = 'YOUR_ORGANIZATION_ID';const apiUrl = `https://go.tallyfy.com/api/organizations/${orgId}/tags`;
const tagData = { title: "JS Created Tag", // Required color: "#9b59b6" // Optional: Purple};
const headers = new Headers();headers.append('Authorization', `Bearer ${accessToken}`);headers.append('Accept', 'application/json');headers.append('X-Tallyfy-Client', 'APIClient');headers.append('Content-Type', 'application/json');
fetch(apiUrl, { method: 'POST', headers: headers, body: JSON.stringify(tagData)}).then(response => { return response.json().then(data => { if (!response.ok) { console.error("Failed to create tag:", data); throw new Error(`HTTP error! status: ${response.status}`); } return data; });}).then(data => { console.log('Successfully created tag:'); console.log(JSON.stringify(data, null, 2));}).catch(error => { console.error('Error creating tag:', error.message);});import requestsimport jsonimport os
access_token = os.environ.get('TALLYFY_ACCESS_TOKEN', 'YOUR_PERSONAL_ACCESS_TOKEN')org_id = os.environ.get('TALLYFY_ORG_ID', 'YOUR_ORGANIZATION_ID')api_url = f'https://go.tallyfy.com/api/organizations/{org_id}/tags'
headers = { 'Authorization': f'Bearer {access_token}', 'Accept': 'application/json', 'X-Tallyfy-Client': 'APIClient', 'Content-Type': 'application/json'}
tag_payload = { 'title': 'Python Tag', # Required 'color': '#f1c40f' # Optional: Yellow}
response = Nonetry: response = requests.post(api_url, headers=headers, json=tag_payload) response.raise_for_status()
created_tag = response.json() print('Successfully created tag:') print(json.dumps(created_tag, indent=4))
except requests.exceptions.RequestException as e: print(f"Request failed: {e}") if response is not None: print(f"Response: {response.text}")except Exception as e: print(f"Error: {e}")import java.net.URI;import java.net.http.HttpClient;import java.net.http.HttpRequest;import java.net.http.HttpResponse;import java.io.IOException;
public class CreateTag { public static void main(String[] args) { String accessToken = System.getenv().getOrDefault("TALLYFY_ACCESS_TOKEN", "YOUR_PERSONAL_ACCESS_TOKEN"); String orgId = System.getenv().getOrDefault("TALLYFY_ORG_ID", "YOUR_ORGANIZATION_ID"); String apiUrl = "https://go.tallyfy.com/api/organizations/" + orgId + "/tags";
String jsonPayload = "{\"title\": \"Java Tag\", \"color\": \"#3498db\"}";
HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(apiUrl)) .header("Authorization", "Bearer " + accessToken) .header("Accept", "application/json") .header("X-Tallyfy-Client", "APIClient") .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(jsonPayload)) .build();
try { HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() == 201) { System.out.println("Successfully created tag:"); System.out.println(response.body()); } else { System.err.println("Failed to create tag. Status: " + response.statusCode()); System.err.println("Response Body: " + response.body()); } } catch (IOException | InterruptedException e) { System.err.println("Request failed: " + e.getMessage()); Thread.currentThread().interrupt(); } }}package main
import ( "bytes" "encoding/json" "fmt" "io" "net/http" "os" "time")
func main() { accessToken := os.Getenv("TALLYFY_ACCESS_TOKEN") if accessToken == "" { accessToken = "YOUR_PERSONAL_ACCESS_TOKEN" } orgId := os.Getenv("TALLYFY_ORG_ID") if orgId == "" { orgId = "YOUR_ORGANIZATION_ID" } apiUrl := fmt.Sprintf("https://go.tallyfy.com/api/organizations/%s/tags", orgId)
tagData := map[string]interface{}{ "title": "Go Tag", // Required "color": "#e67e22", // Optional: Orange }
jsonData, err := json.Marshal(tagData) if err != nil { fmt.Printf("Error marshalling JSON: %v\n", err) return }
client := &http.Client{Timeout: 15 * time.Second} req, err := http.NewRequest(http.MethodPost, apiUrl, bytes.NewBuffer(jsonData)) if err != nil { fmt.Printf("Error creating request: %v\n", err) return }
req.Header.Set("Authorization", "Bearer "+accessToken) req.Header.Set("Accept", "application/json") req.Header.Set("X-Tallyfy-Client", "APIClient") req.Header.Set("Content-Type", "application/json")
resp, err := client.Do(req) if err != nil { fmt.Printf("Error sending request: %v\n", err) return } defer resp.Body.Close()
body, err := io.ReadAll(resp.Body) if err != nil { fmt.Printf("Error reading response: %v\n", err) return }
if resp.StatusCode != http.StatusCreated { fmt.Printf("Failed to create tag. Status: %d\nBody: %s\n", resp.StatusCode, string(body)) return }
fmt.Println("Successfully created tag:") // Pretty print JSON response var prettyJSON bytes.Buffer if err := json.Indent(&prettyJSON, body, "", " "); err == nil { fmt.Println(prettyJSON.String()) } else { fmt.Println(string(body)) }}#include <iostream>#include <string>#include <cpprest/http_client.h>#include <cpprest/json.h>
using namespace web;using namespace web::http;using namespace web::http::client;using namespace web::json;
pplx::task<void> CreateTallyfyTag(const utility::string_t& title, const utility::string_t& color = U("")){ utility::string_t accessToken = U("YOUR_PERSONAL_ACCESS_TOKEN"); utility::string_t orgId = U("YOUR_ORGANIZATION_ID"); utility::string_t apiUrl = U("https://go.tallyfy.com/api/organizations/") + orgId + U("/tags");
// Construct payload value payload = value::object(); payload[U("title")] = value::string(title); // Required if (!color.empty()) { payload[U("color")] = value::string(color); // Optional }
http_client client(apiUrl); http_request request(methods::POST);
request.headers().add(U("Authorization"), U("Bearer ") + accessToken); request.headers().add(U("Accept"), U("application/json")); request.headers().add(U("X-Tallyfy-Client"), U("APIClient")); request.headers().set_content_type(U("application/json")); request.set_body(payload);
return client.request(request).then([](http_response response) { return response.extract_json().then([response](pplx::task<value> task) { try { value const & body = task.get(); if (response.status_code() == status_codes::Created) { std::wcout << L"Successfully created tag:\n" << body.serialize() << std::endl; } else { std::wcerr << L"Failed to create tag. Status: " << response.status_code() << L"\nResponse: " << body.serialize() << std::endl; } } catch (const std::exception& e) { std::wcerr << L"Error: " << e.what() << std::endl; } }); });}
int main() { try { CreateTallyfyTag(U("C++ High Priority"), U("#e74c3c")).wait(); CreateTallyfyTag(U("C++ Info Only")).wait(); // Create without color } catch (const std::exception &e) { std::cerr << "Error in main: " << e.what() << std::endl; } return 0;}// Requires C++ REST SDK (Casablanca)using System;using System.Net.Http;using System.Net.Http.Headers;using System.Text;using System.Text.Json;using System.Text.Json.Serialization; // For JsonIgnoreConditionusing System.Threading.Tasks;
public class TallyfyTagCreator{ private static readonly HttpClient client = new HttpClient();
public class TagPayload { public string Title { get; set; } // Required [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public string Color { get; set; } // Optional hex code, e.g., "#3498db" }
public static async Task CreateTagAsync(TagPayload payload) { var accessToken = Environment.GetEnvironmentVariable("TALLYFY_ACCESS_TOKEN") ?? "YOUR_PERSONAL_ACCESS_TOKEN"; var orgId = Environment.GetEnvironmentVariable("TALLYFY_ORG_ID") ?? "YOUR_ORGANIZATION_ID"; var apiUrl = $"https://go.tallyfy.com/api/organizations/{orgId}/tags";
if (string.IsNullOrWhiteSpace(payload?.Title)) { Console.WriteLine("Error: Tag Title is required."); return; }
try { using var request = new HttpRequestMessage(HttpMethod.Post, apiUrl); request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken); request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); request.Headers.Add("X-Tallyfy-Client", "APIClient");
var options = new JsonSerializerOptions { DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull }; string jsonPayload = JsonSerializer.Serialize(payload, options); request.Content = new StringContent(jsonPayload, Encoding.UTF8, "application/json");
HttpResponseMessage response = await client.SendAsync(request); string responseBody = await response.Content.ReadAsStringAsync();
if (response.IsSuccessStatusCode) // Expects 201 Created { Console.WriteLine("Successfully created tag:"); try { using var doc = JsonDocument.Parse(responseBody); Console.WriteLine(JsonSerializer.Serialize(doc.RootElement, new JsonSerializerOptions { WriteIndented = true })); } catch (JsonException) { Console.WriteLine(responseBody); } } else { Console.WriteLine($"Failed to create tag. Status: {response.StatusCode}"); Console.WriteLine($"Response: {responseBody}"); } } catch (HttpRequestException e) { Console.WriteLine($"Request error: {e.Message}"); } catch (Exception ex) { Console.WriteLine($"Error: {ex.Message}"); } }
// Example Usage: // static async Task Main(string[] args) // { // var newTag = new TagPayload { // Title = "C# Project Tag", // Color = "#2ecc71" // Green // }; // await CreateTagAsync(newTag); // }}You’ll get a 201 Created status with a JSON object containing the new tag’s details.
{ "data": { "id": "new_tag_id_xyz", "title": "Python Tag", "color": "#f1c40f", "auto_generated": false, "created_at": "2024-03-15T10:30:00Z", "deleted_at": null }}Save the returned id to update or delete this tag later.
Modify an existing tag’s title (up to 30 characters, unique per organization) or hex color code…
Create a new group in your Tallyfy organization via a POST request with a name, description, and…
Retrieve a specific tag by its ID using a GET request to…
Was this helpful?
About Tallyfy
- 2025 Tallyfy, Inc.
- Privacy Policy
- Terms of Use
- Report Issue
- Trademarks