Skip to main content
PATCH
Replace a draft metric's definition

Authorizations

apiKey
string
query
required

apiKey MUST be supplied within the request body instead of query

Path Parameters

projectId
string<uuid>
required

The project the workspace belongs to.

Pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
workspaceId
string<uuid>
required

The workspace (data model) id.

Pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
slug
string
required

The metric's handle: lowercase kebab-case, stable across versions. Ratio and derived metrics reference each other by it.

Required string length: 1 - 100
Pattern: ^[a-z0-9]+(?:-[a-z0-9]+)*$

Body

application/json

PATCH /v2/api/projects/:projectId/workspaces/:workspaceId/draft/metrics/:slug Request body

lockVersion
integer
required

The lockVersion the caller last read. The write is rejected with 412 when it no longer matches.

Required range: 0 <= x <= 9007199254740991
metric
object
required

The metric's complete new definition. The type may change.

apiKey
string

Upsolve API key, generated under Account → Developer settings in the Upsolve Hub. Keys are user-scoped: pass organizationId alongside the key to select which org to act on.

Minimum string length: 1
Example:

"up_embed_************"

organizationId
string<uuid>

Your Upsolve organization's UUID — the org that owns the API key and project. This is NOT a project organization: do not pass a value registered via /projects/register-organization, and do not pass an externalId (only projectOrganizationId accepts those). Omit it when using an org-bound API key — the org is read from the key and any value sent here is ignored. Required only for user-scoped API keys (created under Account → Developer settings) and for the Supabase JWT path, where the org is ambiguous and membership is verified against it.

Pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
Example:

"123e4567-e89b-12d3-a456-426614174000"

Response

PATCH /v2/api/projects/:projectId/workspaces/:workspaceId/draft/metrics/:slug Positive response

status
string
required
Allowed value: "success"
data
object
required