Usertour Attribute definitions API

The Attribute definitions API from Usertour, for attribute definitions.

GitHub OpenAPI

Operations 6

GET /v2/projects/{projectId}/attribute-definitions List attribute definitions #
POST /v2/projects/{projectId}/attribute-definitions Create an attribute definition #
GET /v2/projects/{projectId}/attribute-definitions/{id} Get an attribute definition #
PATCH /v2/projects/{projectId}/attribute-definitions/{id} Update an attribute definition #
DELETE /v2/projects/{projectId}/attribute-definitions/{id} Delete an attribute definition #
POST /v2/projects/{projectId}/attribute-definitions/{id}/restore Restore a deleted attribute definition #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/usertour-io:usertour-io-attribute-definitions-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

usertour-io-attribute-definitions-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Usertour API v2 Attribute definitions API
  description: 'Project-scoped v2 API. Authenticate with a personal API token — an opaque `utp_...` string (NOT a JWT: do not try to decode it), created in the Usertour app under Settings → API, sent as `Authorization: Bearer utp_...`.'
  version: '2.0'
  contact: {}
servers:
- url: https://api.usertour.io
tags:
- name: Attribute definitions
paths:
  /v2/projects/{projectId}/attribute-definitions:
    get:
      operationId: ApiAttributeDefinitionsController_list
      summary: List attribute definitions
      parameters:
      - name: projectId
        required: true
        in: path
        description: Project ID
        schema:
          type: string
      - name: limit
        required: false
        in: query
        description: Max items per page (1-100, default 20).
        schema:
          minimum: 1
          maximum: 100
          default: 20
          type: integer
      - name: cursor
        required: false
        in: query
        description: 'Opaque page cursor — the `cursor` query value found inside a prior response''s `next`/`previous` URL. Normally you never build this yourself: just GET those URLs as-is.'
        schema:
          type: string
      - name: name
        required: false
        in: query
        description: Filter by name (case-insensitive substring match).
        schema:
          type: string
      - name: scope
        required: false
        in: query
        description: 'Filter by scope: user, company, companyMembership, or eventDefinition (event attributes — attach them to events via the event-definitions surface).'
        schema:
          enum:
          - user
          - company
          - companyMembership
          - eventDefinition
          type: string
      - name: orderBy
        required: false
        in: query
        description: 'Order by createdAt / codeName / displayName (prefix - for descending). Text sorting is case-sensitive (byte order): uppercase sorts before lowercase.'
        schema:
          anyOf:
          - type: string
            enum:
            - createdAt
            - -createdAt
            - codeName
            - -codeName
            - displayName
            - -displayName
          - type: array
            items:
              type: string
              enum:
              - createdAt
              - -createdAt
              - codeName
              - -codeName
              - displayName
              - -displayName
      - name: eventName
        required: false
        in: query
        description: Filter to attributes attached to these event(s), matched by event codeName (EXACT match — not displayName; a displayName silently matches nothing). Multiple values OR together.
        schema:
          anyOf:
          - type: string
          - type: array
            items:
              type: string
      - name: deleted
        required: false
        in: query
        description: List soft-deleted attribute definitions instead of live ones — the recovery pool for restore.
        schema:
          enum:
          - 'true'
          - 'false'
          type: string
      responses:
        '200':
          description: List of attribute definitions
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListAttributeDefinitionsResponseDto'
        '400':
          description: Invalid request — E1017 validation (may carry `issues`; an invalid orderBy/limit is also E1017), E1015 invalid scope, E0003 invalid against current domain state.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '401':
          description: Missing or expired API key — E1010, E1020.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '403':
          description: Refused — E1000 invalid key, E1011 project not in token scope, E1012 insufficient scope, E1029 environment not in token scope, E1032 environment creation needs a token without env-targeted capabilities (its allowlist cannot cover a not-yet-existing environment), E0043 the project's plan does not include the feature (e.g. webhooks require a paid plan on cloud).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '429':
          description: Rate limit exceeded — E1013. The limit follows the project's plan (100/500/1000/3000 requests per minute); unknown credentials share a per-IP bucket. Every response also carries X-RateLimit-Limit / -Remaining / -Reset for pacing; a 429 adds the standard Retry-After header (seconds to back off).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
      tags:
      - Attribute definitions
      security:
      - bearer: []
    post:
      operationId: ApiAttributeDefinitionsController_create
      summary: Create an attribute definition
      parameters:
      - name: projectId
        required: true
        in: path
        description: Project ID
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAttributeBodyDto'
      responses:
        '201':
          description: Attribute definition created — or, when a deleted attribute holds this scope and codeName, that one restored
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AttributeDto'
        '400':
          description: Invalid request — E1017 validation (may carry `issues`; an invalid orderBy/limit is also E1017), E1015 invalid scope, E0003 invalid against current domain state.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '401':
          description: Missing or expired API key — E1010, E1020.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '403':
          description: Refused — E1000 invalid key, E1011 project not in token scope, E1012 insufficient scope, E1029 environment not in token scope, E1032 environment creation needs a token without env-targeted capabilities (its allowlist cannot cover a not-yet-existing environment), E0043 the project's plan does not include the feature (e.g. webhooks require a paid plan on cloud).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '409':
          description: An attribute with this codeName already exists (E1023), or a deleted attribute of another data type holds it (E1045) — restore that one or choose another codeName
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '429':
          description: Rate limit exceeded — E1013. The limit follows the project's plan (100/500/1000/3000 requests per minute); unknown credentials share a per-IP bucket. Every response also carries X-RateLimit-Limit / -Remaining / -Reset for pacing; a 429 adds the standard Retry-After header (seconds to back off).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
      tags:
      - Attribute definitions
      security:
      - bearer: []
  /v2/projects/{projectId}/attribute-definitions/{id}:
    get:
      operationId: ApiAttributeDefinitionsController_get
      summary: Get an attribute definition
      parameters:
      - name: projectId
        required: true
        in: path
        description: Project ID
        schema:
          type: string
      - name: id
        required: true
        in: path
        description: Attribute definition ID
        schema:
          type: string
      responses:
        '200':
          description: Attribute definition found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AttributeDto'
        '400':
          description: Invalid request — E1017 validation (may carry `issues`; an invalid orderBy/limit is also E1017), E1015 invalid scope, E0003 invalid against current domain state.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '401':
          description: Missing or expired API key — E1010, E1020.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '403':
          description: Refused — E1000 invalid key, E1011 project not in token scope, E1012 insufficient scope, E1029 environment not in token scope, E1032 environment creation needs a token without env-targeted capabilities (its allowlist cannot cover a not-yet-existing environment), E0043 the project's plan does not include the feature (e.g. webhooks require a paid plan on cloud).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '404':
          description: Attribute definition not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '429':
          description: Rate limit exceeded — E1013. The limit follows the project's plan (100/500/1000/3000 requests per minute); unknown credentials share a per-IP bucket. Every response also carries X-RateLimit-Limit / -Remaining / -Reset for pacing; a 429 adds the standard Retry-After header (seconds to back off).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
      tags:
      - Attribute definitions
      security:
      - bearer: []
    patch:
      operationId: ApiAttributeDefinitionsController_update
      summary: Update an attribute definition
      parameters:
      - name: projectId
        required: true
        in: path
        description: Project ID
        schema:
          type: string
      - name: id
        required: true
        in: path
        description: Attribute definition ID
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateAttributeBodyDto'
      responses:
        '200':
          description: Attribute definition updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AttributeDto'
        '400':
          description: Invalid request — E1017 validation (may carry `issues`; an invalid orderBy/limit is also E1017), E1015 invalid scope, E0003 invalid against current domain state.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '401':
          description: Missing or expired API key — E1010, E1020.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '403':
          description: Refused — E1000 invalid key, E1011 project not in token scope, E1012 insufficient scope, E1029 environment not in token scope, E1032 environment creation needs a token without env-targeted capabilities (its allowlist cannot cover a not-yet-existing environment), E0043 the project's plan does not include the feature (e.g. webhooks require a paid plan on cloud).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '404':
          description: Attribute definition not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '409':
          description: The definition is predefined (E1036) — it cannot be modified or deleted; create your own definition instead.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '429':
          description: Rate limit exceeded — E1013. The limit follows the project's plan (100/500/1000/3000 requests per minute); unknown credentials share a per-IP bucket. Every response also carries X-RateLimit-Limit / -Remaining / -Reset for pacing; a 429 adds the standard Retry-After header (seconds to back off).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
      tags:
      - Attribute definitions
      security:
      - bearer: []
    delete:
      operationId: ApiAttributeDefinitionsController_remove
      summary: Delete an attribute definition
      description: 'Soft delete: the definition leaves lists and pickers but keeps resolving by id, and can be restored. Refused (E1042) while live or draft content, a segment or a theme uses it.'
      parameters:
      - name: projectId
        required: true
        in: path
        description: Project ID
        schema:
          type: string
      - name: id
        required: true
        in: path
        description: Attribute definition ID
        schema:
          type: string
      responses:
        '204':
          description: Attribute definition deleted
        '400':
          description: Invalid request — E1017 validation (may carry `issues`; an invalid orderBy/limit is also E1017), E1015 invalid scope, E0003 invalid against current domain state.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '401':
          description: Missing or expired API key — E1010, E1020.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '403':
          description: Refused — E1000 invalid key, E1011 project not in token scope, E1012 insufficient scope, E1029 environment not in token scope, E1032 environment creation needs a token without env-targeted capabilities (its allowlist cannot cover a not-yet-existing environment), E0043 the project's plan does not include the feature (e.g. webhooks require a paid plan on cloud).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '404':
          description: Attribute definition not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '409':
          description: The definition is predefined (E1036) — it cannot be modified or deleted; create your own definition instead. Or it is in use (E1042) by live or draft content, a segment or a theme — the message names them; remove it from them first.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '429':
          description: Rate limit exceeded — E1013. The limit follows the project's plan (100/500/1000/3000 requests per minute); unknown credentials share a per-IP bucket. Every response also carries X-RateLimit-Limit / -Remaining / -Reset for pacing; a 429 adds the standard Retry-After header (seconds to back off).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
      tags:
      - Attribute definitions
      security:
      - bearer: []
  /v2/projects/{projectId}/attribute-definitions/{id}/restore:
    post:
      operationId: ApiAttributeDefinitionsController_restore
      summary: Restore a deleted attribute definition
      description: Bring a soft-deleted attribute definition back as it was (find it via GET /attribute-definitions?deleted=true), so conditions that referenced it resolve again. Creating an attribute with the same scope and codeName restores it too. Idempotent on a definition that is not deleted.
      parameters:
      - name: projectId
        required: true
        in: path
        description: Project ID
        schema:
          type: string
      - name: id
        required: true
        in: path
        description: Attribute definition ID
        schema:
          type: string
      responses:
        '200':
          description: Restored attribute definition
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AttributeDto'
        '400':
          description: Invalid request — E1017 validation (may carry `issues`; an invalid orderBy/limit is also E1017), E1015 invalid scope, E0003 invalid against current domain state.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '401':
          description: Missing or expired API key — E1010, E1020.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '403':
          description: Refused — E1000 invalid key, E1011 project not in token scope, E1012 insufficient scope, E1029 environment not in token scope, E1032 environment creation needs a token without env-targeted capabilities (its allowlist cannot cover a not-yet-existing environment), E0043 the project's plan does not include the feature (e.g. webhooks require a paid plan on cloud).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '404':
          description: Attribute definition not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '429':
          description: Rate limit exceeded — E1013. The limit follows the project's plan (100/500/1000/3000 requests per minute); unknown credentials share a per-IP bucket. Every response also carries X-RateLimit-Limit / -Remaining / -Reset for pacing; a 429 adds the standard Retry-After header (seconds to back off).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
      tags:
      - Attribute definitions
      security:
      - bearer: []
components:
  schemas:
    UpdateAttributeBodyDto:
      type: object
      properties:
        displayName:
          description: Human-readable name.
          type: string
          minLength: 1
        description:
          description: Optional description.
          type: string
        dataType:
          description: Change the attribute's value type. Allowed only while NO stored value would conflict with the new type (else rejected — clear the conflicting values, or delete + recreate). Fixes a wrong type inferred from a first mistyped upsert. `scope` and `codeName` stay immutable; a random bucketing type can neither be changed into nor out of.
          type: string
          enum:
          - number
          - string
          - boolean
          - list
          - datetime
          - random_ab
          - random_number
      additionalProperties: false
    ErrorResponseDto:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Stable machine-readable code (e.g. E1017). Match on this, never on `message`.
            message:
              type: string
              description: Human-readable summary. Wording may change between releases.
            issues:
              description: Validation errors (E1017) may carry one entry per problem so every field can be fixed in a single round-trip. Absent on other errors.
              type: array
              items:
                type: object
                properties:
                  rule:
                    type: string
                    description: 'Which validation layer rejected it: schema | reactive_condition | action_not_allowed | step_shape | reference_target | auto_start | media_url | destination_url. New values may be added; treat an unknown value as a generic validation failure.'
                  message:
                    type: string
                  path:
                    description: Path into the request body (e.g. `steps[0].triggers[0].when[1]`).
                    type: string
                required:
                - rule
                - message
            doc_url:
              type: string
              description: Base URL of the API documentation.
      required:
      - error
    AttributeDto:
      type: object
      properties:
        id:
          type: string
        object:
          type: string
          enum:
          - attributeDefinition
        predefined:
          type: boolean
          description: 'Built-in attribute shipped by Usertour: it cannot be edited or deleted.'
        createdAt:
          type: string
          format: date-time
        dataType:
          type: string
          enum:
          - number
          - string
          - boolean
          - list
          - datetime
          - random_ab
          - random_number
          description: 'Value type. `random_ab` / `random_number` are SYSTEM-GENERATED bucketing types: each user (or company) is assigned a stable value — `A`/`B`, or an integer in [1, randomMax] — for A/B tests and canary rollouts. Their values cannot be written; their type and range are locked after creation.'
        randomMax:
          type:
          - integer
          - 'null'
          minimum: -9007199254740991
          maximum: 9007199254740991
          description: Upper bound of a `random_number` attribute (values are 1..randomMax); null otherwise.
        description:
          type: string
        displayName:
          type: string
        codeName:
          type: string
        scope:
          type: string
          enum:
          - user
          - company
          - companyMembership
          - eventDefinition
          description: Which object the attribute belongs to. `eventDefinition` = an event attribute (attach it to events via the event-definitions surface).
      required:
      - id
      - object
      - predefined
      - createdAt
      - dataType
      - randomMax
      - description
      - displayName
      - codeName
      - scope
    CreateAttributeBodyDto:
      type: object
      properties:
        scope:
          type: string
          enum:
          - user
          - company
          - companyMembership
          - eventDefinition
          description: 'Which object the attribute belongs to: user, company, companyMembership, or eventDefinition (an event attribute — pre-defines an event property; attach it to events via the event-definitions surface. Tracking also auto-registers event properties at ingestion, so pre-defining is only needed to pin the type or attach before the first track).'
        dataType:
          type: string
          enum:
          - number
          - string
          - boolean
          - list
          - datetime
          - random_ab
          - random_number
          description: The attribute value type. `random_ab` / `random_number` (user and company scope only) are assigned by Usertour per entity, stable for life, and cannot be written.
        randomMax:
          description: 'Required for `random_number`: values are assigned in 1..randomMax. Ignored for other types. Locked after creation.'
          type: integer
          minimum: 2
          maximum: 10000
        codeName:
          type: string
          minLength: 2
          maxLength: 100
          pattern: ^[a-zA-Z][a-zA-Z0-9_]*$
          description: Stable identifier, unique per project + scope. Immutable. Must start with a letter, then letters/digits/underscores, 2–100 chars.
        displayName:
          type: string
          minLength: 1
          description: Human-readable name.
        description:
          description: Optional description.
          type: string
      required:
      - scope
      - dataType
      - codeName
      - displayName
      additionalProperties: false
    ListAttributeDefinitionsResponseDto:
      type: object
      properties:
        results:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              object:
                type: string
                enum:
                - attributeDefinition
              predefined:
                type: boolean
                description: 'Built-in attribute shipped by Usertour: it cannot be edited or deleted.'
              createdAt:
                type: string
                format: date-time
              dataType:
                type: string
                enum:
                - number
                - string
                - boolean
                - list
                - datetime
                - random_ab
                - random_number
                description: 'Value type. `random_ab` / `random_number` are SYSTEM-GENERATED bucketing types: each user (or company) is assigned a stable value — `A`/`B`, or an integer in [1, randomMax] — for A/B tests and canary rollouts. Their values cannot be written; their type and range are locked after creation.'
              randomMax:
                type:
                - integer
                - 'null'
                minimum: -9007199254740991
                maximum: 9007199254740991
                description: Upper bound of a `random_number` attribute (values are 1..randomMax); null otherwise.
              description:
                type: string
              displayName:
                type: string
              codeName:
                type: string
              scope:
                type: string
                enum:
                - user
                - company
                - companyMembership
                - eventDefinition
                description: Which object the attribute belongs to. `eventDefinition` = an event attribute (attach it to events via the event-definitions surface).
            required:
            - id
            - object
            - predefined
            - createdAt
            - dataType
            - randomMax
            - description
            - displayName
            - codeName
            - scope
        next:
          type:
          - string
          - 'null'
          description: Full URL of the next page — request it as-is (it already carries `cursor=` and your query parameters). null = no further pages.
        previous:
          type:
          - string
          - 'null'
          description: Full URL of the previous page — request it as-is. null = already at the first page.
      required:
      - results
      - next
      - previous
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: utp_... personal API token (opaque)
      type: http