CRADالمطوّرون
العربية

Read recent and upcoming appointments for one customer

قبل الاستخدام الفعلي — افحص القدرات المنشورة والصلاحيات وجاهزية ربطك.

تحقّق من القدرات المنشورة وصلاحيات المفتاح وجاهزية النشاط في بيئتك. أمثلة HTTP مسجّلة من اختبارات معزولة؛ وصفها local-unreleased لا يعني أن API غير عامل ولا يُثبت جاهزية ربطك. في مسار العميل يُتحقق من الهاتف بقالب واتساب أعدّه النشاط؛ SMS غير مدعوم. التسجيل بواسطة مسؤول مخوّل عملية منفصلة دون رمز.

GET/v1/management/customers/{businessCustomerId}/appointment-overview

Behavior

Read a customer card using one server-side Management request. Send the canonical businessCustomerId and a credential with appointments:read and a current owner calendar grant. Each requested section includes only visible appointments. An unknown customer or one with no visible matches returns empty sections. An explicit provider outside the grant is refused. The same asOf separates recent appointments (endAt <= asOf, newest start first) from ongoing and future PENDING, CONFIRMED and NOW appointments (endAt > asOf, earliest start first). Ties use appointmentId in the same direction. recentStatus filters only recent. Zero omits that section. Send at least one positive limit and each parameter at most once. Localized names include available he/ar/en values or are null. The service label prefers the saved appointment terms, then the current authorized catalogue. A clinic decision is pending only when status is PENDING and approvalRequired is true. To page older recent appointments in place, opt in on the first request with includeRecentCursor=true. Read recent.nextCursor and send it as recentCursor with a positive recentLimit. The continuation keeps the original asOf, customer, calendar grant and filters. Rows reflect current data. For history by date, list appointments by businessCustomerId and date range.

Authentication

ManagementCredential

Credential rules

One server-only owner-issued wbm_ API key can carry both management and integration permissions. Additional permissions require an explicit owner-issued grant. GET /v1/management returns the management discovery view, which may be empty for a booking-only key. For credentials with appointments:read, this discovery view omits whatsapp-templates:read, whatsapp-templates:write, whatsapp-profile:read and whatsapp-profile:write to preserve calendar-client compatibility. Discover these grants through GET /v1/management/messaging-capabilities. Template/profile command authorization still uses the stored grants. Server-only owner-issued Management authority with explicit application permissions. Calling this API does not expand a credential's grants. contacts:read/write/block/sync/fields:read/fields:write are separate approvals for canonical business contacts; fields also require current typed owner grants. contacts:record remains contact recording/recovery only. These grants create no customer phone proof, booking authority, messaging consent or automatic synchronization. Hours/blocks retain their independent resource grants. booking-policy:read/write separately delegate whole-business booking settings, without schedule/provider grants; write requires read. They preserve existing appointments and create no duration-rewrite authority. Provider duration policy additionally requires explicit provider-booking-policy:read/write and exact current providerIds; booking-duration:rewrite is separately approved and does not itself grant policy read/write. Service catalogue requires explicit services:read/write, independent of provider/calendar/schedule resources; write requires read. These operations do not expand an existing credential's grants. Public presentation and reviewed service selection require explicit website-content:read/write; write requires read, independently from services:* and provider resources. Existing provider metadata/activity/assignment additionally requires providers:read/write and a nonempty explicit current providerIds grant; write requires read. This grants no provider creation, deletion, login, invitation or schedule authority. WhatsApp template/profile management requires separate whatsapp-templates:read, whatsapp-templates:write, whatsapp-profile:read and whatsapp-profile:write application scopes. Write requires its matching read scope. These grants require explicit owner approval; Meta OAuth permissions remain separate.

Required application permissions

appointments:read

Use the existing Management key and its calendar resource grant. An explicit provider filter must be within that grant. Enforce staff access on the business backend before calling CRAD.

Request

  • businessCustomerIdpath · stringRequired
    Format and constraints
    businessCustomerId schema
    {
      "type": "string",
      "format": "uuid"
    }
  • recentLimitquery · integerOptional

    Ended appointments to return. On a regular overview, 0 omits recent. Request 1–20 with includeRecentCursor=true or recentCursor. Each continuation can choose a different page size.

    Format and constraints
    recentLimit schema
    {
      "type": "integer",
      "minimum": 0,
      "maximum": 20,
      "default": 4
    }
  • upcomingLimitquery · integerOptional

    Ongoing or future active appointments to return. Defaults to 1 for an initial overview and 0 with recentCursor. Only 0 is permitted on continuation.

    Format and constraints
    upcomingLimit schema
    {
      "type": "integer",
      "minimum": 0,
      "maximum": 20
    }
  • recentStatusquery · stringOptional

    One exact uppercase calendar status. Set COMPLETED for a list of completed treatments.

    Format and constraints
    recentStatus schema
    {
      "enum": [
        "PENDING",
        "CONFIRMED",
        "NOW",
        "COMPLETED",
        "CANCELLED",
        "MISSED"
      ]
    }
  • providerIdquery · oneOf (string | string)Optional

    Omitted: all current approved resources. unassigned: only unassigned appointments if explicitly approved. UUID: that approved provider.

    Format and constraints
    providerId schema
    {
      "oneOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "const": "unassigned"
        }
      ]
    }
  • includeRecentCursorquery · booleanOptional

    Defaults to false on an initial overview. Set true to receive recent.nextCursor when older matches exist. A continuation already opts in. An explicit false conflicts with recentCursor.

    Format and constraints
    includeRecentCursor schema
    {
      "type": "boolean"
    }
  • recentCursorquery · stringOptional

    Opaque recent.nextCursor from the previous page. Reuse the same credential and customer path. Send just this cursor and the desired recentLimit. The server restores the original recentStatus, providerId and cutoff and omits upcoming. Explicit providerId or recentStatus, positive upcomingLimit or false includeRecentCursor are invalid. The chain expires 30 minutes after the first page.

    Format and constraints
    recentCursor schema
    {
      "type": "string",
      "format": "uuid"
    }

Successful responses

200 · BusinessCustomerAppointmentOverview

Requested sections from the same server cutoff.

Cache-Control · Keep this customer-specific response private to the current request.
Cache-Control schema
{
  "type": "string",
  "const": "no-store"
}

application/json · BusinessCustomerAppointmentOverview

At least one of these variants must match.

  • businessCustomerIdstring · uuidRequired
  • asOfstring · date-timeRequired
  • recentobjectOptional
    View nested fields
    • itemsarrayRequired

      maxItems: 20

      View nested fields
      • []objectArray item
        View nested fields
        • appointmentIdstring · uuidRequired
        • startAtstring · date-timeRequired
        • endAtstring · date-timeRequired
        • timezoneanyOf (string | null)Required

          At least one of these variants must match.

          View nested fields
          • anyOf 1stringSchema branch

            maxLength: 100

          • anyOf 2nullSchema branch
        • statusstringRequired

          Allowed values: ["PENDING","CONFIRMED","NOW","COMPLETED","CANCELLED","MISSED"]

        • approvalRequiredbooleanRequired

          Customer request requiring a clinic decision. Existing appointments and manually entered appointments are preserved.

        • serviceIdanyOf (string | null)Required

          At least one of these variants must match.

          View nested fields
          • anyOf 1string · uuidSchema branch
          • anyOf 2nullSchema branch
        • serviceNameanyOf (object | null)Required

          At least one of these variants must match.

          View nested fields
          • anyOf 1objectSchema branch
            View branch fields and rules
            • hestringOptional in this branch
            • arstringOptional in this branch
            • enstringOptional in this branch
            • additionalPropertiesno value allowedSchema rule
          • anyOf 2nullSchema branch
        • providerIdanyOf (string | null)Required

          At least one of these variants must match.

          View nested fields
          • anyOf 1string · uuidSchema branch
          • anyOf 2nullSchema branch
        • providerNameanyOf (object | null)Required

          At least one of these variants must match.

          View nested fields
          • anyOf 1objectSchema branch
            View branch fields and rules
            • hestringOptional in this branch
            • arstringOptional in this branch
            • enstringOptional in this branch
            • additionalPropertiesno value allowedSchema rule
          • anyOf 2nullSchema branch
        • additionalPropertiesno value allowedSchema rule
    • hasMorebooleanRequired

      Another matching appointment is visible in this section under the same grant and filters.

    • nextCursorstring · uuidOptional

      Available only when recent pagination was requested and at least one further authorized match exists. Pass this opaque value as recentCursor.

    • additionalPropertiesno value allowedSchema rule
    • dependentSchemas: nextCursorobjectSchema rule
      View branch fields and rules
      • hasMorebooleanOptional in this branch

        Value: true

  • upcomingobjectOptional
    View nested fields
    • itemsarrayRequired

      maxItems: 20

      View nested fields
      • []objectArray item
        View nested fields
        • appointmentIdstring · uuidRequired
        • startAtstring · date-timeRequired
        • endAtstring · date-timeRequired
        • timezoneanyOf (string | null)Required

          At least one of these variants must match.

          View nested fields
          • anyOf 1stringSchema branch

            maxLength: 100

          • anyOf 2nullSchema branch
        • statusstringRequired

          Allowed values: ["PENDING","CONFIRMED","NOW","COMPLETED","CANCELLED","MISSED"]

        • approvalRequiredbooleanRequired

          Customer request requiring a clinic decision. Existing appointments and manually entered appointments are preserved.

        • serviceIdanyOf (string | null)Required

          At least one of these variants must match.

          View nested fields
          • anyOf 1string · uuidSchema branch
          • anyOf 2nullSchema branch
        • serviceNameanyOf (object | null)Required

          At least one of these variants must match.

          View nested fields
          • anyOf 1objectSchema branch
            View branch fields and rules
            • hestringOptional in this branch
            • arstringOptional in this branch
            • enstringOptional in this branch
            • additionalPropertiesno value allowedSchema rule
          • anyOf 2nullSchema branch
        • providerIdanyOf (string | null)Required

          At least one of these variants must match.

          View nested fields
          • anyOf 1string · uuidSchema branch
          • anyOf 2nullSchema branch
        • providerNameanyOf (object | null)Required

          At least one of these variants must match.

          View nested fields
          • anyOf 1objectSchema branch
            View branch fields and rules
            • hestringOptional in this branch
            • arstringOptional in this branch
            • enstringOptional in this branch
            • additionalPropertiesno value allowedSchema rule
          • anyOf 2nullSchema branch
        • additionalPropertiesno value allowedSchema rule
    • hasMorebooleanRequired

      Another matching appointment is visible in this section under the same grant and filters.

    • additionalPropertiesno value allowedSchema rule
  • anyOf 1unspecifiedSchema branch
    View branch fields and rules
    • recentunspecifiedRequired in this branch

      Presence constraint in this rule; evaluate its enclosing condition or negation. The field’s type may be defined elsewhere.

  • anyOf 2unspecifiedSchema branch
    View branch fields and rules
    • upcomingunspecifiedRequired in this branch

      Presence constraint in this rule; evaluate its enclosing condition or negation. The field’s type may be defined elsewhere.

  • additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "businessCustomerId": {
      "type": "string",
      "format": "uuid"
    },
    "asOf": {
      "type": "string",
      "format": "date-time"
    },
    "recent": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "items": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "appointmentId": {
                "type": "string",
                "format": "uuid"
              },
              "startAt": {
                "type": "string",
                "format": "date-time"
              },
              "endAt": {
                "type": "string",
                "format": "date-time"
              },
              "timezone": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 100
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "status": {
                "enum": [
                  "PENDING",
                  "CONFIRMED",
                  "NOW",
                  "COMPLETED",
                  "CANCELLED",
                  "MISSED"
                ]
              },
              "approvalRequired": {
                "type": "boolean",
                "description": "Customer request requiring a clinic decision. Existing appointments and manually entered appointments are preserved."
              },
              "serviceId": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "serviceName": {
                "anyOf": [
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "he": {
                        "type": "string"
                      },
                      "ar": {
                        "type": "string"
                      },
                      "en": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "providerId": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "providerName": {
                "anyOf": [
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "he": {
                        "type": "string"
                      },
                      "ar": {
                        "type": "string"
                      },
                      "en": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "appointmentId",
              "startAt",
              "endAt",
              "timezone",
              "status",
              "approvalRequired",
              "serviceId",
              "serviceName",
              "providerId",
              "providerName"
            ]
          },
          "maxItems": 20
        },
        "hasMore": {
          "type": "boolean",
          "description": "Another matching appointment is visible in this section under the same grant and filters."
        },
        "nextCursor": {
          "type": "string",
          "format": "uuid",
          "description": "Available only when recent pagination was requested and at least one further authorized match exists. Pass this opaque value as recentCursor."
        }
      },
      "required": [
        "items",
        "hasMore"
      ],
      "dependentSchemas": {
        "nextCursor": {
          "properties": {
            "hasMore": {
              "const": true
            }
          }
        }
      }
    },
    "upcoming": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "items": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "appointmentId": {
                "type": "string",
                "format": "uuid"
              },
              "startAt": {
                "type": "string",
                "format": "date-time"
              },
              "endAt": {
                "type": "string",
                "format": "date-time"
              },
              "timezone": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 100
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "status": {
                "enum": [
                  "PENDING",
                  "CONFIRMED",
                  "NOW",
                  "COMPLETED",
                  "CANCELLED",
                  "MISSED"
                ]
              },
              "approvalRequired": {
                "type": "boolean",
                "description": "Customer request requiring a clinic decision. Existing appointments and manually entered appointments are preserved."
              },
              "serviceId": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "serviceName": {
                "anyOf": [
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "he": {
                        "type": "string"
                      },
                      "ar": {
                        "type": "string"
                      },
                      "en": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "providerId": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "uuid"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "providerName": {
                "anyOf": [
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "he": {
                        "type": "string"
                      },
                      "ar": {
                        "type": "string"
                      },
                      "en": {
                        "type": "string"
                      }
                    }
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "appointmentId",
              "startAt",
              "endAt",
              "timezone",
              "status",
              "approvalRequired",
              "serviceId",
              "serviceName",
              "providerId",
              "providerName"
            ]
          },
          "maxItems": 20
        },
        "hasMore": {
          "type": "boolean",
          "description": "Another matching appointment is visible in this section under the same grant and filters."
        }
      },
      "required": [
        "items",
        "hasMore"
      ]
    }
  },
  "required": [
    "businessCustomerId",
    "asOf"
  ],
  "anyOf": [
    {
      "required": [
        "recent"
      ]
    },
    {
      "required": [
        "upcoming"
      ]
    }
  ]
}

Errors and recovery

Error responses declared in the contract (8)

The preview contract shares generic error definitions across operations. This list is not an exhaustive list of runtime errors.

401 · Missing or invalid Management credential.

application/json · Error

  • errorobjectRequired
    View nested fields
    • codestringRequired
    • requestIdstring · uuidRequired
    • retryAfterintegerOptional

      minimum: 1

    • additionalPropertiesno value allowedSchema rule
  • additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string"
        },
        "requestId": {
          "type": "string",
          "format": "uuid"
        },
        "retryAfter": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": [
        "code",
        "requestId"
      ]
    }
  },
  "required": [
    "error"
  ]
}
403 · Missing appointment scope or calendar grant, a requested provider outside that grant, or a browser Origin.

application/json · Error

  • errorobjectRequired
    View nested fields
    • codestringRequired
    • requestIdstring · uuidRequired
    • retryAfterintegerOptional

      minimum: 1

    • additionalPropertiesno value allowedSchema rule
  • additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string"
        },
        "requestId": {
          "type": "string",
          "format": "uuid"
        },
        "retryAfter": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": [
        "code",
        "requestId"
      ]
    }
  },
  "required": [
    "error"
  ]
}
405 · Method not allowed.

application/json · Error

  • errorobjectRequired
    View nested fields
    • codestringRequired
    • requestIdstring · uuidRequired
    • retryAfterintegerOptional

      minimum: 1

    • additionalPropertiesno value allowedSchema rule
  • additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string"
        },
        "requestId": {
          "type": "string",
          "format": "uuid"
        },
        "retryAfter": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": [
        "code",
        "requestId"
      ]
    }
  },
  "required": [
    "error"
  ]
}
409 · PROJECTION_CHANGED. Calendar grant revision changed. Restart from the first page under the current grant.

application/json · Error

  • errorobjectRequired
    View nested fields
    • codestringRequired
    • requestIdstring · uuidRequired
    • retryAfterintegerOptional

      minimum: 1

    • additionalPropertiesno value allowedSchema rule
  • additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string"
        },
        "requestId": {
          "type": "string",
          "format": "uuid"
        },
        "retryAfter": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": [
        "code",
        "requestId"
      ]
    }
  },
  "required": [
    "error"
  ]
}
410 · CURSOR_EXPIRED. The cursor expired, is unknown or belongs to a different customer or credential. Restart from the first page.

application/json · Error

  • errorobjectRequired
    View nested fields
    • codestringRequired
    • requestIdstring · uuidRequired
    • retryAfterintegerOptional

      minimum: 1

    • additionalPropertiesno value allowedSchema rule
  • additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string"
        },
        "requestId": {
          "type": "string",
          "format": "uuid"
        },
        "retryAfter": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": [
        "code",
        "requestId"
      ]
    }
  },
  "required": [
    "error"
  ]
}
422 · Invalid customer UUID, duplicate or unknown query parameter, unsupported filter, invalid limit, both limits zero, or conflicting pagination parameters.

application/json · Error

  • errorobjectRequired
    View nested fields
    • codestringRequired
    • requestIdstring · uuidRequired
    • retryAfterintegerOptional

      minimum: 1

    • additionalPropertiesno value allowedSchema rule
  • additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string"
        },
        "requestId": {
          "type": "string",
          "format": "uuid"
        },
        "retryAfter": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": [
        "code",
        "requestId"
      ]
    }
  },
  "required": [
    "error"
  ]
}
429 · Request quota reached, or allocation of a pagination cursor exceeded the calendar capacity (SNAPSHOT_LIMIT). A plain overview allocates no cursor.
Retry-After · Retry delay in seconds. SNAPSHOT_LIMIT returns 1800. Other quota responses may return a different delay.
Retry-After schema
{
  "type": "integer",
  "minimum": 0
}

application/json · Error

  • errorobjectRequired
    View nested fields
    • codestringRequired
    • requestIdstring · uuidRequired
    • retryAfterintegerOptional

      minimum: 1

    • additionalPropertiesno value allowedSchema rule
  • additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string"
        },
        "requestId": {
          "type": "string",
          "format": "uuid"
        },
        "retryAfter": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": [
        "code",
        "requestId"
      ]
    }
  },
  "required": [
    "error"
  ]
}
503 · Service temporarily unavailable.

application/json · Error

  • errorobjectRequired
    View nested fields
    • codestringRequired
    • requestIdstring · uuidRequired
    • retryAfterintegerOptional

      minimum: 1

    • additionalPropertiesno value allowedSchema rule
  • additionalPropertiesno value allowedSchema rule
Complete schema and nested fields
JSON Schema
{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "error": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "code": {
          "type": "string"
        },
        "requestId": {
          "type": "string",
          "format": "uuid"
        },
        "retryAfter": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": [
        "code",
        "requestId"
      ]
    }
  },
  "required": [
    "error"
  ]
}