Skip to content

App Functions

The Apps SDK exposes utility functions for OAuth and app tokens, JWT validation, and common Crowdin API tasks (files, folders, translations, webhooks, and subscriptions).

import { generateOAuthToken } from '@crowdin/app-project-module/functions/token';
generateOAuthToken({
clientId: 'app_client_id',
clientSecret: 'app_client_secret',
code: 'code_from_install_event',
});

These helpers are meant to speed up app development and Crowdin API integration. For parameters, return types, and edge cases, use the JSDoc on each export.

@crowdin/app-project-module/functions/token

Method nameDescription
fetchAppTokenFetches an API token for communication with the Crowdin API
fetchAgentTokenFetches an Agent API token for communication with the Crowdin API
fetchAppWithCodeTokenFetches an app API token using an authorization code for the Crowdin API
generateOAuthTokenGenerates an OAuth token for communication with the Crowdin API
refreshOAuthTokenRefreshes an OAuth token when it has expired
constructCrowdinIdFromJwtPayloadBuilds a Crowdin user-and-project id from JWT context
getProjectIdExtracts the project id from a Crowdin id
parseCrowdinIdParses organization (id or domain), project id, and user id from a Crowdin id
validateJwtTokenValidates the JWT issued for your app

@crowdin/app-project-module/functions/crowdin

Method nameDescription
updateOrCreateFileCreates or updates a file in Crowdin
getFolderGets a folder and the files under it
getOrCreateFolderReturns a folder and its files, or creates the folder if it does not exist
uploadTranslationsUploads a file to storage and sends an upload-translations request
updateSourceFilesUpdates source files under a given directory
handleTranslationsRuns a side effect for each translated file
createOrUpdateWebhookCreates or updates a webhook
getSubscriptionReturns subscription information for the app
  • Context — JWT payload and project fields used alongside token helpers
  • Job — long-running project integration tasks that often call Crowdin helpers
  • Project integration — sample that uses @crowdin/app-project-module/functions/crowdin
  • Security best practices — securing custom routes that rely on Crowdin JWTs and API access