Returns every tag that exists. There's no standalone "create a tag" call -- tags are created automatically the first time you tag a job or tag a job step with a name that doesn't exist yet.

Having trouble reaching the API, or logging in from another machine? See Network Access & Authentication Security -- by default the Api only answers localhost, and PowerShell needs an extra flag once it does answer elsewhere.

Order of Operations

  1. Authenticate to the API.
  2. Request the tag list.

The call

GET /api/tags

No route parameters, no query parameters, no request body.

Permission needed: Job.View.

C# example

var jsonOptions = new JsonSerializerOptions(JsonSerializerDefaults.Web);

// Step 1: Authenticate to the API.
using var handler = new HttpClientHandler { UseDefaultCredentials = true };
using var client = new HttpClient(handler) { BaseAddress = new Uri("http://your-minion-agent-server:5443") };
client.DefaultRequestHeaders.Add("X-App-Name", "MyIntegration");

// Step 2: Request the tag list.
var tags = await client.GetFromJsonAsync<TagInfo[]>("/api/tags", jsonOptions);
foreach (var tag in tags!)
{
    Console.WriteLine($"{tag.TagID}: {tag.TagName} ({tag.Color})");
}

record TagInfo(int TagID, string TagName, string Color);

Not on a domain machine? Swap in the app-account login from Calling the API From Your Own Code.

PowerShell example

# Step 1: Authenticate to the API.
$headers = @{ "X-App-Name" = "MyIntegration" }

# Step 2: Request the tag list. (-AllowUnencryptedAuthentication: PowerShell requires this for Windows auth over plain http to anything but localhost -- see "Network Access & Authentication Security".)
$tags = Invoke-RestMethod -Uri "http://your-minion-agent-server:5443/api/tags" -UseDefaultCredentials -AllowUnencryptedAuthentication -Headers $headers
$tags | ForEach-Object { "$($_.tagID): $($_.tagName) ($($_.color))" }

What you get back

200 OK, an array, ordered by name:

[
    { "tagID": 5, "tagName": "prod", "color": "#c0392b" },
    { "tagID": 9, "tagName": "reporting", "color": "#8a857c" }
]

#8a857c is the default color a newly-upserted tag gets when nothing else specifies one.

Codes this call can return

See API Response Codes for what each one means in general. For this specific call:

  • 200 -- the list, even if it's empty.
  • 403 -- you don't have Job.View anywhere.

See also: Update a Tag's Color, What a Tag Applies To.