PostHog · Capability

PostHog API — cohorts

PostHog API — cohorts. 12 operations. Lead operation: cohorts. Self-contained Naftiko capability covering one Posthog business surface.

Run with Naftiko Posthogcohorts

What You Can Do

GET
Cohortslist — cohortslist
/v1/api/projects/{project-id}/cohorts
POST
Cohortscreate — cohortscreate
/v1/api/projects/{project-id}/cohorts
GET
Cohortsallactivityretrieve — cohortsallactivityretrieve
/v1/api/projects/{project-id}/cohorts/activity
GET
Cohortsretrieve — cohortsretrieve
/v1/api/projects/{project-id}/cohorts/{id}
PUT
Cohortsupdate — cohortsupdate
/v1/api/projects/{project-id}/cohorts/{id}
PATCH
Cohortspartialupdate — cohortspartialupdate
/v1/api/projects/{project-id}/cohorts/{id}
DELETE
Cohortsdestroy — Hard delete of this model is not allowed. Use a patch API call to set "deleted" to true
/v1/api/projects/{project-id}/cohorts/{id}
GET
Cohortsactivityretrieve — cohortsactivityretrieve
/v1/api/projects/{project-id}/cohorts/{id}/activity
PATCH
Cohortsaddpersonstostaticcohortpartialupdate — cohortsaddpersonstostaticcohortpartialupdate
/v1/api/projects/{project-id}/cohorts/{id}/add-persons-to-static-cohort
GET
Cohortscalculationhistoryretrieve — cohortscalculationhistoryretrieve
/v1/api/projects/{project-id}/cohorts/{id}/calculation-history
GET
Cohortspersonsretrieve — cohortspersonsretrieve
/v1/api/projects/{project-id}/cohorts/{id}/persons
PATCH
Cohortsremovepersonfromstaticcohortpartialupdate — cohortsremovepersonfromstaticcohortpartialupdate
/v1/api/projects/{project-id}/cohorts/{id}/remove-person-from-static-cohort

MCP Tools

cohortslist

cohortslist

read-only idempotent
cohortscreate

cohortscreate

cohortsallactivityretrieve

cohortsallactivityretrieve

read-only idempotent
cohortsretrieve

cohortsretrieve

read-only idempotent
cohortsupdate

cohortsupdate

idempotent
cohortspartialupdate

cohortspartialupdate

idempotent
hard-delete-this-model-is

Hard delete of this model is not allowed. Use a patch API call to set "deleted" to true

idempotent
cohortsactivityretrieve

cohortsactivityretrieve

read-only idempotent
cohortsaddpersonstostaticcohortpartialupdate

cohortsaddpersonstostaticcohortpartialupdate

idempotent
cohortscalculationhistoryretrieve

cohortscalculationhistoryretrieve

read-only idempotent
cohortspersonsretrieve

cohortspersonsretrieve

read-only idempotent
cohortsremovepersonfromstaticcohortpartialupdate

cohortsremovepersonfromstaticcohortpartialupdate

idempotent

Capability Spec

posthog-cohorts.yaml Raw ↑
naftiko: 1.0.0-alpha2
info:
  label: PostHog API — cohorts
  description: 'PostHog API — cohorts. 12 operations. Lead operation: cohorts. Self-contained Naftiko capability covering
    one Posthog business surface.'
  tags:
  - Posthog
  - cohorts
  created: '2026-05-19'
  modified: '2026-05-19'
binds:
- namespace: env
  keys:
    POSTHOG_API_KEY: POSTHOG_API_KEY
capability:
  consumes:
  - type: http
    namespace: posthog-cohorts
    baseUri: ''
    description: PostHog API — cohorts business capability. Self-contained, no shared references.
    resources:
    - name: api-projects-project_id-cohorts
      path: /api/projects/{project_id}/cohorts/
      operations:
      - name: cohortslist
        method: GET
        description: ''
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: limit
          in: query
          type: integer
          description: Number of results to return per page.
        - name: offset
          in: query
          type: integer
          description: The initial index from which to return the results.
      - name: cohortscreate
        method: POST
        description: ''
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: false
    - name: api-projects-project_id-cohorts-activity
      path: /api/projects/{project_id}/cohorts/activity/
      operations:
      - name: cohortsallactivityretrieve
        method: GET
        description: ''
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: api-projects-project_id-cohorts-id
      path: /api/projects/{project_id}/cohorts/{id}/
      operations:
      - name: cohortsretrieve
        method: GET
        description: ''
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: id
          in: path
          type: integer
          description: A unique integer value identifying this cohort.
          required: true
      - name: cohortsupdate
        method: PUT
        description: ''
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: id
          in: path
          type: integer
          description: A unique integer value identifying this cohort.
          required: true
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: false
      - name: cohortspartialupdate
        method: PATCH
        description: ''
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: id
          in: path
          type: integer
          description: A unique integer value identifying this cohort.
          required: true
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: false
      - name: cohortsdestroy
        method: DELETE
        description: Hard delete of this model is not allowed. Use a patch API call to set "deleted" to true
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: id
          in: path
          type: integer
          description: A unique integer value identifying this cohort.
          required: true
    - name: api-projects-project_id-cohorts-id-activity
      path: /api/projects/{project_id}/cohorts/{id}/activity/
      operations:
      - name: cohortsactivityretrieve
        method: GET
        description: ''
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: id
          in: path
          type: integer
          description: A unique integer value identifying this cohort.
          required: true
    - name: api-projects-project_id-cohorts-id-add_persons_to_static_cohort
      path: /api/projects/{project_id}/cohorts/{id}/add_persons_to_static_cohort/
      operations:
      - name: cohortsaddpersonstostaticcohortpartialupdate
        method: PATCH
        description: ''
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: id
          in: path
          type: integer
          description: A unique integer value identifying this cohort.
          required: true
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: false
    - name: api-projects-project_id-cohorts-id-calculation_history
      path: /api/projects/{project_id}/cohorts/{id}/calculation_history/
      operations:
      - name: cohortscalculationhistoryretrieve
        method: GET
        description: ''
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: id
          in: path
          type: integer
          description: A unique integer value identifying this cohort.
          required: true
    - name: api-projects-project_id-cohorts-id-persons
      path: /api/projects/{project_id}/cohorts/{id}/persons/
      operations:
      - name: cohortspersonsretrieve
        method: GET
        description: ''
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: format
          in: query
          type: string
        - name: id
          in: path
          type: integer
          description: A unique integer value identifying this cohort.
          required: true
        - name: limit
          in: query
          type: integer
          description: Maximum number of persons to return per page (defaults to 100).
        - name: offset
          in: query
          type: integer
          description: Number of persons to skip before starting to return results.
    - name: api-projects-project_id-cohorts-id-remove_person_from_static_cohort
      path: /api/projects/{project_id}/cohorts/{id}/remove_person_from_static_cohort/
      operations:
      - name: cohortsremovepersonfromstaticcohortpartialupdate
        method: PATCH
        description: ''
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: id
          in: path
          type: integer
          description: A unique integer value identifying this cohort.
          required: true
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: false
    authentication:
      type: bearer
      token: '{{env.POSTHOG_API_KEY}}'
  exposes:
  - type: rest
    namespace: posthog-cohorts-rest
    port: 8080
    description: REST adapter for PostHog API — cohorts. One Spectral-compliant resource per consumed operation, prefixed
      with /v1.
    resources:
    - path: /v1/api/projects/{project-id}/cohorts
      name: api-projects-project-id-cohorts
      description: REST surface for api-projects-project_id-cohorts.
      operations:
      - method: GET
        name: cohortslist
        description: cohortslist
        call: posthog-cohorts.cohortslist
        with:
          limit: rest.limit
          offset: rest.offset
        outputParameters:
        - type: object
          mapping: $.
      - method: POST
        name: cohortscreate
        description: cohortscreate
        call: posthog-cohorts.cohortscreate
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/api/projects/{project-id}/cohorts/activity
      name: api-projects-project-id-cohorts-activity
      description: REST surface for api-projects-project_id-cohorts-activity.
      operations:
      - method: GET
        name: cohortsallactivityretrieve
        description: cohortsallactivityretrieve
        call: posthog-cohorts.cohortsallactivityretrieve
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/api/projects/{project-id}/cohorts/{id}
      name: api-projects-project-id-cohorts-id
      description: REST surface for api-projects-project_id-cohorts-id.
      operations:
      - method: GET
        name: cohortsretrieve
        description: cohortsretrieve
        call: posthog-cohorts.cohortsretrieve
        with:
          id: rest.id
        outputParameters:
        - type: object
          mapping: $.
      - method: PUT
        name: cohortsupdate
        description: cohortsupdate
        call: posthog-cohorts.cohortsupdate
        with:
          id: rest.id
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
      - method: PATCH
        name: cohortspartialupdate
        description: cohortspartialupdate
        call: posthog-cohorts.cohortspartialupdate
        with:
          id: rest.id
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
      - method: DELETE
        name: cohortsdestroy
        description: Hard delete of this model is not allowed. Use a patch API call to set "deleted" to true
        call: posthog-cohorts.cohortsdestroy
        with:
          id: rest.id
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/api/projects/{project-id}/cohorts/{id}/activity
      name: api-projects-project-id-cohorts-id-activity
      description: REST surface for api-projects-project_id-cohorts-id-activity.
      operations:
      - method: GET
        name: cohortsactivityretrieve
        description: cohortsactivityretrieve
        call: posthog-cohorts.cohortsactivityretrieve
        with:
          id: rest.id
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/api/projects/{project-id}/cohorts/{id}/add-persons-to-static-cohort
      name: api-projects-project-id-cohorts-id-add-persons-to-static-cohort
      description: REST surface for api-projects-project_id-cohorts-id-add_persons_to_static_cohort.
      operations:
      - method: PATCH
        name: cohortsaddpersonstostaticcohortpartialupdate
        description: cohortsaddpersonstostaticcohortpartialupdate
        call: posthog-cohorts.cohortsaddpersonstostaticcohortpartialupdate
        with:
          id: rest.id
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/api/projects/{project-id}/cohorts/{id}/calculation-history
      name: api-projects-project-id-cohorts-id-calculation-history
      description: REST surface for api-projects-project_id-cohorts-id-calculation_history.
      operations:
      - method: GET
        name: cohortscalculationhistoryretrieve
        description: cohortscalculationhistoryretrieve
        call: posthog-cohorts.cohortscalculationhistoryretrieve
        with:
          id: rest.id
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/api/projects/{project-id}/cohorts/{id}/persons
      name: api-projects-project-id-cohorts-id-persons
      description: REST surface for api-projects-project_id-cohorts-id-persons.
      operations:
      - method: GET
        name: cohortspersonsretrieve
        description: cohortspersonsretrieve
        call: posthog-cohorts.cohortspersonsretrieve
        with:
          format: rest.format
          id: rest.id
          limit: rest.limit
          offset: rest.offset
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/api/projects/{project-id}/cohorts/{id}/remove-person-from-static-cohort
      name: api-projects-project-id-cohorts-id-remove-person-from-static-cohort
      description: REST surface for api-projects-project_id-cohorts-id-remove_person_from_static_cohort.
      operations:
      - method: PATCH
        name: cohortsremovepersonfromstaticcohortpartialupdate
        description: cohortsremovepersonfromstaticcohortpartialupdate
        call: posthog-cohorts.cohortsremovepersonfromstaticcohortpartialupdate
        with:
          id: rest.id
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
  - type: mcp
    namespace: posthog-cohorts-mcp
    port: 9090
    transport: http
    description: MCP adapter for PostHog API — cohorts. One tool per consumed operation, routed inline through this capability's
      consumes block.
    tools:
    - name: cohortslist
      description: cohortslist
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: posthog-cohorts.cohortslist
      with:
        limit: tools.limit
        offset: tools.offset
      outputParameters:
      - type: object
        mapping: $.
    - name: cohortscreate
      description: cohortscreate
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: posthog-cohorts.cohortscreate
      with:
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: cohortsallactivityretrieve
      description: cohortsallactivityretrieve
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: posthog-cohorts.cohortsallactivityretrieve
      outputParameters:
      - type: object
        mapping: $.
    - name: cohortsretrieve
      description: cohortsretrieve
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: posthog-cohorts.cohortsretrieve
      with:
        id: tools.id
      outputParameters:
      - type: object
        mapping: $.
    - name: cohortsupdate
      description: cohortsupdate
      hints:
        readOnly: false
        destructive: false
        idempotent: true
      call: posthog-cohorts.cohortsupdate
      with:
        id: tools.id
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: cohortspartialupdate
      description: cohortspartialupdate
      hints:
        readOnly: false
        destructive: false
        idempotent: true
      call: posthog-cohorts.cohortspartialupdate
      with:
        id: tools.id
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: hard-delete-this-model-is
      description: Hard delete of this model is not allowed. Use a patch API call to set "deleted" to true
      hints:
        readOnly: false
        destructive: true
        idempotent: true
      call: posthog-cohorts.cohortsdestroy
      with:
        id: tools.id
      outputParameters:
      - type: object
        mapping: $.
    - name: cohortsactivityretrieve
      description: cohortsactivityretrieve
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: posthog-cohorts.cohortsactivityretrieve
      with:
        id: tools.id
      outputParameters:
      - type: object
        mapping: $.
    - name: cohortsaddpersonstostaticcohortpartialupdate
      description: cohortsaddpersonstostaticcohortpartialupdate
      hints:
        readOnly: false
        destructive: false
        idempotent: true
      call: posthog-cohorts.cohortsaddpersonstostaticcohortpartialupdate
      with:
        id: tools.id
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: cohortscalculationhistoryretrieve
      description: cohortscalculationhistoryretrieve
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: posthog-cohorts.cohortscalculationhistoryretrieve
      with:
        id: tools.id
      outputParameters:
      - type: object
        mapping: $.
    - name: cohortspersonsretrieve
      description: cohortspersonsretrieve
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: posthog-cohorts.cohortspersonsretrieve
      with:
        format: tools.format
        id: tools.id
        limit: tools.limit
        offset: tools.offset
      outputParameters:
      - type: object
        mapping: $.
    - name: cohortsremovepersonfromstaticcohortpartialupdate
      description: cohortsremovepersonfromstaticcohortpartialupdate
      hints:
        readOnly: false
        destructive: false
        idempotent: true
      call: posthog-cohorts.cohortsremovepersonfromstaticcohortpartialupdate
      with:
        id: tools.id
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.