# Get user availability

Returns the available slots of a user over a period, computed from their
working time and existing events. Defaults to the current week when
`from`/`to` are omitted.

Endpoint: GET /calendar/users/{userId}/availability
Version: 1.6.0
Security: bearerAuth

## Security:

  - `bearerAuth` (unknown)
    http bearer opaque

## Path parameters:

  - `userId` (integer, required)
    ID of the user (agent/collaborator) whose availability is computed.

## Query parameters:

  - `tz` (string)
    IANA timezone used to format the `start`/`end` datetimes of the returned slots.
Defaults to UTC when omitted.

  - `from` (string)
    Start of the period (local datetime, format YYYY-MM-DDTHH:MM:SS).
Defaults to the start of the current week (Monday 00:00 UTC) when omitted.

  - `to` (string)
    End of the period (local datetime, format YYYY-MM-DDTHH:MM:SS).
Defaults to the end of the current week (Sunday 23:59 UTC) when omitted.

  - `slot_duration` (integer)
    Desired duration of each returned availability slot, in minutes.
When omitted, a default slot granularity is used.

  - `exclude_types` (array)
    Event type keys to ignore when computing availability. Events of these
types do not make the corresponding slots unavailable.

## Response 200:

  - `200` (unknown)
    List of available slots

## Response 200 fields (application/json):

  - `data` (array)

  - `data.start` (string)
    Start of the available slot, formatted in the requested timezone.

  - `data.end` (string)
    End of the available slot, formatted in the requested timezone.

## Response 401:

  - `401` (unknown)
    Authentication required

## Response 401 fields (application/json):

  - `error` (object)

  - `error.code` (string, required)

  - `error.message` (string, required)

## Response 403:

  - `403` (unknown)
    Access denied. The error `code` is always `FORBIDDEN`; the `message` gives the cause:
- `You do not have permission to perform this action.`
 — the access does not

hold the API pack / right required by the endpoint.
- `Insufficient scope for this request.`
 — the resource targeted by the request

(user, customer, product, agency, transaction, ...) is outside the scope of

the authenticated access.
- `Access denied for this editor.`
 /
`Your IP address has been blocked.`
 —

editor or IP restriction.

## Response 403 fields (application/json):

  - `error` (object)

  - `error.code` (string, required)

  - `error.message` (string, required)

## Response 422:

  - `422` (unknown)
    Validation failed

## Response 422 fields (application/json):

  - `error` (object)

  - `error.code` (string)
    Enum: "VALIDATION_ERROR"

  - `error.message` (string)

  - `error.details` (array)

  - `error.details.field` (string)

  - `error.details.message` (string)

## Response 403 examples:

  - `Missing API pack / right` (unknown)

  - `Resource outside the scope of the access` (unknown)

