openapi: 3.2.0 info: title: Matomo Reporting API for plugin Languages Manager API version: 1.0.0 description: The LanguagesManager API lets you access existing Matomo translations, and change Users languages preferences. "getTranslationsForLanguage" will return all translation strings for a given language, so you can leverage Matomo translations in your application (and automatically benefit from the 40+ translations!). This is mostly useful to developers who integrate Matomo API results in their own application. You can also request the default language to load for a user via "getLanguageForUser", or update it via "setLanguageForUser". servers: - url: https://demo-proxy.innocraft.cloud/ description: Current Matomo instance security: - MatomoToken: [] tags: - name: LanguagesManager description: The LanguagesManager API lets you access existing Matomo translations, and change Users languages preferences. "getTranslationsForLanguage" will return all translation strings for a given language, so you can leverage Matomo translations in your application (and automatically benefit from the 40+ translations!). This is mostly useful to developers who integrate Matomo API results in their own application. You can also request the default language to load for a user via "getLanguageForUser", or update it via "setLanguageForUser". paths: /index.php?module=API&method=LanguagesManager.isLanguageAvailable: get: tags: - LanguagesManager description: Returns whether a language code can be used in the current Matomo instance. operationId: LanguagesManager.isLanguageAvailable parameters: - $ref: '#/components/parameters/formatOptional' - name: languageCode in: query description: The ISO language code to validate. required: true schema: type: string example: en - name: _ignoreConfig in: query description: Whether to ignore the configured language allowlist. required: false schema: type: boolean default: false responses: '200': description: 'True if the language is available, `false` otherwise. 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=LanguagesManager.getAvailableLanguages: get: tags: - LanguagesManager description: Returns the available Matomo language codes. operationId: LanguagesManager.getAvailableLanguages parameters: - $ref: '#/components/parameters/formatOptional' - name: _ignoreConfig in: query description: Whether to ignore the configured language allowlist. required: false schema: type: boolean default: false responses: '200': description: 'Available ISO language codes. 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=LanguagesManager.getAvailableLanguagesInfo: get: tags: - LanguagesManager description: Returns translation coverage information for each available language. operationId: LanguagesManager.getAvailableLanguagesInfo parameters: - $ref: '#/components/parameters/formatOptional' - name: excludeNonCorePlugins in: query description: Whether to exclude non-core plugins from the translation percentage calculation. required: false schema: type: boolean default: true - name: _ignoreConfig in: query description: Whether to ignore the configured language allowlist. required: false schema: type: boolean default: false responses: '200': description: 'Translation metadata for each available language, including code, names, translators, and completion percentage. 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=LanguagesManager.getAvailableLanguageNames: get: tags: - LanguagesManager description: Returns the available languages with their localized and English names. operationId: LanguagesManager.getAvailableLanguageNames parameters: - $ref: '#/components/parameters/formatOptional' - name: _ignoreConfig in: query description: Whether to ignore the configured language allowlist. required: false schema: type: boolean default: false responses: '200': description: 'Available languages with `code`, `name`, and `english_name` fields. 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=LanguagesManager.getTranslationsForLanguage: get: tags: - LanguagesManager description: Returns translation strings for a specific language across core and loaded plugins. operationId: LanguagesManager.getTranslationsForLanguage parameters: - $ref: '#/components/parameters/formatOptional' - name: languageCode in: query description: The ISO language code to load. required: true schema: type: string example: en responses: '200': description: 'Translation entries with `label` and `value` keys, or `false` if the language is unavailable. 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=LanguagesManager.getLanguageForUser: get: tags: - LanguagesManager description: Returns the saved language preference for a user. operationId: LanguagesManager.getLanguageForUser parameters: - $ref: '#/components/parameters/formatOptional' - name: login in: query description: The user login to read the language for. required: true schema: type: string example: alice responses: '200': description: 'The saved language code, or `false` for the anonymous user. Example responses require Super User access. Use Try it out to see a live response.' '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=LanguagesManager.setLanguageForUser: get: tags: - LanguagesManager description: Stores the language preference for a user. operationId: LanguagesManager.setLanguageForUser parameters: - $ref: '#/components/parameters/formatOptional' - name: login in: query description: The user login to update. required: true schema: type: string example: alice - name: languageCode in: query description: The ISO language code to store. required: true schema: type: string example: en responses: '200': description: '`true` if the language was stored, `false` if the language code is unavailable. Example responses require Super User access. Use Try it out to see a live response.' '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=LanguagesManager.uses12HourClockForUser: get: tags: - LanguagesManager description: Returns whether a user prefers 12-hour time formatting. operationId: LanguagesManager.uses12HourClockForUser parameters: - $ref: '#/components/parameters/formatOptional' - name: login in: query description: The user login to query. required: true schema: type: string example: alice responses: '200': description: '`true` if the user uses a 12-hour clock, `false` otherwise or for the anonymous user. Example responses require Super User access. Use Try it out to see a live response.' '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=LanguagesManager.set12HourClockForUser: get: tags: - LanguagesManager description: Stores whether a user prefers 12-hour time formatting. operationId: LanguagesManager.set12HourClockForUser parameters: - $ref: '#/components/parameters/formatOptional' - name: login in: query description: The user login to update. required: true schema: type: string example: alice - name: use12HourClock in: query description: Whether to enable 12-hour clock formatting. required: true schema: type: boolean example: true responses: '200': description: '`true` if the preference was stored, `false` for the anonymous user. Example responses require Super User access. Use Try it out to see a live response.' '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/