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

> ## Agent Instructions
> This site documents the D-EDGE APIs for technology partners (web agencies, OTAs, PMS and RMS vendors, booking and CRM tools). It is written for developers integrating with hotels that use the D-EDGE platform.
> Seven APIs, grouped by domain. Connectivity: Channel Manager API (distribute a hotel's inventory to your channel and send bookings back). Pricing & Availability: Best Price API (best offers to highlight), Quotation API (all bookable offers for a stay), Daily Rates API (daily availability between two dates). Booking: Booking Engine API (a hotel's full direct booking funnel), Gift Shop API (gift vouchers from catalogue to payment). Guest Management: CRM API (guest profiles).
> Pick the API by the need: to display prices, use the Best Price API or the Daily Rates API; to quote a specific stay, use the Quotation API; to book, use the Booking Engine API; to sell gift vouchers, use the Gift Shop API; to manage guest profiles, use the CRM API; to receive hotel inventory and send bookings back as a distribution channel, use the Channel Manager API.
> Base URLs, hotel identifiers, and credentials are delivered by the D-EDGE partnership team during onboarding. Do not invent base URLs, endpoints, parameters, or example credentials that do not appear on these pages.
> Authentication differs per API: OAuth 1.0 for Best Price, Quotation, Daily Rates, and Booking Engine; an X-API-KEY header for Gift Shop; OAuth 2.0 client credentials for CRM; partner-defined credentials carried in the XML message for the Channel Manager API. Read each API's Authentication page before writing code.
> A mock environment returns realistic but fictitious data without credentials. The Postman and Insomnia collections on the API collections page target it by default. Use it for exploration and tests, never for production traffic.
> Use the official names exactly: D-EDGE, D-EDGE platform, Channel Manager API, partnership team. Do not use Back Office or Extranet.
> Each API has a Changelog page. Check it for the current behaviour before relying on an older answer. For questions these pages do not answer, direct the reader to the Contact us page.

# Count guests

> Count or estimate the guests matching advanced filters

The fields a criterion can target, and the operators each one accepts, are listed on the [Search criteria](/crm-api/build/guidelines/search-criteria.md) page.


## OpenAPI

````yaml crm-api/open-api/crm-api.json POST /api/guestprofile/entities/{entity_id}/guests/count
openapi: 3.0.3
info:
  description: >-
    D-EDGE CRM Guest Profile is a CDP (Customer Data Platform).


    Guest Profile API allows every authenticated user or third party system to
    interact with D-EDGE CRM Guest Profile data.


    The API can be accessed with a valid OAuth bearer token obtained towards the
    D-EDGE CRM ID server either by hotel agents or by third party systems dully
    registered on D-EDGE CRM ID.
  version: '1.0'
  title: Guest Profile API
servers:
  - url: https://{apiBaseUrl}
    variables:
      apiBaseUrl:
        default: api.example.com
        description: Base URL delivered by D-EDGE during partnership setup
security:
  - bearerAuth: []
paths:
  /api/guestprofile/entities/{entity_id}/guests/count:
    post:
      tags:
        - Search
      summary: Advanced counting of guests
      description: This route allows to count or estimate guests matching advanced filters
      operationId: countGuests
      parameters:
        - name: entity_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/new_query'
      responses:
        '200':
          description: Number of guests
          content:
            application/json:
              schema:
                type: object
                properties:
                  count:
                    type: integer
                  accurate:
                    type: boolean
        '400':
          $ref: '#/components/responses/InvalidQueryOrParams'
        '401':
          $ref: '#/components/responses/AccessDenied'
        '404':
          $ref: '#/components/responses/NotFound'
        '408':
          $ref: '#/components/responses/Timeout'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    new_query:
      type: object
      properties:
        query:
          $ref: '#/components/schemas/query'
    query:
      type: object
      properties:
        logic:
          $ref: '#/components/schemas/logic'
        criteria:
          type: array
          items:
            $ref: '#/components/schemas/criteria'
    error:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
        data:
          type: object
    logic:
      description: >-
        How the criteria of a group combine: all of them with AND, any of them
        with OR.
      type: string
      enum:
        - AND
        - OR
    criteria:
      type: object
      properties:
        logic:
          $ref: '#/components/schemas/logic'
        criteria:
          type: array
          items:
            $ref: '#/components/schemas/criteriaFilter'
    criteriaFilter:
      type: object
      properties:
        field:
          description: >-
            The attribute the criterion applies to. The fields and the operators
            each one accepts are listed on the Search criteria page of the
            guidelines.
          type: string
          enum:
            - app
            - arrival
            - arrivaldow
            - avgfare
            - balance
            - birthdate
            - birthday
            - bookingarrival
            - bookingdate
            - bookingId
            - bookingstatus
            - bookingstatusdiff
            - bookingTags
            - bwrewardsstatus
            - campaign
            - channel
            - city
            - company
            - country
            - departure
            - departuredow
            - email
            - emailcollected
            - emaildomain
            - entityId
            - fare
            - farecode
            - fareratio
            - fidelity
            - guestId
            - hasfacebook
            - haslinkedin
            - hasPersonnalEmail
            - hastwitter
            - idmasterresa
            - idresa
            - instay
            - instaydate
            - instayDates
            - langs
            - lastconnexion
            - linkedinfollowers
            - msgcampaign
            - nationality
            - nbnextstays
            - nbpreviousstays
            - nbstays
            - newsletter
            - nextstay
            - optoutmarketing
            - optoutprestay
            - optoutsendinblue
            - partner
            - paxadults
            - paxbabies
            - paxchildren
            - phone
            - preferredEmail
            - prevstay
            - pushNotification
            - roomnumber
            - roomtype
            - search
            - segment
            - smscampaign
            - sourceImport
            - sourceType
            - staylength
            - sumfare
            - tags
            - touristtax
            - twitterfollowers
            - userCustomField
            - visitCustomField
            - weekend
            - zipcode
        operator:
          description: >-
            How the value is compared with the field. Which operators a field
            accepts depends on the field: see the Search criteria page of the
            guidelines.
          type: string
          enum:
            - '&>='
            - '>='
            - '@'
            - '&<='
            - '&<'
            - A
            - '!A'
            - '!O'
            - '!R'
            - O
            - R
            - '%'
            - '-'
            - +
            - DOW
            - '='
            - '&='
            - F
            - '1'
            - C
            - <
            - 'N'
            - '!@'
            - '!%'
            - '!='
            - '!F'
            - '!1'
            - '!S'
            - S
            - '>'
            - 'Y'
        value:
          type: string
  responses:
    InvalidQueryOrParams:
      description: URL Params/Request body error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'
          examples:
            Invalid params:
              value:
                code: system.invalidParams
                message: invalid property
            Invalid query:
              value:
                code: system.invalidQuery
                message: invalid property
    AccessDenied:
      description: Access denied
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'
          examples:
            Access denied:
              value:
                code: system.accessDenied
                message: system.accessDenied
                data: {}
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'
          examples:
            Not found:
              value:
                code: system.notFound
                message: system.notFound
                data: {}
    Timeout:
      description: Service timeout
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'
          examples:
            Service timeout:
              value:
                code: system.timeout
                message: system.timeout
                data: {}
    InternalError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'
          examples:
            Internal error:
              value:
                code: system.internalError
                message: system.internalError
                data: {}
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.