openapi: 3.2.0 info: title: Matomo Reporting API for plugin Multi Sites API version: 1.0.0 description: The MultiSites API lets you request the key metrics (visits, page views, revenue) for all Websites in Matomo. servers: - url: https://demo-proxy.innocraft.cloud/ description: Current Matomo instance security: - MatomoToken: [] tags: - name: MultiSites description: The MultiSites API lets you request the key metrics (visits, page views, revenue) for all Websites in Matomo. paths: /index.php?module=API&method=MultiSites.getAll: get: tags: - MultiSites description: Returns a report displaying the total visits, actions and revenue, as well as the evolution of these values, of all existing sites over a specified period of time. operationId: MultiSites.getAll parameters: - $ref: '#/components/parameters/formatOptional' - name: period in: query description: The period to process, processes data for the period containing the specified date. required: true schema: type: string enum: - day - week - month - year - range example: day - name: date in: query description: The date or date range to process. 'YYYY-MM-DD', magic keywords (today, yesterday, lastWeek, lastMonth, lastYear), or date range (ie, 'YYYY-MM-DD,YYYY-MM-DD', lastX, previousX). required: true schema: type: string example: yesterday - name: segment in: query description: 'Custom segment to filter the report. Example: "referrerName==example.com" Supports AND (;) and OR (,) operators.' required: false schema: type: string - name: _restrictSitesToLogin in: query description: Username used internally to restrict the visible sites while a scheduled task is running. required: false schema: type: string - name: enhanced in: query description: '`true` to include additional goal and ecommerce metrics, `false` to return the default metric set.' required: false schema: type: boolean default: false - name: pattern in: query description: Site name or site ID pattern used to limit the matched websites. required: false schema: type: string - name: showColumns in: query description: Metric columns to include, either as a comma-separated list or an array of metric names. required: false schema: oneOf: - type: string default: '[]' - type: array items: type: string default: [] responses: '200': description: 'Report rows for each matched site, including evolution metrics when available. Example responses require Super User access. Use Try it out to see a live response.' content: text/xml: [] application/json: [] '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/ServerError' default: $ref: '#/components/responses/DefaultError' /index.php?module=API&method=MultiSites.getOne: get: tags: - MultiSites description: Returns the MultiSites metrics for a single website. operationId: MultiSites.getOne parameters: - $ref: '#/components/parameters/formatOptional' - name: idSite in: query description: The numeric ID of the website to query. required: true schema: type: integer example: 1 - name: period in: query description: The period to process, processes data for the period containing the specified date. required: true schema: type: string enum: - day - week - month - year - range example: day - name: date in: query description: The date or date range to process. 'YYYY-MM-DD', magic keywords (today, yesterday, lastWeek, lastMonth, lastYear), or date range (ie, 'YYYY-MM-DD,YYYY-MM-DD', lastX, previousX). required: true schema: type: string example: yesterday - name: segment in: query description: 'Custom segment to filter the report. Example: "referrerName==example.com" Supports AND (;) and OR (,) operators.' required: false schema: type: string - name: _restrictSitesToLogin in: query description: Username used internally to restrict the visible sites while a scheduled task is running. required: false schema: type: string - name: enhanced in: query description: '`true` to include additional goal and ecommerce metrics, `false` to return the default metric set.' required: false schema: type: boolean default: false responses: '200': description: 'Metrics for the requested website. Example responses require Super User access. Use Try it out to see a live response.' content: text/xml: [] application/json: [] application/vnd.ms-excel: [] '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/ServerError' default: $ref: '#/components/responses/DefaultError' /index.php?module=API&method=MultiSites.getAllWithGroups: get: tags: - MultiSites description: Returns the MultiSites dashboard response grouped for the widget UI. operationId: MultiSites.getAllWithGroups parameters: - $ref: '#/components/parameters/formatOptional' - name: period in: query description: Period type to query, or `null` to use the request default. required: false schema: type: string - name: date in: query description: Date or date range to query, or `null` to use the request default. required: false schema: type: string - name: segment in: query description: 'Custom segment to filter the report. Example: "referrerName==example.com" Supports AND (;) and OR (,) operators.' required: false schema: type: string - name: pattern in: query description: Search term used to filter the listed websites by name. required: false schema: type: string default: '' - name: filter_limit in: query description: Maximum number of sites to include in the grouped response. required: false schema: type: integer default: 0 responses: '200': description: 'Dashboard totals, last date, and grouped site rows for the MultiSites widget. Example responses require Super User access. Use Try it out to see a live response.' content: text/xml: [] application/json: [] '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' '404': $ref: '#/components/responses/NotFound' '500': $ref: '#/components/responses/ServerError' default: $ref: '#/components/responses/DefaultError' components: responses: NotFound: description: Resource not found. content: text/plain: schema: type: string example: 'Error: The method is not available.' text/html: schema: type: string example: The method is not available. application/json: schema: $ref: '#/components/schemas/Error' application/xml: schema: $ref: '#/components/schemas/ErrorXml' ServerError: description: Unexpected server error. content: text/plain: schema: type: string example: 'Error: There was an error.' text/html: schema: type: string example: There was an error. application/json: schema: $ref: '#/components/schemas/Error' application/xml: schema: $ref: '#/components/schemas/ErrorXml' Unauthorized: description: Authentication failed or missing token. content: text/plain: schema: type: string example: 'Error: You must be logged in to access this functionality.' text/html: schema: type: string example: You must be logged in to access this functionality. application/json: schema: $ref: '#/components/schemas/Error' application/xml: schema: $ref: '#/components/schemas/ErrorXml' Forbidden: description: Authenticated but not allowed to access the resource. content: text/plain: schema: type: string example: 'Error: Not authorised.' text/html: schema: type: string example: Not authorised. application/json: schema: $ref: '#/components/schemas/Error' application/xml: schema: $ref: '#/components/schemas/ErrorXml' DefaultError: description: Default error response (any non-2xx). content: text/plain: schema: type: string example: 'Error: There was an error.' text/html: schema: type: string example: There was an error. application/json: schema: $ref: '#/components/schemas/Error' application/xml: schema: $ref: '#/components/schemas/ErrorXml' BadRequest: description: Bad request (validation or missing parameters). content: text/plain: schema: type: string example: 'Error: There was an error.' text/html: schema: type: string example: There was an error. application/json: schema: $ref: '#/components/schemas/Error' application/xml: schema: $ref: '#/components/schemas/ErrorXml' parameters: formatOptional: name: format in: query description: Response format. Defaults to `xml`. Use `original` to get the original PHP data structure. required: false schema: type: string default: xml enum: - xml - json - csv - tsv - html - rss - original schemas: ErrorXml: description: Generic Matomo error payload in XML. properties: error: properties: message: type: string xml: attribute: true example: There was an error type: object xml: name: error type: object xml: name: result Error: description: Generic Matomo error payload. required: - result - message properties: result: type: string example: error message: type: string example: There was an error code: type: integer type: object additionalProperties: true securitySchemes: MatomoToken: type: http description: Paste your token generated from Personal > Security. Swagger will send it as a Bearer token. scheme: bearer externalDocs: description: Matomo Reporting API developer page url: https://developer.matomo.org/api-reference/reporting-api/