naftiko: 1.0.0-alpha2 info: label: PostHog API — query description: 'PostHog API — query. 16 operations. Lead operation: query. Self-contained Naftiko capability covering one Posthog business surface.' tags: - Posthog - query created: '2026-05-19' modified: '2026-05-19' binds: - namespace: env keys: POSTHOG_API_KEY: POSTHOG_API_KEY capability: consumes: - type: http namespace: posthog-query baseUri: '' description: PostHog API — query business capability. Self-contained, no shared references. resources: - name: api-environments-environment_id-query path: /api/environments/{environment_id}/query/ operations: - name: environmentsquerycreate method: POST description: DRF ViewSet mixin that gates coalesced responses behind permission checks. outputRawFormat: json outputParameters: - name: result type: object value: $. inputParameters: - name: body in: body type: object description: Request body (JSON). required: true - name: api-environments-environment_id-query-check_auth_for_async path: /api/environments/{environment_id}/query/check_auth_for_async/ operations: - name: environmentsquerycheckauthforasynccreate method: POST description: DRF ViewSet mixin that gates coalesced responses behind permission checks. outputRawFormat: json outputParameters: - name: result type: object value: $. - name: api-environments-environment_id-query-draft_sql path: /api/environments/{environment_id}/query/draft_sql/ operations: - name: environmentsquerydraftsqlretrieve method: GET description: DRF ViewSet mixin that gates coalesced responses behind permission checks. outputRawFormat: json outputParameters: - name: result type: object value: $. - name: api-environments-environment_id-query-upgrade path: /api/environments/{environment_id}/query/upgrade/ operations: - name: environmentsqueryupgradecreate method: POST description: Upgrades a query without executing it. Returns a query with all nodes migrated to the latest version. outputRawFormat: json outputParameters: - name: result type: object value: $. inputParameters: - name: body in: body type: object description: Request body (JSON). required: true - name: api-environments-environment_id-query-id path: /api/environments/{environment_id}/query/{id}/ operations: - name: environmentsqueryretrieve method: GET description: (Experimental) outputRawFormat: json outputParameters: - name: result type: object value: $. inputParameters: - name: id in: path type: string required: true - name: environmentsquerydestroy method: DELETE description: (Experimental) outputRawFormat: json outputParameters: - name: result type: object value: $. inputParameters: - name: id in: path type: string required: true - name: api-environments-environment_id-query-id-log path: /api/environments/{environment_id}/query/{id}/log/ operations: - name: environmentsquerylogretrieve method: GET description: Get query log details from query_log_archive table for a specific query_id, the query must have been issued in last 24 hours. outputRawFormat: json outputParameters: - name: result type: object value: $. inputParameters: - name: id in: path type: string required: true - name: api-environments-environment_id-query-query_kind path: /api/environments/{environment_id}/query/{query_kind}/ operations: - name: environmentsquerycreatewithkind method: POST description: DRF ViewSet mixin that gates coalesced responses behind permission checks. outputRawFormat: json outputParameters: - name: result type: object value: $. inputParameters: - name: query_kind in: path type: string required: true - name: api-projects-project_id-query path: /api/projects/{project_id}/query/ operations: - name: querycreate method: POST description: DRF ViewSet mixin that gates coalesced responses behind permission checks. outputRawFormat: json outputParameters: - name: result type: object value: $. inputParameters: - name: body in: body type: object description: Request body (JSON). required: true - name: api-projects-project_id-query-check_auth_for_async path: /api/projects/{project_id}/query/check_auth_for_async/ operations: - name: querycheckauthforasynccreate method: POST description: DRF ViewSet mixin that gates coalesced responses behind permission checks. outputRawFormat: json outputParameters: - name: result type: object value: $. - name: api-projects-project_id-query-draft_sql path: /api/projects/{project_id}/query/draft_sql/ operations: - name: querydraftsqlretrieve method: GET description: DRF ViewSet mixin that gates coalesced responses behind permission checks. outputRawFormat: json outputParameters: - name: result type: object value: $. - name: api-projects-project_id-query-upgrade path: /api/projects/{project_id}/query/upgrade/ operations: - name: queryupgradecreate method: POST description: Upgrades a query without executing it. Returns a query with all nodes migrated to the latest version. outputRawFormat: json outputParameters: - name: result type: object value: $. inputParameters: - name: body in: body type: object description: Request body (JSON). required: true - name: api-projects-project_id-query-id path: /api/projects/{project_id}/query/{id}/ operations: - name: queryretrieve method: GET description: (Experimental) outputRawFormat: json outputParameters: - name: result type: object value: $. inputParameters: - name: id in: path type: string required: true - name: querydestroy method: DELETE description: (Experimental) outputRawFormat: json outputParameters: - name: result type: object value: $. inputParameters: - name: id in: path type: string required: true - name: api-projects-project_id-query-id-log path: /api/projects/{project_id}/query/{id}/log/ operations: - name: querylogretrieve method: GET description: Get query log details from query_log_archive table for a specific query_id, the query must have been issued in last 24 hours. outputRawFormat: json outputParameters: - name: result type: object value: $. inputParameters: - name: id in: path type: string required: true - name: api-projects-project_id-query-query_kind path: /api/projects/{project_id}/query/{query_kind}/ operations: - name: querycreatewithkind method: POST description: DRF ViewSet mixin that gates coalesced responses behind permission checks. outputRawFormat: json outputParameters: - name: result type: object value: $. inputParameters: - name: query_kind in: path type: string required: true authentication: type: bearer token: '{{env.POSTHOG_API_KEY}}' exposes: - type: rest namespace: posthog-query-rest port: 8080 description: REST adapter for PostHog API — query. One Spectral-compliant resource per consumed operation, prefixed with /v1. resources: - path: /v1/api/environments/{environment-id}/query name: api-environments-environment-id-query description: REST surface for api-environments-environment_id-query. operations: - method: POST name: environmentsquerycreate description: DRF ViewSet mixin that gates coalesced responses behind permission checks. call: posthog-query.environmentsquerycreate with: body: rest.body outputParameters: - type: object mapping: $. - path: /v1/api/environments/{environment-id}/query/check-auth-for-async name: api-environments-environment-id-query-check-auth-for-async description: REST surface for api-environments-environment_id-query-check_auth_for_async. operations: - method: POST name: environmentsquerycheckauthforasynccreate description: DRF ViewSet mixin that gates coalesced responses behind permission checks. call: posthog-query.environmentsquerycheckauthforasynccreate outputParameters: - type: object mapping: $. - path: /v1/api/environments/{environment-id}/query/draft-sql name: api-environments-environment-id-query-draft-sql description: REST surface for api-environments-environment_id-query-draft_sql. operations: - method: GET name: environmentsquerydraftsqlretrieve description: DRF ViewSet mixin that gates coalesced responses behind permission checks. call: posthog-query.environmentsquerydraftsqlretrieve outputParameters: - type: object mapping: $. - path: /v1/api/environments/{environment-id}/query/upgrade name: api-environments-environment-id-query-upgrade description: REST surface for api-environments-environment_id-query-upgrade. operations: - method: POST name: environmentsqueryupgradecreate description: Upgrades a query without executing it. Returns a query with all nodes migrated to the latest version. call: posthog-query.environmentsqueryupgradecreate with: body: rest.body outputParameters: - type: object mapping: $. - path: /v1/api/environments/{environment-id}/query/{id} name: api-environments-environment-id-query-id description: REST surface for api-environments-environment_id-query-id. operations: - method: GET name: environmentsqueryretrieve description: (Experimental) call: posthog-query.environmentsqueryretrieve with: id: rest.id outputParameters: - type: object mapping: $. - method: DELETE name: environmentsquerydestroy description: (Experimental) call: posthog-query.environmentsquerydestroy with: id: rest.id outputParameters: - type: object mapping: $. - path: /v1/api/environments/{environment-id}/query/{id}/log name: api-environments-environment-id-query-id-log description: REST surface for api-environments-environment_id-query-id-log. operations: - method: GET name: environmentsquerylogretrieve description: Get query log details from query_log_archive table for a specific query_id, the query must have been issued in last 24 hours. call: posthog-query.environmentsquerylogretrieve with: id: rest.id outputParameters: - type: object mapping: $. - path: /v1/api/environments/{environment-id}/query/{query-kind} name: api-environments-environment-id-query-query-kind description: REST surface for api-environments-environment_id-query-query_kind. operations: - method: POST name: environmentsquerycreatewithkind description: DRF ViewSet mixin that gates coalesced responses behind permission checks. call: posthog-query.environmentsquerycreatewithkind with: query_kind: rest.query_kind outputParameters: - type: object mapping: $. - path: /v1/api/projects/{project-id}/query name: api-projects-project-id-query description: REST surface for api-projects-project_id-query. operations: - method: POST name: querycreate description: DRF ViewSet mixin that gates coalesced responses behind permission checks. call: posthog-query.querycreate with: body: rest.body outputParameters: - type: object mapping: $. - path: /v1/api/projects/{project-id}/query/check-auth-for-async name: api-projects-project-id-query-check-auth-for-async description: REST surface for api-projects-project_id-query-check_auth_for_async. operations: - method: POST name: querycheckauthforasynccreate description: DRF ViewSet mixin that gates coalesced responses behind permission checks. call: posthog-query.querycheckauthforasynccreate outputParameters: - type: object mapping: $. - path: /v1/api/projects/{project-id}/query/draft-sql name: api-projects-project-id-query-draft-sql description: REST surface for api-projects-project_id-query-draft_sql. operations: - method: GET name: querydraftsqlretrieve description: DRF ViewSet mixin that gates coalesced responses behind permission checks. call: posthog-query.querydraftsqlretrieve outputParameters: - type: object mapping: $. - path: /v1/api/projects/{project-id}/query/upgrade name: api-projects-project-id-query-upgrade description: REST surface for api-projects-project_id-query-upgrade. operations: - method: POST name: queryupgradecreate description: Upgrades a query without executing it. Returns a query with all nodes migrated to the latest version. call: posthog-query.queryupgradecreate with: body: rest.body outputParameters: - type: object mapping: $. - path: /v1/api/projects/{project-id}/query/{id} name: api-projects-project-id-query-id description: REST surface for api-projects-project_id-query-id. operations: - method: GET name: queryretrieve description: (Experimental) call: posthog-query.queryretrieve with: id: rest.id outputParameters: - type: object mapping: $. - method: DELETE name: querydestroy description: (Experimental) call: posthog-query.querydestroy with: id: rest.id outputParameters: - type: object mapping: $. - path: /v1/api/projects/{project-id}/query/{id}/log name: api-projects-project-id-query-id-log description: REST surface for api-projects-project_id-query-id-log. operations: - method: GET name: querylogretrieve description: Get query log details from query_log_archive table for a specific query_id, the query must have been issued in last 24 hours. call: posthog-query.querylogretrieve with: id: rest.id outputParameters: - type: object mapping: $. - path: /v1/api/projects/{project-id}/query/{query-kind} name: api-projects-project-id-query-query-kind description: REST surface for api-projects-project_id-query-query_kind. operations: - method: POST name: querycreatewithkind description: DRF ViewSet mixin that gates coalesced responses behind permission checks. call: posthog-query.querycreatewithkind with: query_kind: rest.query_kind outputParameters: - type: object mapping: $. - type: mcp namespace: posthog-query-mcp port: 9090 transport: http description: MCP adapter for PostHog API — query. One tool per consumed operation, routed inline through this capability's consumes block. tools: - name: drf-viewset-mixin-that-gates description: DRF ViewSet mixin that gates coalesced responses behind permission checks. hints: readOnly: false destructive: false idempotent: false call: posthog-query.environmentsquerycreate with: body: tools.body outputParameters: - type: object mapping: $. - name: drf-viewset-mixin-that-gates-2 description: DRF ViewSet mixin that gates coalesced responses behind permission checks. hints: readOnly: false destructive: false idempotent: false call: posthog-query.environmentsquerycheckauthforasynccreate outputParameters: - type: object mapping: $. - name: drf-viewset-mixin-that-gates-3 description: DRF ViewSet mixin that gates coalesced responses behind permission checks. hints: readOnly: true destructive: false idempotent: true call: posthog-query.environmentsquerydraftsqlretrieve outputParameters: - type: object mapping: $. - name: upgrades-query-without-executing-it description: Upgrades a query without executing it. Returns a query with all nodes migrated to the latest version. hints: readOnly: true destructive: false idempotent: false call: posthog-query.environmentsqueryupgradecreate with: body: tools.body outputParameters: - type: object mapping: $. - name: experimental description: (Experimental) hints: readOnly: true destructive: false idempotent: true call: posthog-query.environmentsqueryretrieve with: id: tools.id outputParameters: - type: object mapping: $. - name: experimental-2 description: (Experimental) hints: readOnly: false destructive: true idempotent: true call: posthog-query.environmentsquerydestroy with: id: tools.id outputParameters: - type: object mapping: $. - name: get-query-log-details-query description: Get query log details from query_log_archive table for a specific query_id, the query must have been issued in last 24 hours. hints: readOnly: true destructive: false idempotent: true call: posthog-query.environmentsquerylogretrieve with: id: tools.id outputParameters: - type: object mapping: $. - name: drf-viewset-mixin-that-gates-4 description: DRF ViewSet mixin that gates coalesced responses behind permission checks. hints: readOnly: false destructive: false idempotent: false call: posthog-query.environmentsquerycreatewithkind with: query_kind: tools.query_kind outputParameters: - type: object mapping: $. - name: drf-viewset-mixin-that-gates-5 description: DRF ViewSet mixin that gates coalesced responses behind permission checks. hints: readOnly: false destructive: false idempotent: false call: posthog-query.querycreate with: body: tools.body outputParameters: - type: object mapping: $. - name: drf-viewset-mixin-that-gates-6 description: DRF ViewSet mixin that gates coalesced responses behind permission checks. hints: readOnly: false destructive: false idempotent: false call: posthog-query.querycheckauthforasynccreate outputParameters: - type: object mapping: $. - name: drf-viewset-mixin-that-gates-7 description: DRF ViewSet mixin that gates coalesced responses behind permission checks. hints: readOnly: true destructive: false idempotent: true call: posthog-query.querydraftsqlretrieve outputParameters: - type: object mapping: $. - name: upgrades-query-without-executing-it-2 description: Upgrades a query without executing it. Returns a query with all nodes migrated to the latest version. hints: readOnly: true destructive: false idempotent: false call: posthog-query.queryupgradecreate with: body: tools.body outputParameters: - type: object mapping: $. - name: experimental-3 description: (Experimental) hints: readOnly: true destructive: false idempotent: true call: posthog-query.queryretrieve with: id: tools.id outputParameters: - type: object mapping: $. - name: experimental-4 description: (Experimental) hints: readOnly: false destructive: true idempotent: true call: posthog-query.querydestroy with: id: tools.id outputParameters: - type: object mapping: $. - name: get-query-log-details-query-2 description: Get query log details from query_log_archive table for a specific query_id, the query must have been issued in last 24 hours. hints: readOnly: true destructive: false idempotent: true call: posthog-query.querylogretrieve with: id: tools.id outputParameters: - type: object mapping: $. - name: drf-viewset-mixin-that-gates-8 description: DRF ViewSet mixin that gates coalesced responses behind permission checks. hints: readOnly: false destructive: false idempotent: false call: posthog-query.querycreatewithkind with: query_kind: tools.query_kind outputParameters: - type: object mapping: $.