PostHog property_definitions API

The property_definitions API from PostHog — 4 operation(s) for property_definitions.

OpenAPI Specification

posthog-property-definitions-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: PostHog actions property_definitions API
  version: 1.0.0
  description: ''
tags:
- name: property_definitions
paths:
  /api/projects/{project_id}/property_definitions/:
    get:
      operationId: property_definitions_list
      parameters:
      - in: query
        name: event_names
        schema:
          type: string
          minLength: 1
        description: If sent, response value will have `is_seen_on_filtered_events` populated. JSON-encoded
      - in: query
        name: exclude_core_properties
        schema:
          type: boolean
          default: false
        description: Whether to exclude core properties
      - in: query
        name: exclude_hidden
        schema:
          type: boolean
          default: false
        description: Whether to exclude properties marked as hidden
      - in: query
        name: excluded_properties
        schema:
          type: string
          minLength: 1
        description: JSON-encoded list of excluded properties
      - in: query
        name: filter_by_event_names
        schema:
          type: boolean
          nullable: true
        description: Whether to return only properties for events in `event_names`
      - in: query
        name: group_type_index
        schema:
          type: integer
        description: What group type is the property for. Only should be set if `type=group`
      - in: query
        name: is_feature_flag
        schema:
          type: boolean
          nullable: true
        description: Whether to return only (or excluding) feature flag properties
      - in: query
        name: is_numerical
        schema:
          type: boolean
          nullable: true
        description: Whether to return only (or excluding) numerical property definitions
      - name: limit
        required: false
        in: query
        description: Number of results to return per page.
        schema:
          type: integer
      - name: offset
        required: false
        in: query
        description: The initial index from which to return the results.
        schema:
          type: integer
      - $ref: '#/components/parameters/ProjectIdPath'
      - in: query
        name: properties
        schema:
          type: string
          minLength: 1
        description: Comma-separated list of properties to filter
      - in: query
        name: search
        schema:
          type: string
        description: Searches properties by name
      - in: query
        name: type
        schema:
          enum:
          - event
          - person
          - group
          - session
          type: string
          default: event
          minLength: 1
        description: 'What property definitions to return


          * `event` - event

          * `person` - person

          * `group` - group

          * `session` - session'
      - in: query
        name: verified
        schema:
          type: boolean
          nullable: true
        description: Filter by verified status. True returns only verified, false returns only unverified.
      tags:
      - property_definitions
      security:
      - PersonalAPIKeyAuth:
        - property_definition:read
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedEnterprisePropertyDefinitionList'
          description: ''
      x-explicit-tags:
      - core
  /api/projects/{project_id}/property_definitions/{id}/:
    get:
      operationId: property_definitions_retrieve
      parameters:
      - in: path
        name: id
        schema:
          type: string
          format: uuid
        description: A UUID string identifying this property definition.
        required: true
      - $ref: '#/components/parameters/ProjectIdPath'
      tags:
      - property_definitions
      security:
      - PersonalAPIKeyAuth:
        - property_definition:read
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EnterprisePropertyDefinition'
          description: ''
      x-explicit-tags:
      - core
    put:
      operationId: property_definitions_update
      parameters:
      - in: path
        name: id
        schema:
          type: string
          format: uuid
        description: A UUID string identifying this property definition.
        required: true
      - $ref: '#/components/parameters/ProjectIdPath'
      tags:
      - property_definitions
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EnterprisePropertyDefinition'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/EnterprisePropertyDefinition'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/EnterprisePropertyDefinition'
      security:
      - PersonalAPIKeyAuth:
        - property_definition:write
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EnterprisePropertyDefinition'
          description: ''
      x-explicit-tags:
      - core
    patch:
      operationId: property_definitions_partial_update
      parameters:
      - in: path
        name: id
        schema:
          type: string
          format: uuid
        description: A UUID string identifying this property definition.
        required: true
      - $ref: '#/components/parameters/ProjectIdPath'
      tags:
      - property_definitions
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchedEnterprisePropertyDefinition'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/PatchedEnterprisePropertyDefinition'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/PatchedEnterprisePropertyDefinition'
      security:
      - PersonalAPIKeyAuth:
        - property_definition:write
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EnterprisePropertyDefinition'
          description: ''
      x-explicit-tags:
      - core
    delete:
      operationId: property_definitions_destroy
      parameters:
      - in: path
        name: id
        schema:
          type: string
          format: uuid
        description: A UUID string identifying this property definition.
        required: true
      - $ref: '#/components/parameters/ProjectIdPath'
      tags:
      - property_definitions
      security:
      - PersonalAPIKeyAuth:
        - property_definition:write
      responses:
        '204':
          description: No response body
      x-explicit-tags:
      - core
  /api/projects/{project_id}/property_definitions/bulk_update_tags/:
    post:
      operationId: property_definitions_bulk_update_tags_create
      description: 'Bulk update tags on multiple objects.


        Accepts:

        - {"ids": [...], "action": "add"|"remove"|"set", "tags": ["tag1", "tag2"]}


        Actions:

        - "add": Add tags to existing tags on each object

        - "remove": Remove specific tags from each object

        - "set": Replace all tags on each object with the provided list'
      parameters:
      - $ref: '#/components/parameters/ProjectIdPath'
      tags:
      - property_definitions
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkUpdateTagsRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/BulkUpdateTagsRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/BulkUpdateTagsRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkUpdateTagsResponse'
          description: ''
      x-explicit-tags:
      - core
  /api/projects/{project_id}/property_definitions/seen_together/:
    get:
      operationId: property_definitions_seen_together_retrieve
      description: 'Allows a caller to provide a list of event names and a single property name

        Returns a map of the event names to a boolean representing whether that property has ever been seen with that event_name'
      parameters:
      - $ref: '#/components/parameters/ProjectIdPath'
      tags:
      - property_definitions
      security:
      - PersonalAPIKeyAuth:
        - property_definition:read
      responses:
        '200':
          description: No response body
      x-explicit-tags:
      - core
components:
  schemas:
    BulkUpdateTagsResponse:
      type: object
      properties:
        updated:
          type: array
          items:
            $ref: '#/components/schemas/BulkUpdateTagsItem'
        skipped:
          type: array
          items:
            $ref: '#/components/schemas/BulkUpdateTagsError'
      required:
      - skipped
      - updated
    EnterprisePropertyDefinition:
      type: object
      description: Serializer mixin that handles tags for objects.
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        name:
          type: string
          readOnly: true
        description:
          type: string
          nullable: true
        tags:
          type: array
          items: {}
        is_numerical:
          type: boolean
          readOnly: true
        updated_at:
          type: string
          format: date-time
          readOnly: true
        updated_by:
          allOf:
          - $ref: '#/components/schemas/UserBasic'
          readOnly: true
        is_seen_on_filtered_events:
          type: boolean
          readOnly: true
          nullable: true
        property_type:
          nullable: true
          oneOf:
          - $ref: '#/components/schemas/PropertyDefinitionTypeEnum'
          - $ref: '#/components/schemas/BlankEnum'
          - $ref: '#/components/schemas/NullEnum'
        verified:
          type: boolean
        verified_at:
          type: string
          format: date-time
          readOnly: true
          nullable: true
        verified_by:
          allOf:
          - $ref: '#/components/schemas/UserBasic'
          readOnly: true
        hidden:
          type: boolean
          nullable: true
      required:
      - id
      - is_numerical
      - is_seen_on_filtered_events
      - name
      - updated_at
      - updated_by
      - verified_at
      - verified_by
    PropertyDefinitionTypeEnum:
      enum:
      - DateTime
      - String
      - Numeric
      - Boolean
      - Duration
      type: string
      description: '* `DateTime` - DateTime

        * `String` - String

        * `Numeric` - Numeric

        * `Boolean` - Boolean

        * `Duration` - Duration'
    BlankEnum:
      enum:
      - ''
    PaginatedEnterprisePropertyDefinitionList:
      type: object
      required:
      - count
      - results
      properties:
        count:
          type: integer
          example: 123
        next:
          type: string
          nullable: true
          format: uri
          example: http://api.example.org/accounts/?offset=400&limit=100
        previous:
          type: string
          nullable: true
          format: uri
          example: http://api.example.org/accounts/?offset=200&limit=100
        results:
          type: array
          items:
            $ref: '#/components/schemas/EnterprisePropertyDefinition'
    BulkUpdateTagsError:
      type: object
      properties:
        id:
          type: integer
        reason:
          type: string
      required:
      - id
      - reason
    UserBasic:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        uuid:
          type: string
          format: uuid
          readOnly: true
        distinct_id:
          type: string
          nullable: true
          maxLength: 200
        first_name:
          type: string
          maxLength: 150
        last_name:
          type: string
          maxLength: 150
        email:
          type: string
          format: email
          title: Email address
          maxLength: 254
        is_email_verified:
          type: boolean
          nullable: true
        hedgehog_config:
          type: object
          additionalProperties: true
          nullable: true
          readOnly: true
        role_at_organization:
          nullable: true
          oneOf:
          - $ref: '#/components/schemas/RoleAtOrganizationEnum'
          - $ref: '#/components/schemas/BlankEnum'
          - $ref: '#/components/schemas/NullEnum'
      required:
      - email
      - hedgehog_config
      - id
      - uuid
    PatchedEnterprisePropertyDefinition:
      type: object
      description: Serializer mixin that handles tags for objects.
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        name:
          type: string
          readOnly: true
        description:
          type: string
          nullable: true
        tags:
          type: array
          items: {}
        is_numerical:
          type: boolean
          readOnly: true
        updated_at:
          type: string
          format: date-time
          readOnly: true
        updated_by:
          allOf:
          - $ref: '#/components/schemas/UserBasic'
          readOnly: true
        is_seen_on_filtered_events:
          type: boolean
          readOnly: true
          nullable: true
        property_type:
          nullable: true
          oneOf:
          - $ref: '#/components/schemas/PropertyDefinitionTypeEnum'
          - $ref: '#/components/schemas/BlankEnum'
          - $ref: '#/components/schemas/NullEnum'
        verified:
          type: boolean
        verified_at:
          type: string
          format: date-time
          readOnly: true
          nullable: true
        verified_by:
          allOf:
          - $ref: '#/components/schemas/UserBasic'
          readOnly: true
        hidden:
          type: boolean
          nullable: true
    BulkUpdateTagsItem:
      type: object
      properties:
        id:
          type: integer
        tags:
          type: array
          items:
            type: string
      required:
      - id
      - tags
    ActionEnum:
      enum:
      - add
      - remove
      - set
      type: string
      description: '* `add` - add

        * `remove` - remove

        * `set` - set'
    RoleAtOrganizationEnum:
      enum:
      - engineering
      - data
      - product
      - founder
      - leadership
      - marketing
      - sales
      - other
      type: string
      description: '* `engineering` - Engineering

        * `data` - Data

        * `product` - Product Management

        * `founder` - Founder

        * `leadership` - Leadership

        * `marketing` - Marketing

        * `sales` - Sales / Success

        * `other` - Other'
    BulkUpdateTagsRequest:
      type: object
      properties:
        ids:
          type: array
          items:
            type: integer
          description: List of object IDs to update tags on.
          maxItems: 500
        action:
          allOf:
          - $ref: '#/components/schemas/ActionEnum'
          description: '''add'' merges with existing tags, ''remove'' deletes specific tags, ''set'' replaces all tags.


            * `add` - add

            * `remove` - remove

            * `set` - set'
        tags:
          type: array
          items:
            type: string
          description: Tag names to add, remove, or set.
      required:
      - action
      - ids
      - tags
    NullEnum:
      enum:
      - null
  parameters:
    ProjectIdPath:
      in: path
      name: project_id
      required: true
      schema:
        type: string
      description: Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
  securitySchemes:
    PersonalAPIKeyAuth:
      type: http
      scheme: bearer
x-tagGroups:
- name: All endpoints
  tags:
  - LLM Analytics
  - actions
  - activity_log
  - activity_logs
  - advanced_activity_logs
  - alerts
  - annotations
  - approval_policies
  - batch_exports
  - cdp
  - change_requests
  - code
  - code-invites
  - cohorts
  - comments
  - conversations
  - core
  - customer_analytics
  - customer_journeys
  - customer_profile_configs
  - dashboard_templates
  - dashboards
  - data_color_themes
  - data_modeling_jobs
  - data_warehouse
  - dataset_items
  - datasets
  - desktop_recordings
  - domains
  - early_access_feature
  - early_access_features
  - elements
  - endpoints
  - environments
  - error_tracking
  - evaluation_runs
  - evaluations
  - event_definitions
  - event_filter
  - event_schemas
  - events
  - experiment_holdouts
  - experiment_saved_metrics
  - experiments
  - exports
  - external_data_schemas
  - external_data_sources
  - feature_flags
  - file_system
  - file_system_shortcut
  - flag_value
  - groups
  - groups_types
  - health_issues
  - heatmap_screenshots
  - heatmaps
  - hog_flows
  - hog_function_templates
  - hog_functions
  - insight_variables
  - insights
  - integrations
  - invites
  - js-snippet
  - legal_documents
  - lineage
  - live_debugger_breakpoints
  - llm_analytics
  - llm_prompts
  - llm_skills
  - logs
  - managed_viewsets
  - max
  - max_tools
  - mcp_server_installations
  - mcp_servers
  - mcp_store
  - mcp_tools
  - members
  - notebooks
  - oauth_applications
  - object_media_previews
  - organizations
  - persisted_folder
  - persons
  - platform_features
  - plugin_configs
  - product_analytics
  - product_tours
  - project_secret_api_keys
  - projects
  - property_definitions
  - proxy_records
  - public_hog_function_templates
  - query
  - replay
  - reverse_proxy
  - role_external_references
  - roles
  - sandbox-environments
  - sandbox_environments
  - saved
  - schema_property_groups
  - sdk_doctor
  - session_group_summaries
  - session_recording_playlists
  - session_recordings
  - session_summaries
  - sessions
  - signals
  - subscriptions
  - surveys
  - taggers
  - task-automations
  - task-runs
  - task_automations
  - tasks
  - uploaded_media
  - user_home_settings
  - user_interviews
  - users
  - visual_review
  - warehouse_dag
  - warehouse_model_paths
  - warehouse_saved_queries
  - warehouse_saved_query_folders
  - warehouse_tables
  - warehouse_view_link
  - warehouse_view_links
  - web_analytics
  - web_experiments
  - web_vitals
  - welcome
  - workflows