> ## Documentation Index
> Fetch the complete documentation index at: https://recurr.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a cohort

> 🚧 **Under development.** Not available today.




## OpenAPI

````yaml /api-reference/openapi.yaml post /cohorts
openapi: 3.1.0
info:
  title: Recurr API
  version: 1.0.0
  description: >
    Recurr's webhook event API. Subscription, payment, motion, and ticket

    events delivered as signed HTTP POSTs to your registered endpoints.


    See the [Overview](/api-reference/overview) for delivery model, HMAC

    authentication, idempotency, retry policy, and schema versioning.


    REST endpoints (Replay, Destination management) are documented as

    `paths` for completeness but are roadmap. See
    [Replay](/api-reference/replay)

    and [Destinations](/api-reference/destinations) for status.
  contact:
    email: hello@recurr.dev
    url: https://recurr.dev
  license:
    name: Proprietary
servers:
  - url: https://api.recurr.dev/v1
    description: Production (roadmap)
security:
  - BearerAuth: []
tags:
  - name: Subscribers
    description: Read subscriber state, history, and tags. Update metadata.
  - name: Subscriptions
    description: Subscription state + admin overrides (pause, resume, cancel, plan change).
  - name: Events
    description: Query historical webhook events for audit + debugging.
  - name: Cohorts
    description: >-
      Manage cohort definitions + view members. Used by Recurr motions for
      targeting.
  - name: Motions
    description: Inspect motion performance + manually trigger for specific subscribers.
  - name: Metrics
    description: Aggregate metrics — MRR, churn, recovery, cohort retention.
  - name: Payments
    description: Charge detail + refund / customer-credit operations.
  - name: Tickets
    description: Read subscriber-submitted billing tickets.
  - name: Replay
    description: Re-send historical webhook events to a destination.
  - name: Destinations
    description: Manage webhook delivery endpoints.
paths:
  /cohorts:
    post:
      tags:
        - Cohorts
      summary: Create a cohort
      description: |
        🚧 **Under development.** Not available today.
      operationId: createCohort
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CohortCreate'
      responses:
        '201':
          description: Cohort created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Cohort'
      security:
        - BearerAuth: []
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      description: >
        Idempotency key for safe retries on write operations. Pass a unique key
        per logical request;

        Recurr returns the original response for duplicate keys within a 24-hour
        window.
      schema:
        type: string
        maxLength: 255
  schemas:
    CohortCreate:
      type: object
      required:
        - name
        - definition
      properties:
        name:
          type: string
        description:
          type: string
        definition:
          $ref: '#/components/schemas/CohortDefinition'
    Cohort:
      type: object
      required:
        - id
        - name
        - definition
        - member_count
        - created_at
      properties:
        id:
          type: string
          example: cohort_01HQX...
        name:
          type: string
          example: High-LTV annual subs
        description:
          type: string
          nullable: true
        definition:
          $ref: '#/components/schemas/CohortDefinition'
        member_count:
          type: integer
          description: Approximate count of subscribers currently matching the definition.
        used_by_motions:
          type: array
          items:
            type: string
          description: Motion IDs that reference this cohort.
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    CohortDefinition:
      type: object
      description: >
        Query criteria defining cohort membership. Evaluated at query time, so
        membership

        reflects current subscriber state.
      properties:
        status:
          type: array
          items:
            type: string
            enum:
              - active
              - trialing
              - paused
              - cancelled
              - lapsed
        tenure_days_min:
          type: integer
          nullable: true
        tenure_days_max:
          type: integer
          nullable: true
        plan_ids:
          type: array
          items:
            type: string
        tags_include:
          type: array
          items:
            type: string
        tags_exclude:
          type: array
          items:
            type: string
        engagement_score_min:
          type: number
          nullable: true
          description: Customer-provided engagement signal threshold (0.0-1.0).
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: rk_live_… / rk_test_…
      description: |
        Your Recurr **secret API key** as a Bearer token:
        `Authorization: Bearer rk_live_…`.

        Keys are **environment-scoped** — `rk_live_` operates on live data,
        `rk_test_` on isolated test data (see
        [Test mode](/api-reference/test-mode)). Create, scope, and rotate keys
        in your dashboard (**Settings → API keys**, `developer` role). Secret
        keys are server-side only — never ship them in an app binary or client
        JavaScript.

````