---
agentTools:
  projectIndex: https://mctime.readme.io/llms.txt
---

# Analytics Data

[block:api-header]
{
  "title": "POST /analytics"
}
[/block]

**Request parameters**

[block:parameters]
{
  "data": {
    "0-0": "analyticsFrom",
    "h-0": "Parameter",
    "h-1": "Type",
    "0-1": "date",
    "h-2": "Description",
    "0-2": "Date from which the analytics results should be considered.\nProvide date in ISO-8601 format, eg. 2022-01-01T00:00:00+00:00",
    "1-0": "analyticsTo",
    "1-1": "date",
    "1-2": "Date until when the analytics results should be considered.\nProvide date in ISO-8601 format, eg. 2022-01-31T00:23:59+00:00",
    "2-0": "exportType",
    "3-0": "pdf",
    "8-0": "csv",
    "11-0": "json",
    "13-0": "recipientEmails",
    "14-0": "emailMessage",
    "15-0": "userIds",
    "16-0": "organizationIds",
    "18-0": "approvalStatuses",
    "19-0": "timeTypes",
    "13-2": "Provide an array of email addresses to whom the pdf or csv exported files should be delivered.\nMandatory if \"export\" for \"pdf\" or \"csv\" is true.",
    "15-2": "Provide an array of user id's for those users which time entries should be considered for the analytics data.\nIf empty, then all users that authenticated user is allowed to see will be considered.",
    "16-2": "Provide an array of organization id's for those organizations which time entries should be considered for the analytics data.\nIf empty, then all groups that authenticated user is allowed to see will be considered.",
    "18-2": "If provided only time entries with this specific approvalStatus(es) will be returned.\nPossible query parameters:\n\"disapproved\", \"not_approved_yet\", \"under_approval\", \"approved\", \"exported\"\n\nIf empty all statuses will be considered.",
    "19-2": "If provided only time entries with this specific timeType(s) will be returned.\nPossible query parameters:\n\"work\", \"parental_leave\", \"worked_rest_period\", \"clocking\", \"statutory_leave\", \"public_holiday_abroad\", \"medical_leave\", \"bad_weather\", \"company_vacation\", \"unpaid_vacation\", \"care_leave\", \"out_office\", \"work_accident_sickness\", \"military_exercize\", \"flextime\", \"unpaid_time_off\", \"home_office\", \"study_leave\", \"paid_time_off\", \"other_leave\", \"vacation_abroad\", \"travel\", \"sick\", \"military_service\", \"jubilee_day\", \"vacation\", \"move\", \"special_leave\", \"free_time\"\n\nIf empty all statuses will be considered.",
    "2-1": "object",
    "2-2": "Provide objects of desired export types which should be delivered as a result.\nPossible export types are:\n\"pdf\", \"csv\" and \"json\"",
    "4-0": "export",
    "4-1": "boolean",
    "4-2": "Provide \"true\" if you want that the results should be exported via email in pdf format, otherwise provide \"false\".",
    "3-1": "object",
    "3-2": "Object of pdf export settings.",
    "5-0": "employeeAnalytics",
    "6-0": "allAnalytics",
    "7-0": "timeEntries",
    "5-1": "boolean",
    "6-1": "boolean",
    "7-1": "boolean",
    "5-2": "Provide \"true\" if you want that in the exported pdf document analytics are provided for every employee, otherwise provide \"false\".",
    "6-2": "Provide \"true\" if you want that in the exported pdf document analytics are provided as totals for all exported employees, otherwise provide \"false\".",
    "7-2": "Provide \"true\" if you want that in the exported pdf document time entries are provided for every employee, otherwise provide \"false\".",
    "9-0": "export",
    "8-1": "object",
    "8-2": "Object of csv export settings.",
    "10-0": "csvDelimiter",
    "9-1": "boolean",
    "9-2": "Provide \"true\" if you want that the results should be exported via email in csv format, otherwise provide \"false\".",
    "10-1": "string",
    "10-2": "Define the csv delimiter by sending either \";\" or \",\" as value.",
    "11-2": "Object of json export settings.",
    "12-0": "export",
    "11-1": "object",
    "12-1": "boolean",
    "12-2": "Provide \"true\" if you want that the results should be returned json format, otherwise provide \"false\".",
    "13-1": "array [string]",
    "14-1": "string",
    "14-2": "Provide an email text message if desired.",
    "15-1": "array [string]",
    "16-1": "array [string]",
    "17-0": "subOrganizations",
    "17-2": "Provide \"true\" if you want that the results should consider all child organizations from the selected \"organizationIds\", otherwise provide \"false\".",
    "17-1": "boolean",
    "18-1": "array [string]",
    "19-1": "array [string]"
  },
  "cols": 3,
  "rows": 20
}
[/block]

Request JSON example

[block:code]
{
  "codes": [
    {
      "code": "{\n    \"analyticsFrom\": \"2022-04-01T00:00:00+03:00\",\n    \"analyticsTo\": \"2022-04-30T00:00:00+03:00\",\n    \"exportType\": \n        {\n            \"pdf\": {\n                \"export\": true,\n                \"employeeAnalytics\": true,\n                \"allAnalytics\": true,\n                \"timeEntries\": true\n            },\n            \"csv\": {\n                \"export\": false,\n                \"csvDelimiter\": \";\"\n            },\n            \"json\": {\n                \"export\": true\n            }\n        },\n    \"recipientEmails\": [ \n        \"john_doe@mail.com\"\n    ],\n    \"emailMessage\": \"Test Email Message\",\n    \"userIds\": [], \n    \"organizationIds\": [ \n        \"87654321-dcba-6789-2345-98klmnopqrst\",\n        \"12345678-abcd-9876-5432-10abcdefghij\"\n    ],\n    \"subOrganizations\": \"true\",\n    \"approvalStatuses\": [], \n    \"timeTypes\": []\n}",
      "language": "json",
      "name": "REQUEST JSON EXAMPLE"
    }
  ]
}
[/block]

**Responses**

[block:parameters]
{
  "data": {
    "h-0": "Code",
    "0-0": "**200** ",
    "h-1": "Title",
    "h-2": "Description",
    "0-1": "Success",
    "0-2": "Returned if request was successful.",
    "1-0": "**400**",
    "2-0": "**401**",
    "1-1": "Bad Request",
    "1-2": "Returned if request was bad.",
    "2-1": "Unauthorized",
    "2-2": "Returned if request was not authorized (eg. due to bad API key).",
    "3-0": "**404**",
    "3-1": "Not Found",
    "3-2": "Returned if request could not be found."
  },
  "cols": 3,
  "rows": 4
}
[/block]

[block:callout]
{
  "type": "info",
  "title": "Info",
  "body": "The response values and totals are returned in milliseconds."
}
[/block]

Response JSON example if **exportType**  "json" is "true:

[block:code]
{
  "codes": [
    {
      "code": "{\n    \"totals\":\n        {\n            \"productive\": {\n                \"normalTime\": 3600000,\n                \"additionalTime\": 3600000,\n                \"breaks\": 0,\n                \"total\": 7200000\n            },\n            \"unproductive\": {\n                \"vacations\": 3600000,\n                \"sickLeaves\": 3600000,\n                \"paidAbsences\": 3600000,\n                \"unpaidAbsences\": 3600000,\n                \"total\": 14400000\n            },\n            \"targetTimes\": {\n                \"current\": 3600000,\n                \"productive\": 3600000,\n                \"total\": 7200000\n            },\n            \"targetTimeDifferences\": {\n                \"positive\": 3600000,\n                \"positiveCurrent\": 3600000,\n                \"negative\": 3600000,\n                \"negativeCurrent\": 3600000,\n                \"totalCurrent\": 3600000,\n                \"total\": 7200000\n            },\n            \"incompleteness\": {\n                \"submittedTimeEntries\": 15,\n                \"missingTimeEntries\": 25,\n                \"total\": 40\n            },            \n            \"organizations\": [\n                {\n                        \"id\": \"12345678-abcd-9876-5432-10abcdefghij\",\n                        \"name\": \"Project ABC\",\n                        \"total\": 3600000\n                    },\n                {\n                        \"id\": \"87654321-dcba-6789-2345-98klmnopqrst\",\n                        \"name\": \"Client ABC\",\n                        \"total\": 3600000\n                    } ]\n        }\n}",
      "language": "json",
      "name": "RESPONSE JSON EXAMPLE"
    }
  ]
}
[/block]