Formo Segments API

Manage user segments

GitHub OpenAPI

Operations 3

GET /v0/segments List segments #
POST /v0/segments Create segment #
DELETE /v0/segments/{segmentId} Delete segment #

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/formo-so:formo-so-segments-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. See our Privacy Policy and Terms.

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

OpenAPI Specification

formo-so-segments-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Formo Public Segments API
  description: 'REST API for managing Formo projects, analytics, alerts, boards, charts, contracts, segments, and AI chat.


    **Auth.** Every endpoint on `api.formo.so` requires a workspace API key with the appropriate scopes (see `x-api-scopes`). The one exception is `POST /v0/raw_events`, which runs on `events.formo.so` and authenticates with the project SDK write key instead.


    **Response shape.** Successful responses return the resource directly (or `{ data: [...], total, page, size, has_more }` for paginated lists). HTTP status carries success/failure; there is no envelope wrapping success bodies.


    **Errors.** Non-2xx responses from `api.formo.so` use the `Error` envelope, with two exceptions: some rate-limit rejections reply in plain text, and `POST /v0/raw_events` returns a plain `{ "error": "..." }` object. Treat the HTTP status as authoritative and parse defensively: `{ error: { code, message, doc_url, param?, details? } }`. Branch on the machine-readable `code` (see `ErrorCode` enum) and follow `doc_url` to the matching section of the errors reference.


    **Idempotency.** Pass an `Idempotency-Key` header on write requests to alerts, boards, charts, contracts, segments, and import to make retries safe; the response is cached for 24 h and replayed on duplicate keys. Profile writes and `POST /v0/query` do not support it.'
  version: 0.1.0
  contact:
    name: Formo
    url: https://formo.so
servers:
- url: https://api.formo.so
  description: API Server (boards, alerts, contracts, segments, profiles, query, import)
- url: https://events.formo.so
  description: Events Server (event ingestion)
security:
- WorkspaceApiKey: []
tags:
- name: Segments
  description: Manage user segments
paths:
  /v0/segments:
    get:
      operationId: listSegments
      summary: List segments
      description: List user segments for the project scoped to the API key. Paginated.
      tags:
      - Segments
      parameters:
      - $ref: '#/components/parameters/Page'
      - $ref: '#/components/parameters/Size'
      responses:
        '200':
          description: Paginated list of segments
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/PaginatedListMeta'
                - type: object
                  required:
                  - data
                  properties:
                    data:
                      type: array
                      items:
                        $ref: '#/components/schemas/Segment'
              example:
                data:
                - id: seg_e3f4g5h6i7j8
                  projectId: proj_abc123
                  title: High net worth desktop users
                  filters:
                  - field: device
                    op: eq
                    value: desktop
                  - field: net_worth_usd
                    op: gte
                    value: '100000'
                page: 1
                size: 100
                total: 1
                has_more: false
      x-required-scope: segments:read
    post:
      operationId: createSegment
      summary: Create segment
      tags:
      - Segments
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                title:
                  type: string
                  minLength: 1
                filters:
                  type: array
                  minItems: 1
                  items:
                    $ref: '#/components/schemas/SegmentFilterCondition'
                  description: Canonical filter objects combined with implicit AND.
              required:
              - title
              - filters
            examples:
              highValueMobileUsers:
                summary: High-value mobile users from paid campaigns
                value:
                  title: High-value mobile users
                  filters:
                  - field: device
                    op: eq
                    value: mobile
                  - field: net_worth_usd
                    op: gte
                    value: '10000'
                  - field: utm_source
                    op: eq
                    value: paid_ads
              multiDeviceChromeSafari:
                summary: Chrome or Safari users (multi-value filter)
                value:
                  title: Chrome/Safari users
                  filters:
                  - field: browser
                    op: in
                    value: Chrome|Safari
              excludeUSUsers:
                summary: All users except from the US
                value:
                  title: Non-US users
                  filters:
                  - field: location
                    op: neq
                    value: US
              powerUsers:
                summary: Power users with high net worth from organic traffic
                value:
                  title: Organic power users
                  filters:
                  - field: net_worth_usd
                    op: gt
                    value: '1000'
                  - field: utm_source
                    op: nin
                    value: google_ads|facebook_ads
                  - field: lifecycle
                    op: eq
                    value: power
              multiChainWhaleUsers:
                summary: Users active on 3+ chains with high net worth
                value:
                  title: Multi-chain whales
                  filters:
                  - field: chains
                    op: gte
                    value: '3'
                  - field: net_worth_usd
                    op: gt
                    value: '100000'
                  - field: apps
                    op: gt
                    value: '5'
              behavioralFilterSimple:
                summary: Users who performed 'signature' event at least once in last 30 days
                description: Behavior filters use the `events` field. Its value is a base64-encoded JSON array of event-count predicates; property predicates inside each event use canonical `filters` leaves.
                value:
                  title: Recent signers
                  filters:
                  - field: events
                    op: eq
                    value: W3siZXZlbnQiOiJzaWduYXR1cmUiLCJvcGVyYXRvciI6Imd0ZSIsInRpbWVzIjoxLCJwcmVzZXQiOiJsYXN0XzMwZCJ9XQ==
              behavioralFilterWithProperties:
                summary: Users who connected via MetaMask on Ethereum mainnet + from India
                description: Combines an event-count filter and a demographic filter. Event property filters use canonical `{field, op, value}` leaves in the behavior step `filters` array.
                value:
                  title: Indian MetaMask users
                  filters:
                  - field: events
                    op: eq
                    value: W3siZXZlbnQiOiJjb25uZWN0Iiwib3BlcmF0b3IiOiJndGUiLCJ0aW1lcyI6MSwicHJlc2V0IjoibGFzdF8zMGQiLCJmaWx0ZXJzIjpbeyJmaWVsZCI6InJkbnMiLCJvcCI6ImVxIiwidmFsdWUiOiJpby5tZXRhbWFzayJ9LHsiZmllbGQiOiJjaGFpbl9pZCIsIm9wIjoiZXEiLCJ2YWx1ZSI6IjEifV19XQ==
                  - field: location
                    op: eq
                    value: IN
              behavioralFilterMultipleEvents:
                summary: Users with 5+ page views last week AND at least 1 transaction last month
                description: Multiple behavior steps in one base64-encoded `events` filter value. All steps in the array must match.
                value:
                  title: Active transactors
                  filters:
                  - field: events
                    op: eq
                    value: W3siZXZlbnQiOiJwYWdlIiwib3BlcmF0b3IiOiJndGUiLCJ0aW1lcyI6NSwicHJlc2V0IjoibGFzdF83ZCJ9LHsiZXZlbnQiOiJ0cmFuc2FjdGlvbiIsIm9wZXJhdG9yIjoiZ3RlIiwidGltZXMiOjEsInByZXNldCI6Imxhc3RfMzBkIn1d
                  - field: device
                    op: eq
                    value: desktop
      responses:
        '200':
          description: Segment created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Segment'
        '400':
          $ref: '#/components/responses/BadRequest'
        '409':
          $ref: '#/components/responses/Conflict'
      x-required-scope: segments:write
      parameters:
      - $ref: '#/components/parameters/IdempotencyKey'
  /v0/segments/{segmentId}:
    delete:
      operationId: deleteSegment
      summary: Delete segment
      tags:
      - Segments
      parameters:
      - name: segmentId
        in: path
        required: true
        schema:
          type: string
      - $ref: '#/components/parameters/IdempotencyKey'
      responses:
        '200':
          description: Segment deleted
          content:
            application/json:
              schema:
                type: 'null'
        '400':
          $ref: '#/components/responses/BadRequest'
        '409':
          $ref: '#/components/responses/Conflict'
      x-required-scope: segments:write
components:
  schemas:
    Error:
      type: object
      description: Standard error envelope returned by every public API endpoint for any non-2xx response. The HTTP status code carries success/failure; the body provides a machine-readable `code`, a human-readable `message`, and a `doc_url` pointing at the matching section of the docs so agents can fetch context on the fly.
      properties:
        error:
          type: object
          required:
          - code
          - message
          - doc_url
          properties:
            code:
              $ref: '#/components/schemas/ErrorCode'
            message:
              type: string
              description: Human-readable error description. Wording may change between releases, so branch on `code`, not `message`.
            doc_url:
              type: string
              format: uri
              description: Link to the matching section of the errors reference at https://docs.formo.so/api/errors.
            param:
              type: string
              description: When the error pertains to a specific request field, the dotted path to that field (e.g. `body.trigger_filters.0.value`).
            details:
              type: object
              additionalProperties: true
              description: 'Code-specific extra context. For `INVALID_VALIDATION_REQUEST` this is a `{ fieldPath: message }` map of every Zod validation failure.'
      required:
      - error
    Segment:
      type: object
      description: A saved segment. `filters` is an array of canonical filter objects combined with implicit AND.
      properties:
        id:
          type: string
        title:
          type: string
        projectId:
          type: string
        filters:
          type: array
          items:
            $ref: '#/components/schemas/SegmentFilterCondition'
      required:
      - id
      - title
      - filters
    SegmentFilterCondition:
      type: object
      additionalProperties: false
      description: A condition in a saved segment. Segment entries use the canonical `{field, op, value}` envelope and are combined with implicit AND. Nested event-property predicates are not supported by saved segments.
      properties:
        field:
          type: string
          minLength: 1
        op:
          type: string
          enum:
          - eq
          - neq
          - gt
          - lt
          - gte
          - lte
          - in
          - nin
          - startsWith
          - endsWith
          - contains
          - notEmpty
          - isEmpty
        value:
          oneOf:
          - type: string
          - type: number
          - type: boolean
          - type: array
            minItems: 1
            items:
              oneOf:
              - type: string
                pattern: ^[^|]*$
              - type: number
          - type: 'null'
          description: Value to compare against. Omit for `notEmpty` and `isEmpty`. Membership arrays must be non-empty. Array string members cannot contain a literal `|`, which is reserved as the Tinybird membership separator.
      required:
      - field
      - op
    ErrorCode:
      type: string
      description: Stable, enumerated error codes. New codes may be added in any release; clients should treat unknown codes as the closest matching HTTP status family.
      enum:
      - INTERNAL_SERVER_ERROR
      - INVALID_VALIDATION_REQUEST
      - UNAUTHORIZED
      - BAD_REQUEST
      - FORBIDDEN
      - NOT_FOUND
      - CONFLICT
      - INVALID_CHAIN_ID
      - CONTEXT_LIMIT_EXCEEDED
      - SERVICE_UNAVAILABLE
      - TOO_MANY_REQUESTS
      - IDEMPOTENCY_IN_PROGRESS
      - INVALID_IDEMPOTENCY_KEY
    PaginatedListMeta:
      type: object
      description: 'Pagination cursor returned alongside `data` on every paginated list endpoint. Use these to walk pages: `has_more` is true while `page * size < total`. Combine with the matching `Page` and `Size` query parameters to request the next page.'
      required:
      - page
      - size
      - total
      - has_more
      properties:
        page:
          type: integer
          description: 1-indexed page number echoed from the request.
        size:
          type: integer
          description: Page size echoed from the request.
        total:
          type: integer
          description: Total row count across all pages.
        has_more:
          type: boolean
          description: True when more pages remain (`page * size < total`).
  parameters:
    Size:
      name: size
      in: query
      required: false
      schema:
        type: integer
        minimum: 1
        maximum: 200
        default: 100
      description: Page size. Defaults to 100, capped at 200.
    Page:
      name: page
      in: query
      required: false
      schema:
        type: integer
        minimum: 1
        default: 1
      description: 1-indexed page number. Defaults to 1.
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      schema:
        type: string
        maxLength: 255
      description: Optional unique value (e.g. a UUID v4) that lets you safely retry POST/PUT/PATCH/DELETE requests. The first request runs normally; subsequent requests with the same key replay the stored response (status + body) for 24 hours, so retries can never double-create or double-charge. Two concurrent requests with the same key return `409 IDEMPOTENCY_IN_PROGRESS`. Generate a fresh key per logical operation.
  responses:
    BadRequest:
      description: 'The request was rejected. `code` is either `INVALID_VALIDATION_REQUEST` (Zod schema mismatch; `details` carries a `{ fieldPath: message }` map) or `BAD_REQUEST` (semantic validation failure outside Zod, e.g. mismatched IDs, business-rule violations). Branch on `code`, not status, to tell the two apart.'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            validation:
              summary: Zod schema mismatch
              value:
                error:
                  code: INVALID_VALIDATION_REQUEST
                  message: Invalid request data
                  doc_url: https://docs.formo.so/api/errors#invalid_validation_request
                  details:
                    body.name: String must contain at least 1 character(s)
            semantic:
              summary: Semantic validation failure
              value:
                error:
                  code: BAD_REQUEST
                  message: Target board must be different from the current board
                  doc_url: https://docs.formo.so/api/errors#bad_request
    Conflict:
      description: The request conflicts with current resource state, or an `Idempotency-Key` request with the same key is currently in flight.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: IDEMPOTENCY_IN_PROGRESS
              message: A request with this Idempotency-Key is already in progress. Retry shortly.
              doc_url: https://docs.formo.so/api/errors#idempotency_in_progress
  securitySchemes:
    WorkspaceApiKey:
      type: http
      scheme: bearer
      description: Workspace API key (e.g. `formo_xxx`). Create one in the Formo dashboard under Team Settings > API.
    X402Payment:
      type: apiKey
      in: header
      name: X-PAYMENT
      description: x402 payment payload generated after the gateway returns a 402 challenge.
    MPPPayment:
      type: apiKey
      in: header
      name: Authorization
      description: MPP payment authorization header, formatted as `Payment <payload>`, generated after the gateway returns a 402 challenge.
    SdkWriteKey:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'Project SDK write key (a JWT), sent as `Authorization: Bearer <write key>`. This is NOT the `formo_...` workspace API key used on api.formo.so. Find it in the Formo dashboard under the project’s settings.'
x-api-scopes:
  description: API key scopes control access to endpoints. Create keys with the required scopes in Team Settings > API.
  scopes:
    alerts:read: List and get alerts
    alerts:write: Create, update, delete alerts (requires alerts:read)
    boards:read: List and get boards and charts
    boards:write: Create, update, delete boards and charts (requires boards:read)
    contracts:read: List contracts
    contracts:write: Create, update, delete contracts (requires contracts:read)
    segments:read: List segments
    segments:write: Create and delete segments (requires segments:read)
    profiles:read: Search and get wallet profiles
    profiles:write: Update wallet properties, manage labels, and import addresses (requires profiles:read)
    query:read: Execute SQL analytics queries and read pre-built analytics endpoints (KPIs, top pages, lifecycle, retention, revenue, etc.)