Labels

Workspace owners can use Labels to grant users access to groups of resources. When you add a Label to a Source or Personas Space, any users to whom you assign that Label gain access to those resources.

To create or configure labels, go to the Labels tab in your Workspace settings. Only Workspace Owners can manage labels for the entire Workspace.

Create Label

Creates a new label.

• When called, this endpoint may generate the Label Created event in the audit trail.

The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See Rate Limiting for more information.

Securitytoken
Request
Request Body schema:
required
required
object (label)

The new label to create in the Workspace.

Responses
201

Created

404

Resource not found

422

Validation failure

429

Too many requests

post/labels
Request samples
{
  • "label": {
    }
}
Response samples
{
  • "data": {
    }
}

List Labels

Returns a list of all available labels.

Securitytoken
Responses
200

OK

404

Resource not found

422

Validation failure

429

Too many requests

get/labels
Request samples
import { configureApis, unwrap } from '@segment/public-api-sdk-typescript'

const api = configureApis('/* Insert your Public API token here */')

try {
  const result = await unwrap(api.labels.listLabels())
  console.log(JSON.stringify(result))
} catch (e) {
  console.log('ERROR:', e)
}
Response samples
{
  • "data": {
    }
}

Delete Label

Deletes a label.

• When called, this endpoint may generate the Label Deleted event in the audit trail.

The rate limit for this endpoint is 60 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See Rate Limiting for more information.

Securitytoken
Request
path Parameters
key
required
string [ 1 .. 255 ]
Example: environment
value
required
string [ 1 .. 255 ]
Example: yolo
Responses
200

OK

404

Resource not found

422

Validation failure

429

Too many requests

delete/labels/{key}/{value}
Request samples
import { configureApis, unwrap } from '@segment/public-api-sdk-typescript'

const api = configureApis('/* Insert your Public API token here */')

try {
  const result = await unwrap(api.labels.deleteLabel('environment', 'yolo'))
  console.log(JSON.stringify(result))
} catch (e) {
  console.log('ERROR:', e)
}
Response samples
{
  • "data": {
    }
}