# Get an activity report

POST https://api.close.com/api/v1/report/activity/
Content-Type: application/json

The activity report returns the organization's metrics per time period (**overview** report) or user (**comparison** report).

Every report accepts the following parameters:

* `datetime_range`: a time range to fetch data for. Either this field or `relative_range` needs to be specified.
* `relative_range`: a relative time range to fetch data for. The allowed values are: `today`, `this-week`, `this-month`, `this-quarter`, `this-year`, `yesterday`, `last-week`, `last-month`, `last-quarter`, `last-year`, and `all-time`. Either this field or `datetime_range` needs to be specified.
* `query`: a query to apply to the report to filter out data.
  The value of the field is a dictionary with the key `type` and any type-specific keys. For now only the type `saved_search` is allowed which takes the extra key `saved_search_id` to specify the ID of a saved search. This parameter is *optional*.
* `users`: a list of user IDs to limit the report results to. This parameter is *optional*.
* `type`: the type of the report. The available values are `overview` and `comparison`.
  This parameter is *mandatory*.
* `metrics`: a list of metrics (see [above](#list-the-predefined-metrics-used-in-activity-reports)) to fetch for the report. This parameter is *mandatory*.

The report can be requested either in a JSON format or in a CSV file. The format can be specified with the `accept` header.

Reference: https://developer.close.com/api/resources/reporting/get-activity

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Close API
  version: 1.0.0
paths:
  /report/activity/:
    post:
      operationId: get-activity
      summary: Get an activity report
      description: >-
        The activity report returns the organization's metrics per time period
        (**overview** report) or user (**comparison** report).


        Every report accepts the following parameters:


        * `datetime_range`: a time range to fetch data for. Either this field or
        `relative_range` needs to be specified.

        * `relative_range`: a relative time range to fetch data for. The allowed
        values are: `today`, `this-week`, `this-month`, `this-quarter`,
        `this-year`, `yesterday`, `last-week`, `last-month`, `last-quarter`,
        `last-year`, and `all-time`. Either this field or `datetime_range` needs
        to be specified.

        * `query`: a query to apply to the report to filter out data.
          The value of the field is a dictionary with the key `type` and any type-specific keys. For now only the type `saved_search` is allowed which takes the extra key `saved_search_id` to specify the ID of a saved search. This parameter is *optional*.
        * `users`: a list of user IDs to limit the report results to. This
        parameter is *optional*.

        * `type`: the type of the report. The available values are `overview`
        and `comparison`.
          This parameter is *mandatory*.
        * `metrics`: a list of metrics (see
        [above](#list-the-predefined-metrics-used-in-activity-reports)) to fetch
        for the report. This parameter is *mandatory*.


        The report can be requested either in a JSON format or in a CSV file.
        The format can be specified with the `accept` header.
      tags:
        - subpackage_reporting
      parameters:
        - name: Authorization
          in: header
          description: Basic authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/reporting_getActivity_Response_200'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                description: Any type
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                description: Any type
        '404':
          description: Not found
          content:
            application/json:
              schema:
                description: Any type
      requestBody:
        content:
          application/json:
            schema:
              description: Any type
servers:
  - url: https://api.close.com/api/v1
components:
  schemas:
    reporting_getActivity_Response_200:
      type: object
      properties: {}
      description: Empty response body
      title: reporting_getActivity_Response_200
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: basic
    OAuth2:
      type: http
      scheme: bearer

```