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

# Get markets

> Fetch list of markets in the collection with pagination and filtering



## OpenAPI

````yaml get /v2/collections/{collectionId}/markets
openapi: 3.0.0
info:
  title: Forestreet API
  version: 1.0.0
  description: API documentation for Forestreet API
servers:
  - url: https://rest.forestreet.com
    description: Forestreet API V2 server
security:
  - apiKeyAuth: []
  - bearerAuth: []
  - sessionIdQuery: []
tags: []
paths:
  /v2/collections/{collectionId}/markets:
    get:
      tags:
        - Markets
      summary: Get markets
      description: Fetch list of markets in the collection with pagination and filtering
      parameters:
        - schema:
            type: integer
            minimum: 0
            exclusiveMinimum: true
            description: ID of the collection to which the markets belong.
          required: true
          description: ID of the collection to which the markets belong.
          name: collectionId
          in: path
        - schema:
            type: string
            description: Search markets by id, name, or description.
          required: false
          description: Search markets by id, name, or description.
          name: search
          in: query
        - schema:
            type: integer
            minimum: 0
            exclusiveMinimum: true
            default: 1
            description: Page number to retrieve, starting from 1.
          required: false
          description: Page number to retrieve, starting from 1.
          name: page
          in: query
        - schema:
            type: integer
            minimum: 0
            exclusiveMinimum: true
            maximum: 100
            default: 50
            description: Number of markets per page.
          required: false
          description: Number of markets per page.
          name: pageSize
          in: query
        - schema:
            type: string
            enum:
              - id
              - name
              - createdAt
              - updatedAt
              - status
            default: createdAt
            description: Field to sort markets by. Default is createdAt.
          required: false
          description: Field to sort markets by. Default is createdAt.
          name: sortBy
          in: query
        - schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
            description: Order of sorting. Default is desc.
          required: false
          description: Order of sorting. Default is desc.
          name: sortOrder
          in: query
        - schema:
            type: boolean
            nullable: true
            default: false
            description: Filter markets by archived status.
          required: false
          description: Filter markets by archived status.
          name: isArchived
          in: query
        - schema:
            type: string
            enum:
              - draft
              - publishing
              - published
            description: Filter markets by status.
          required: false
          description: Filter markets by status.
          name: status
          in: query
      responses:
        '200':
          description: List markets in collection response
          content:
            application/json:
              schema:
                type: object
                properties:
                  metadata:
                    type: object
                    properties:
                      pagination:
                        type: object
                        properties:
                          totalItems:
                            type: number
                            description: >-
                              Total number of items for the returned dataset
                              after filtering.
                          totalPages:
                            type: number
                            description: >-
                              Total number of pages for the returned dataset
                              after filtering.
                          currentPage:
                            type: number
                            description: Current page number.
                          pageSize:
                            type: number
                            description: Number of items per page.
                          unfilteredTotalItems:
                            type: number
                            description: >-
                              Total number of items for the original dataset
                              before filtering.
                          unfilteredTotalPages:
                            type: number
                            description: >-
                              Total number of pages for the original dataset
                              before filtering.
                        required:
                          - totalItems
                          - totalPages
                          - currentPage
                          - pageSize
                        description: >-
                          Schema for pagination metadata, including total items,
                          total pages, current page, and page size.
                        example:
                          totalItems: 123
                          totalPages: 13
                          currentPage: 1
                          pageSize: 10
                          unfilteredTotalItems: 196
                          unfilteredTotalPages: 20
                      filters:
                        type: object
                        properties:
                          isArchived:
                            type: boolean
                            description: >-
                              Indicates whether the results are filtered by
                              archived status.
                        required:
                          - isArchived
                      sort:
                        type: object
                        properties:
                          field:
                            type: string
                            enum:
                              - id
                              - name
                              - createdAt
                              - updatedAt
                              - status
                          order:
                            type: string
                            enum:
                              - asc
                              - desc
                        required:
                          - field
                          - order
                    required:
                      - pagination
                      - filters
                      - sort
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: number
                          description: Unique identifier of the market.
                        name:
                          type: string
                          description: Name of the market.
                        description:
                          type: string
                          nullable: true
                          description: Optional description of the market.
                        headerImage:
                          type: string
                          nullable: true
                          description: Optional URL to the market's header image.
                        status:
                          type: string
                          nullable: true
                          description: Optional status of the market.
                        isEditable:
                          type: boolean
                          nullable: true
                          description: Indicates if the market is editable.
                        isArchived:
                          type: boolean
                          nullable: true
                          description: Indicates if the market is archived.
                        createdAt:
                          type: string
                          nullable: true
                          format: date-time
                          description: Timestamp when the market was created.
                        updatedAt:
                          type: string
                          nullable: true
                          format: date-time
                          description: Timestamp when the market was last updated.
                        companyCount:
                          type: number
                          nullable: true
                          description: Number of companies in the market.
                        collections:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: integer
                                minimum: 0
                                exclusiveMinimum: true
                                description: ID of the collection.
                              name:
                                type: string
                                nullable: true
                                description: Name of the collection.
                            required:
                              - id
                              - name
                          description: >-
                            Collections the market belongs to within the
                            caller's accessible scope.
                      required:
                        - id
                        - name
                        - description
                        - headerImage
                        - status
                        - isEditable
                        - isArchived
                        - createdAt
                        - updatedAt
                        - companyCount
                required:
                  - metadata
                  - data
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  errorCode:
                    type: string
                    enum:
                      - USER_NOT_CONFIRMED
                      - INVALID_CREDENTIALS
                      - INCOMPLETE_CREDENTIALS
                      - INVALID_SESSION_TOKEN
                      - FORCE_CHANGE_PASSWORD
                      - PASSWORD_RESET_REQUIRED
                      - PASSWORD_EXPIRED
                      - CODE_EXPIRED
                      - SESSION_EXPIRED
                      - UNAUTHORISED
                      - AUTHENTICATOR_ERROR
                      - SSO_ACCOUNT
                      - FORBIDDEN
                      - METHOD_NOT_ALLOWED
                      - INVALID_INPUT
                      - PATH_VALIDATION_FAILED
                      - QUERY_VALIDATION_FAILED
                      - BODY_VALIDATION_FAILED
                      - RESPONSE_VALIDATION_FAILED
                      - INVALID_OR_MALFORMED_JSON
                      - INTERNAL_SERVER_ERROR
                      - CONFIGURATION_ERROR
                      - SERVICE_UNAVAILABLE
                      - NOT_FOUND
                      - CONFLICT
                      - LIMIT_EXCEEDED
                      - REVIEW_ALREADY_PENDING
                      - REVIEW_NOT_PENDING
                      - REVIEW_PENDING
                      - REVIEW_INSUFFICIENT_DOMAINS
                      - QUOTA_EXCEEDED
                      - UNSUPPORTED_ENDPOINT_VERSION
                      - ENDPOINT_NOT_FOUND
                      - ENDPOINT_ALREADY_EXISTS
                  message:
                    type: string
                  detail:
                    type: object
                    additionalProperties:
                      nullable: true
                required:
                  - success
                  - errorCode
              examples:
                INVALID_INPUT:
                  value:
                    success: false
                    errorCode: INVALID_INPUT
                    message: Bad Request
        '403':
          description: Forbidden - You do not have access to this collection
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  errorCode:
                    type: string
                    enum:
                      - USER_NOT_CONFIRMED
                      - INVALID_CREDENTIALS
                      - INCOMPLETE_CREDENTIALS
                      - INVALID_SESSION_TOKEN
                      - FORCE_CHANGE_PASSWORD
                      - PASSWORD_RESET_REQUIRED
                      - PASSWORD_EXPIRED
                      - CODE_EXPIRED
                      - SESSION_EXPIRED
                      - UNAUTHORISED
                      - AUTHENTICATOR_ERROR
                      - SSO_ACCOUNT
                      - FORBIDDEN
                      - METHOD_NOT_ALLOWED
                      - INVALID_INPUT
                      - PATH_VALIDATION_FAILED
                      - QUERY_VALIDATION_FAILED
                      - BODY_VALIDATION_FAILED
                      - RESPONSE_VALIDATION_FAILED
                      - INVALID_OR_MALFORMED_JSON
                      - INTERNAL_SERVER_ERROR
                      - CONFIGURATION_ERROR
                      - SERVICE_UNAVAILABLE
                      - NOT_FOUND
                      - CONFLICT
                      - LIMIT_EXCEEDED
                      - REVIEW_ALREADY_PENDING
                      - REVIEW_NOT_PENDING
                      - REVIEW_PENDING
                      - REVIEW_INSUFFICIENT_DOMAINS
                      - QUOTA_EXCEEDED
                      - UNSUPPORTED_ENDPOINT_VERSION
                      - ENDPOINT_NOT_FOUND
                      - ENDPOINT_ALREADY_EXISTS
                  message:
                    type: string
                  detail:
                    type: object
                    additionalProperties:
                      nullable: true
                required:
                  - success
                  - errorCode
              examples:
                FORBIDDEN:
                  value:
                    success: false
                    errorCode: FORBIDDEN
                    message: Forbidden - You do not have access to this collection
        '404':
          description: Not Found - Markets not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  errorCode:
                    type: string
                    enum:
                      - USER_NOT_CONFIRMED
                      - INVALID_CREDENTIALS
                      - INCOMPLETE_CREDENTIALS
                      - INVALID_SESSION_TOKEN
                      - FORCE_CHANGE_PASSWORD
                      - PASSWORD_RESET_REQUIRED
                      - PASSWORD_EXPIRED
                      - CODE_EXPIRED
                      - SESSION_EXPIRED
                      - UNAUTHORISED
                      - AUTHENTICATOR_ERROR
                      - SSO_ACCOUNT
                      - FORBIDDEN
                      - METHOD_NOT_ALLOWED
                      - INVALID_INPUT
                      - PATH_VALIDATION_FAILED
                      - QUERY_VALIDATION_FAILED
                      - BODY_VALIDATION_FAILED
                      - RESPONSE_VALIDATION_FAILED
                      - INVALID_OR_MALFORMED_JSON
                      - INTERNAL_SERVER_ERROR
                      - CONFIGURATION_ERROR
                      - SERVICE_UNAVAILABLE
                      - NOT_FOUND
                      - CONFLICT
                      - LIMIT_EXCEEDED
                      - REVIEW_ALREADY_PENDING
                      - REVIEW_NOT_PENDING
                      - REVIEW_PENDING
                      - REVIEW_INSUFFICIENT_DOMAINS
                      - QUOTA_EXCEEDED
                      - UNSUPPORTED_ENDPOINT_VERSION
                      - ENDPOINT_NOT_FOUND
                      - ENDPOINT_ALREADY_EXISTS
                  message:
                    type: string
                  detail:
                    type: object
                    additionalProperties:
                      nullable: true
                required:
                  - success
                  - errorCode
              examples:
                NOT_FOUND:
                  value:
                    success: false
                    errorCode: NOT_FOUND
                    message: Not Found - Markets not found
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    enum:
                      - false
                  errorCode:
                    type: string
                    enum:
                      - USER_NOT_CONFIRMED
                      - INVALID_CREDENTIALS
                      - INCOMPLETE_CREDENTIALS
                      - INVALID_SESSION_TOKEN
                      - FORCE_CHANGE_PASSWORD
                      - PASSWORD_RESET_REQUIRED
                      - PASSWORD_EXPIRED
                      - CODE_EXPIRED
                      - SESSION_EXPIRED
                      - UNAUTHORISED
                      - AUTHENTICATOR_ERROR
                      - SSO_ACCOUNT
                      - FORBIDDEN
                      - METHOD_NOT_ALLOWED
                      - INVALID_INPUT
                      - PATH_VALIDATION_FAILED
                      - QUERY_VALIDATION_FAILED
                      - BODY_VALIDATION_FAILED
                      - RESPONSE_VALIDATION_FAILED
                      - INVALID_OR_MALFORMED_JSON
                      - INTERNAL_SERVER_ERROR
                      - CONFIGURATION_ERROR
                      - SERVICE_UNAVAILABLE
                      - NOT_FOUND
                      - CONFLICT
                      - LIMIT_EXCEEDED
                      - REVIEW_ALREADY_PENDING
                      - REVIEW_NOT_PENDING
                      - REVIEW_PENDING
                      - REVIEW_INSUFFICIENT_DOMAINS
                      - QUOTA_EXCEEDED
                      - UNSUPPORTED_ENDPOINT_VERSION
                      - ENDPOINT_NOT_FOUND
                      - ENDPOINT_ALREADY_EXISTS
                  message:
                    type: string
                  detail:
                    type: object
                    additionalProperties:
                      nullable: true
                required:
                  - success
                  - errorCode
              examples:
                INTERNAL_SERVER_ERROR:
                  value:
                    success: false
                    errorCode: INTERNAL_SERVER_ERROR
                    message: Internal Server Error
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Pass a static API key for every request, provided by your customer
        support.
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer token authentication, using a sessionId generated by `GET
        /v2/auth/session`.
    sessionIdQuery:
      type: apiKey
      in: query
      name: sessionId
      description: >-
        Session ID passed as a query parameter for authentication, provided by
        `GET /v2/auth/session`.

````