curl --request PUT \
--url https://api.gowindmill.com/api/v2/c/{companyId}/stats/metadata \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"stat": "custom-items-completed",
"valueType": "COUNT",
"label": "Items completed",
"unitSingular": "item",
"unitPlural": "items"
}
'import requests
url = "https://api.gowindmill.com/api/v2/c/{companyId}/stats/metadata"
payload = {
"stat": "custom-items-completed",
"valueType": "COUNT",
"label": "Items completed",
"unitSingular": "item",
"unitPlural": "items"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
stat: 'custom-items-completed',
valueType: 'COUNT',
label: 'Items completed',
unitSingular: 'item',
unitPlural: 'items'
})
};
fetch('https://api.gowindmill.com/api/v2/c/{companyId}/stats/metadata', 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.gowindmill.com/api/v2/c/{companyId}/stats/metadata",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'stat' => 'custom-items-completed',
'valueType' => 'COUNT',
'label' => 'Items completed',
'unitSingular' => 'item',
'unitPlural' => 'items'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gowindmill.com/api/v2/c/{companyId}/stats/metadata"
payload := strings.NewReader("{\n \"stat\": \"custom-items-completed\",\n \"valueType\": \"COUNT\",\n \"label\": \"Items completed\",\n \"unitSingular\": \"item\",\n \"unitPlural\": \"items\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.gowindmill.com/api/v2/c/{companyId}/stats/metadata")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"stat\": \"custom-items-completed\",\n \"valueType\": \"COUNT\",\n \"label\": \"Items completed\",\n \"unitSingular\": \"item\",\n \"unitPlural\": \"items\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gowindmill.com/api/v2/c/{companyId}/stats/metadata")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"stat\": \"custom-items-completed\",\n \"valueType\": \"COUNT\",\n \"label\": \"Items completed\",\n \"unitSingular\": \"item\",\n \"unitPlural\": \"items\"\n}"
response = http.request(request)
puts response.read_body{
"statMetadata": {
"id": "11111111-1111-4111-8111-111111111111",
"createdAt": "2026-01-01T10:00:00.000Z",
"updatedAt": "2026-01-01T10:00:00.000Z",
"archivedAt": null,
"stat": "code-prs-merged",
"valueType": "COUNT",
"disabled": false,
"isGlobal": true,
"label": "Pull requests merged",
"shortLabel": "PRs merged",
"description": "Number of pull requests merged.",
"displayAsPercent": false,
"unitSingular": "pull request",
"unitPlural": "pull requests",
"denominatorUnitSingular": null,
"relatedStatTypes": [],
"relatedData": [],
"icon": {
"icon": "ACTIVITY",
"isBadge": true
},
"requiresMatchingIntegration": {
"type": "AI_AGENT",
"integrationIds": [
"integration-code"
]
}
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "FORBIDDEN",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "NOT_FOUND",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "CONFLICT",
"message": "<string>",
"requestId": "<string>",
"details": [
{
"path": [
"<string>"
],
"message": "<string>",
"resourceId": "<string>"
}
]
}
}{
"error": {
"code": "RATE_LIMITED",
"message": "<string>",
"requestId": "<string>"
}
}Create or replace a custom stat definition
Creates or updates a custom stat definition owned by the caller’s workspace, keyed by the stat identifier. Supply all required fields on every call: omitted optional display fields reset to null, and displayAsPercent resets to false. The aggregation type can change only before any values have been recorded for this definition. A later type change returns 409 without changing the definition or its values; create a new definition for the new type. Display edits and same-type saves remain available. This route defines a stat; it does not write employee stat values. Global Windmill-managed definitions are never modified; an identifier that matches a global stat creates a separate definition belonging to this workspace.
curl --request PUT \
--url https://api.gowindmill.com/api/v2/c/{companyId}/stats/metadata \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"stat": "custom-items-completed",
"valueType": "COUNT",
"label": "Items completed",
"unitSingular": "item",
"unitPlural": "items"
}
'import requests
url = "https://api.gowindmill.com/api/v2/c/{companyId}/stats/metadata"
payload = {
"stat": "custom-items-completed",
"valueType": "COUNT",
"label": "Items completed",
"unitSingular": "item",
"unitPlural": "items"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
stat: 'custom-items-completed',
valueType: 'COUNT',
label: 'Items completed',
unitSingular: 'item',
unitPlural: 'items'
})
};
fetch('https://api.gowindmill.com/api/v2/c/{companyId}/stats/metadata', 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.gowindmill.com/api/v2/c/{companyId}/stats/metadata",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'stat' => 'custom-items-completed',
'valueType' => 'COUNT',
'label' => 'Items completed',
'unitSingular' => 'item',
'unitPlural' => 'items'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gowindmill.com/api/v2/c/{companyId}/stats/metadata"
payload := strings.NewReader("{\n \"stat\": \"custom-items-completed\",\n \"valueType\": \"COUNT\",\n \"label\": \"Items completed\",\n \"unitSingular\": \"item\",\n \"unitPlural\": \"items\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.gowindmill.com/api/v2/c/{companyId}/stats/metadata")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"stat\": \"custom-items-completed\",\n \"valueType\": \"COUNT\",\n \"label\": \"Items completed\",\n \"unitSingular\": \"item\",\n \"unitPlural\": \"items\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gowindmill.com/api/v2/c/{companyId}/stats/metadata")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"stat\": \"custom-items-completed\",\n \"valueType\": \"COUNT\",\n \"label\": \"Items completed\",\n \"unitSingular\": \"item\",\n \"unitPlural\": \"items\"\n}"
response = http.request(request)
puts response.read_body{
"statMetadata": {
"id": "11111111-1111-4111-8111-111111111111",
"createdAt": "2026-01-01T10:00:00.000Z",
"updatedAt": "2026-01-01T10:00:00.000Z",
"archivedAt": null,
"stat": "code-prs-merged",
"valueType": "COUNT",
"disabled": false,
"isGlobal": true,
"label": "Pull requests merged",
"shortLabel": "PRs merged",
"description": "Number of pull requests merged.",
"displayAsPercent": false,
"unitSingular": "pull request",
"unitPlural": "pull requests",
"denominatorUnitSingular": null,
"relatedStatTypes": [],
"relatedData": [],
"icon": {
"icon": "ACTIVITY",
"isBadge": true
},
"requiresMatchingIntegration": {
"type": "AI_AGENT",
"integrationIds": [
"integration-code"
]
}
}
}{
"error": {
"code": "BAD_REQUEST",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "UNAUTHORIZED",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "FORBIDDEN",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "NOT_FOUND",
"message": "<string>",
"requestId": "<string>"
}
}{
"error": {
"code": "CONFLICT",
"message": "<string>",
"requestId": "<string>",
"details": [
{
"path": [
"<string>"
],
"message": "<string>",
"resourceId": "<string>"
}
]
}
}{
"error": {
"code": "RATE_LIMITED",
"message": "<string>",
"requestId": "<string>"
}
}Authorizations
Use an API key or OAuth access token. Enter only the token in the authorization dialog; requests send it as Authorization: Bearer <TOKEN>.
Create an API key in your workspace's Settings → API keys. Keys start with wm_api_ and only work in the workspace where they were created. Read-only keys can read data; creating, updating, or deleting data requires a read-write key.
Authorization: Bearer wm_api_example
OAuth access tokens are issued for connected Windmill applications.
Authorization: Bearer <OAUTH_ACCESS_TOKEN>
Both token types use the authenticated user's workspace permissions. Each endpoint's permission requirements and the sharing settings of the requested items still apply.
Path Parameters
Body
Complete display configuration for a workspace custom stat.
Was this page helpful?