---
title: "Query contracts"
method: POST
path: "/contracts/search"
tags: ["Contracts"]
---

# Query contracts

`POST /contracts/search`

## Request

- Base URL: `https://us.api.flexprice.io/v1`
- URL: `https://us.api.flexprice.io/v1/contracts/search`
- Auth: API key in header `x-api-key`

Use when searching revenue recognition contracts by customer, subscription or contract status. Returns a paginated list.

## Request body

- ContractFilter
  - `contract_ids` string[]
  - `contract_statuses` TypesContractStatus[]
  - `customer_ids` string[]
  - `end_time` string, date-time
  - `ended_at_gte` string, date-time
  - `expand` string
  - `filters` TypesFilterCondition[]
    - `data_type` 'string' | 'number' | 'date' | 'array'
    - `field` string
    - `operator` 'eq' | 'contains' | 'not_contains' | 'gt' | 'lt' | 'gte' | 'in' | 'not_in' | 'before' | 'after'
    - `value` TypesValue
      - `array` string[]
      - `boolean` boolean
      - `date` string
      - `number` number
      - `string` string
  - `limit` integer
  - `offset` integer
  - `order` 'asc' | 'desc'
  - `sort` TypesSortCondition[]
    - `direction` 'asc' | 'desc'
    - `field` string
  - `start_time` string, date-time
  - `status` 'published' | 'deleted' | 'archived'
  - `subscription_ids` string[]

## Response `200`

OK

- ListContractsResponse
  - `items` ContractResponse[]
    - `associations` ContractAssociationResponse[]
      - `created_at` string, date-time
      - `entity_id` string
      - `entity_type` 'subscription' | 'subscription_line_item' | 'invoice' | 'credit_note' | 'payment' | 'refund' | 'pob'
      - `id` string
    - `contract_status` 'draft' | 'active' | 'ended' | 'cancelled'
    - `created_at` string, date-time
    - `currency` string
    - `customer_id` string
    - `ended_at` string, date-time
    - `id` string
    - `status` 'published' | 'deleted' | 'archived'
    - `term_end` string, date-time
    - `term_start` string, date-time
    - `updated_at` string, date-time
  - `pagination` TypesPaginationResponse
    - `limit` integer
    - `offset` integer
    - `total` integer

## Other responses

- `400`: Invalid request
- `500`: Server error

## Changes

- **2026-10-29** `d3bef0889eec`: 1 info
  - added the new optional request property `ended_at_gte`
- **2026-10-29** `f4730fdf8ea5`: 5 warning
  - added the new `credit_note` enum value to the `items/items/associations/items/entity_type` response property for the response status `200`
  - added the new `invoice` enum value to the `items/items/associations/items/entity_type` response property for the response status `200`
  - added the new `payment` enum value to the `items/items/associations/items/entity_type` response property for the response status `200`
  - added the new `pob` enum value to the `items/items/associations/items/entity_type` response property for the response status `200`
  - …1 more
- **2026-10-29** `08033e753ac8`: 1 warning
  - added the new `subscription_line_item` enum value to the `items/items/associations/items/entity_type` response property for the response status `200`
- **2026-10-29** `3124fe89bf81`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/flexprice/apis/flexprice-api/changes/contracts/search/post.md)

---

[API](https://skmtc.dev/flexprice/apis/flexprice-api.md) - [All operations](https://skmtc.dev/flexprice/apis/flexprice-api/llms.txt) - [OpenAPI document](https://skmtc.dev/flexprice/apis/flexprice-api/revisions/e1348d61034c?raw)
