{"id":19703477,"url":"https://github.com/crowdin/crowdin-api-client-js","last_synced_at":"2026-04-01T17:20:21.034Z","repository":{"id":37768267,"uuid":"188180870","full_name":"crowdin/crowdin-api-client-js","owner":"crowdin","description":"JavaScript client library for Crowdin API","archived":false,"fork":false,"pushed_at":"2026-03-31T07:21:39.000Z","size":22395,"stargazers_count":137,"open_issues_count":1,"forks_count":64,"subscribers_count":15,"default_branch":"master","last_synced_at":"2026-03-31T09:36:23.765Z","etag":null,"topics":["api","client","hacktoberfest","javascript","js","node-js","nodejs","sdk","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@crowdin/crowdin-api-client","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crowdin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2019-05-23T07:10:56.000Z","updated_at":"2026-03-31T07:21:40.000Z","dependencies_parsed_at":"2022-07-13T02:40:25.894Z","dependency_job_id":"e1e0905c-dfa4-4c2d-99e0-d3262add1099","html_url":"https://github.com/crowdin/crowdin-api-client-js","commit_stats":{"total_commits":261,"total_committers":19,"mean_commits":"13.736842105263158","dds":0.5363984674329502,"last_synced_commit":"5fb7f6688729af5bbe5fb875eb453359da6a6b22"},"previous_names":[],"tags_count":153,"template":false,"template_full_name":null,"purl":"pkg:github/crowdin/crowdin-api-client-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crowdin%2Fcrowdin-api-client-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crowdin%2Fcrowdin-api-client-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crowdin%2Fcrowdin-api-client-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crowdin%2Fcrowdin-api-client-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crowdin","download_url":"https://codeload.github.com/crowdin/crowdin-api-client-js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crowdin%2Fcrowdin-api-client-js/sbom","scorecard":{"id":309711,"data":{"date":"2025-08-11","repo":{"name":"github.com/crowdin/crowdin-api-client-js","commit":"b1992716acf9123d3592bce591ac23734ad81f3c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5.1,"checks":[{"name":"Code-Review","score":4,"reason":"Found 5/12 approved changesets -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":10,"reason":"30 commit(s) and 5 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Info: jobLevel 'contents' permission set to 'read': .github/workflows/publish.yml:14","Warn: jobLevel 'contents' permission set to 'write': .github/workflows/release.yml:25","Warn: jobLevel 'contents' permission set to 'write': .github/workflows/release.yml:18","Warn: no topLevel permission defined: .github/workflows/basic.yml:1","Warn: no topLevel permission defined: .github/workflows/dependency-analysis.yml:1","Warn: no topLevel permission defined: .github/workflows/docs.yml:1","Warn: no topLevel permission defined: .github/workflows/lint-pr-title.yml:1","Warn: no topLevel permission defined: .github/workflows/publish.yml:1","Warn: no topLevel permission defined: .github/workflows/release.yml:1"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":1,"reason":"dependency not pinned by hash detected -- score normalized to 1","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/basic.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/crowdin/crowdin-api-client-js/basic.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/basic.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/crowdin/crowdin-api-client-js/basic.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/basic.yml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/crowdin/crowdin-api-client-js/basic.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/basic.yml:64: update your workflow using https://app.stepsecurity.io/secureworkflow/crowdin/crowdin-api-client-js/basic.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/basic.yml:67: update your workflow using https://app.stepsecurity.io/secureworkflow/crowdin/crowdin-api-client-js/basic.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/basic.yml:79: update your workflow using https://app.stepsecurity.io/secureworkflow/crowdin/crowdin-api-client-js/basic.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/basic.yml:94: update your workflow using https://app.stepsecurity.io/secureworkflow/crowdin/crowdin-api-client-js/basic.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/basic.yml:102: update your workflow using https://app.stepsecurity.io/secureworkflow/crowdin/crowdin-api-client-js/basic.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/dependency-analysis.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/crowdin/crowdin-api-client-js/dependency-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/docs.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/crowdin/crowdin-api-client-js/docs.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/docs.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/crowdin/crowdin-api-client-js/docs.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/docs.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/crowdin/crowdin-api-client-js/docs.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/lint-pr-title.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/crowdin/crowdin-api-client-js/lint-pr-title.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/crowdin/crowdin-api-client-js/publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/crowdin/crowdin-api-client-js/publish.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/crowdin/crowdin-api-client-js/release.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/crowdin/crowdin-api-client-js/release.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/basic.yml:50","Warn: npmCommand not pinned by hash: .github/workflows/basic.yml:86","Warn: npmCommand not pinned by hash: .github/workflows/publish.yml:26","Info:   0 out of  10 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   7 third-party GitHubAction dependencies pinned","Info:   2 out of   5 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 25 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":8,"reason":"2 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T22:56:21.072Z","repository_id":37768267,"created_at":"2025-08-17T22:56:21.072Z","updated_at":"2025-08-17T22:56:21.072Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31290537,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T13:12:26.723Z","status":"ssl_error","status_checked_at":"2026-04-01T13:12:25.102Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","client","hacktoberfest","javascript","js","node-js","nodejs","sdk","typescript"],"created_at":"2024-11-11T21:17:59.089Z","updated_at":"2026-04-01T17:20:21.022Z","avatar_url":"https://github.com/crowdin.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cpicture\u003e\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://support.crowdin.com/assets/logos/symbol/png/crowdin-symbol-cWhite.png\"\u003e\n    \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://support.crowdin.com/assets/logos/symbol/png/crowdin-symbol-cDark.png\"\u003e\n    \u003cimg width=\"150\" height=\"150\" src=\"https://support.crowdin.com/assets/logos/symbol/png/crowdin-symbol-cDark.png\"\u003e\n  \u003c/picture\u003e\n\u003c/p\u003e\n\n# Crowdin JavaScript client [![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?url=https%3A%2F%2Fgithub.com%2Fcrowdin%2Fcrowdin-api-client-js\u0026text=The%20Crowdin%20JavaScript%20client%20is%20a%20lightweight%20interface%20to%20the%20Crowdin%20API%20that%20works%20in%20any%20JavaScript%20environment)\u0026nbsp;[![GitHub Repo stars](https://img.shields.io/github/stars/crowdin/crowdin-api-client-js?style=social\u0026cacheSeconds=1800)](https://github.com/crowdin/crowdin-api-client-js/stargazers)\n\nThe Crowdin JavaScript client is a lightweight interface to the Crowdin API that works in any JavaScript environment, including web browsers, workers in web browsers, extensions in web browsers or desktop applications, Node.js etc. It provides common services for making API requests.\n\nOur API is a full-featured RESTful API that helps you to integrate localization into your development process. The endpoints that we use allow you to easily make calls to retrieve information and to execute actions needed.\n\n\u003cdiv align=\"center\"\u003e\n\n[**`Docs`**](https://crowdin.github.io/crowdin-api-client-js/modules.html) \u0026nbsp;|\u0026nbsp;\n[**`Examples`**](https://github.com/crowdin/crowdin-api-client-js/blob/master/EXAMPLES.md) \u0026nbsp;|\u0026nbsp;\n[**`Crowdin API`**](https://developer.crowdin.com/api/v2/) \u0026nbsp;|\u0026nbsp;\n[**`Crowdin Enterprise API`**](https://developer.crowdin.com/enterprise/api/v2/)\n\n[![npm](https://img.shields.io/npm/v/@crowdin/crowdin-api-client?logo=npm\u0026cacheSeconds=1800)](https://www.npmjs.com/package/@crowdin/crowdin-api-client)\n[![npm](https://img.shields.io/npm/dt/@crowdin/crowdin-api-client?logo=npm\u0026cacheSeconds=1800)](https://www.npmjs.com/package/@crowdin/crowdin-api-client)\n[![GitHub Used by](https://img.shields.io/static/v1?label=Used%20by\u0026message=4.5k\u0026color=brightgreen\u0026logo=github\u0026cacheSeconds=10000)](https://github.com/crowdin/crowdin-api-client-js/network/dependents)\n[![Tests](https://github.com/crowdin/crowdin-api-client-js/actions/workflows/basic.yml/badge.svg)](https://github.com/crowdin/crowdin-api-client-js/actions/workflows/basic.yml)\n[![codecov](https://codecov.io/gh/crowdin/crowdin-api-client-js/branch/master/graph/badge.svg)](https://codecov.io/gh/crowdin/crowdin-api-client-js)\n[![GitHub contributors](https://img.shields.io/github/contributors/crowdin/crowdin-api-client-js?cacheSeconds=3600)](https://github.com/crowdin/crowdin-api-client-js/graphs/contributors)\n[![License](https://img.shields.io/github/license/crowdin/crowdin-api-client-js?cacheSeconds=3600)](https://github.com/crowdin/crowdin-api-client-js/blob/master/LICENSE)\n  \n\u003c/div\u003e\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n- [Over-The-Air Content Delivery](#over-the-air-content-delivery)\n- [GraphQL API](#graphql-api)\n- [Seeking Assistance](#seeking-assistance)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Installation\n\n### npm\n\n  `npm i @crowdin/crowdin-api-client`\n\n### yarn\n\n  `yarn add @crowdin/crowdin-api-client`\n\n## Quick Start\n\n\u003cdetails\u003e\n\u003csummary\u003eTypescript\u003c/summary\u003e\n\n```typescript\nimport { Client, Credentials, SourceFilesModel } from '@crowdin/crowdin-api-client';\n\n// credentials\nconst credentials: Credentials = {\n  token: 'personalAccessToken',\n  organization: 'organizationName' // optional\n};\n\n// initialization of crowdin client\nconst {\n  projectsGroupsApi,\n  uploadStorageApi,\n  sourceFilesApi,\n  translationsApi\n} = new Client(credentials);\n\n// get project list\nprojectsGroupsApi.listProjects()\n  .then(projects =\u003e console.log(projects))\n  .catch(error =\u003e console.error(error));\n\n// You can also use async/wait. Add `async` keyword to your outer function/method\nasync function getProjects() {\n  try {\n    const projects = await projectsGroupsApi.listProjects();\n    console.log(projects);\n  } catch (error) {\n    console.error(error);\n  }\n}\n\n// Create file with json content to translate\nasync function createFile() {\n  const projectId = 123;\n  const fileData = {\n    title: 'Example',\n    description: 'Some Text'\n  };\n  const storage = await uploadStorageApi.addStorage('file1.json', fileData);\n  const file = await sourceFilesApi.createFile(projectId, {\n    name: 'file1.json',\n    title: 'Sample file',\n    storageId: storage.data.id,\n    type: 'json'\n  });\n  console.log(file);\n}\n\n// Download translations\nasync function downloadTranslations() {\n  const projectId = 123;\n  const fileId = 456;\n  const language = 'de';\n  const downloadLink = await translationsApi.buildProjectFileTranslation(\n    projectId,\n    fileId,\n    {\n      targetLanguageId: language\n    }\n  );\n  const response = await fetch(downloadLink.data.url);\n  const translations = await response.json();\n  console.log(translations);\n}\n```\n\nOr specific API instances:\n\n```typescript\nimport { Credentials, ProjectsGroups } from '@crowdin/crowdin-api-client';\n\n// credentials\nconst credentials: Credentials = {\n  token: 'personalAccessToken',\n  organization: 'organizationName' // optional\n};\n\n// initialization of ProjectsGroups\nconst projectsGroupsApi = new ProjectsGroups(credentials);\n\n// get project list\nprojectsGroupsApi.listProjects()\n  .then(projects =\u003e console.log(projects))\n  .catch(error =\u003e console.error(error));\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eJavascript ES6 modules\u003c/summary\u003e\n\n```javascript\nimport { Client } from '@crowdin/crowdin-api-client';\n\n// initialization of crowdin client\nconst {\n  projectsGroupsApi,\n  uploadStorageApi,\n  sourceFilesApi,\n  translationsApi\n} = new Client({\n  token: 'personalAccessToken',\n  organization: 'organizationName' // optional\n});\n\n// get project list\nprojectsGroupsApi.listProjects()\n  .then(projects =\u003e console.log(projects))\n  .catch(error =\u003e console.error(error));\n\n// You can also use async/wait. Add `async` keyword to your outer function/method\nasync function getProjects() {\n  try {\n    const projects = await projectsGroupsApi.listProjects();\n    console.log(projects);\n  } catch (error) {\n    console.error(error);\n  }\n}\n\n// Create file with json content to translate\nasync function createFile() {\n  const projectId = 123;\n  const fileData = {\n    title: 'Example',\n    description: 'Some Text'\n  };\n  const storage = await uploadStorageApi.addStorage('file1.json', fileData);\n  const file = await sourceFilesApi.createFile(projectId, {\n    name: 'file1.json',\n    title: 'Sample file',\n    storageId: storage.data.id,\n    type: 'json'\n  });\n  console.log(file);\n}\n\n// Download translations\nasync function downloadTranslations() {\n  const projectId = 123;\n  const fileId = 456;\n  const language = 'de';\n  const downloadLink = await translationsApi.buildProjectFileTranslation(\n    projectId,\n    fileId,\n    {\n      targetLanguageId: language\n    }\n  );\n  const response = await fetch(downloadLink.data.url);\n  const translations = await response.json();\n  console.log(translations);\n}\n```\n\nOr specific API instances:\n\n```javascript\nimport { ProjectsGroups } from '@crowdin/crowdin-api-client';\n\n// initialization of ProjectsGroups\nconst projectsGroupsApi = new ProjectsGroups({\n  token: 'personalAccessToken',\n  organization: 'organizationName' // optional\n});\n\n// get project list\nprojectsGroupsApi.listProjects()\n  .then(projects =\u003e console.log(projects))\n  .catch(error =\u003e console.error(error));\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eJavascript CommonJS\u003c/summary\u003e\n\n```javascript\nconst crowdin = require('@crowdin/crowdin-api-client');\n\n// initialization of crowdin client\nconst {\n  projectsGroupsApi,\n  uploadStorageApi,\n  sourceFilesApi,\n  translationsApi\n} = new crowdin.Client({\n  token: 'personalAccessToken',\n  organization: 'organizationName' // optional\n});\n\n// get project list\nprojectsGroupsApi.listProjects()\n  .then(projects =\u003e console.log(projects))\n  .catch(error =\u003e console.error(error));\n\n// You can also use async/wait. Add `async` keyword to your outer function/method\nasync function getProjects() {\n  try {\n    const projects = await projectsGroupsApi.listProjects();\n    console.log(projects);\n  } catch (error) {\n    console.error(error);\n  }\n}\n\n// Create file with json content to translate\nasync function createFile() {\n  const projectId = 123;\n  const fileData = {\n    title: 'Example',\n    description: 'Some Text'\n  };\n  const storage = await uploadStorageApi.addStorage('file1.json', fileData);\n  const file = await sourceFilesApi.createFile(projectId, {\n    name: 'file1.json',\n    title: 'Sample file',\n    storageId: storage.data.id,\n    type: 'json'\n  });\n  console.log(file);\n}\n\n// Download translations\nasync function downloadTranslations() {\n  const projectId = 123;\n  const fileId = 456;\n  const language = 'de';\n  const downloadLink = await translationsApi.buildProjectFileTranslation(\n    projectId,\n    fileId,\n    {\n      targetLanguageId: language\n    }\n  );\n  const response = await fetch(downloadLink.data.url);\n  const translations = await response.json();\n  console.log(translations);\n}\n```\n\nOr specific API instances:\n\n```javascript\nconst ProjectsGroups = require('@crowdin/crowdin-api-client').ProjectsGroups;\n\n// initialization of ProjectsGroups\nconst projectsGroupsApi = new ProjectsGroups({\n  token: 'personalAccessToken',\n  organization: 'organizationName' // optional\n});\n\n// get project list\nprojectsGroupsApi.listProjects()\n  .then(projects =\u003e console.log(projects))\n  .catch(error =\u003e console.error(error));\n```\n\n\u003c/details\u003e\n\nYou can generate Personal Access Token in your Crowdin Account Settings.\n\nFor more examples please check [Examples](EXAMPLES.md)\n\n### List of projects with Fetch API\n\nIn addition if you use client in non-Node.js environment you might have a troubles with http calls.\nThis client uses [axios](https://github.com/axios/axios) which internally uses `http` and `https` Node modules.\nSo there is an option to use http client based on [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) (keep in mind that `fetch` should be available in global scope).\n\n```typescript\nimport { ProjectsGroups } from '@crowdin/crowdin-api-client';\n\nconst projectsGroupsApi = new ProjectsGroups(credentials, {\n  httpClientType: 'fetch'\n});\n```\n\nOr even pass your own http client as `httpClient` property which should implement `HttpClient` interface.\n\n### Fetch all records\n\nIt is possible to fetch all records from paginatable methods (where we have limit and offset in arguments).\n\n```javascript\nimport { ProjectsGroups } from '@crowdin/crowdin-api-client';\n\n// initialization of ProjectsGroups\nconst projectsGroupsApi = new ProjectsGroups({\n  token: 'personalAccessToken',\n  organization: 'organizationName' // optional\n});\n\n// get all projects\nprojectsGroupsApi\n  .withFetchAll()\n  .listProjects()\n  .then(projects =\u003e console.log(projects))\n  .catch(error =\u003e console.error(error));\n\n// get projects but not more than 1000\nprojectsGroupsApi\n  .withFetchAll(1000)\n  .listProjects()\n  .then(projects =\u003e console.log(projects))\n  .catch(error =\u003e console.error(error));\n```\n\n### Retry configuration\n\nThere is a possibility to configure client invoke http calls with retry mechanism.\n\n```typescript\nimport { ProjectsGroups } from '@crowdin/crowdin-api-client';\n\nconst projectsGroupsApi = new ProjectsGroups(credentials, {\n  retryConfig: {\n    retries: 2, // amount of retries (gte 0)\n    waitInterval: 100, // wait interval in ms between retries\n    conditions: [ // array of conditions which will check if retry should not be applied\n      {\n        test(error) {\n          return error.code === 40\n        }\n      }\n    ]\n  }\n});\n```\n\n### Exception handling\n\nIn case of error library will throw an `Error` based exception. This can either be a generic error with an error message and a code, or a validation error that additionally contains validation error codes.\n\n```javascript\nconst crowdin = require('@crowdin/crowdin-api-client');\n\nconst token = '';\n\nconst { translationsApi } = new crowdin.Client({ token });\n\nasync function test() {\n  const project = 123;\n  const dir = 456;\n  try {\n    const res = await translationsApi.buildProjectDirectoryTranslation(project, dir);\n    console.log(JSON.stringify(res));\n  } catch (e) {\n    if (e instanceof crowdin.CrowdinValidationError) {\n      console.log('Validation error');\n    } else if (e instanceof crowdin.CrowdinError) {\n      console.log('Generic error');\n    }\n    console.error(e);\n  }\n}\n\ntest();\n```\n\n### Http request timeout\n\nBy default request timeout will vary on http client implementation and/or environment (e.g. `fetch` uses timeout configured by the browser).  \nBut there is an option to set constant value:\n\n```javascript\nconst crowdin = require('@crowdin/crowdin-api-client');\n\nconst credentials = { token: 'token' };\n\nconst httpRequestTimeout = 60 * 1000; // 60 seconds\n\nconst client = new crowdin.Client(credentials, { httpRequestTimeout });\n```\n\n## Over-The-Air Content Delivery\n\n:dizzy: Recommended for translations delivery to your website or mobile application.\n\nYou can also use the [Crowdin OTA Client JS](https://github.com/crowdin/ota-client-js) library to send the translated content to your web apps via content delivery. Crowdin Content Delivery uses a CDN vault that mirrors your project’s translated content. The updated translations will become available to users much faster.\n\n## GraphQL API\n\nThis library also provides possibility to use [GraphQL API](https://developer.crowdin.com/graphql-api/) (only for Crowdin Enterprise).\n\n```javascript\nconst crowdin = require('@crowdin/crowdin-api-client');\n\nconst client = new crowdin.Client({\n  token: '{token}',\n  organization: '{organization}'\n});\n\nconst query = `\nquery {\n  viewer {\n    projects(first: 50) {\n      edges {\n        node {\n          name\n  \n          files(first: 10) {\n            totalCount\n            edges {\n              node {\n                name\n                type\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n`;\n\nclient\n  .graphql({ query })\n  .then(res =\u003e console.log(JSON.stringify(res, null, 2)));\n```\n\nOr provide custom url for testing\n\n```js\nclient.graphql({ query }, { url: 'http://localhost:3000/api/graphql' });\n```\n\n## Seeking Assistance\n\nIf you find any problems or would like to suggest a feature, please read the [How can I contribute](/CONTRIBUTING.md#how-can-i-contribute) section in our contributing guidelines.\n\nNeed help working with Crowdin JavaScript client or have any questions? [Contact](https://crowdin.com/contacts) Customer Success Service.\n\n## Contributing\n\nIf you want to contribute please read the [Contributing](/CONTRIBUTING.md) guidelines.\n\n## Security\n\n[![FOSSA Status](https://app.fossa.com/api/projects/custom%2B40134%2F192ac70bb4ea8a4ba1051e955aa05572.svg?type=large\u0026issueType=license)](https://app.fossa.com/projects/custom%2B40134%2F192ac70bb4ea8a4ba1051e955aa05572?ref=badge_large\u0026issueType=license)\n\n## License\n\n\u003cpre\u003e\nThe Crowdin JavaScript client is licensed under the MIT License.\nSee the LICENSE.md file distributed with this work for additional\ninformation regarding copyright ownership.\n\nExcept as contained in the LICENSE file, the name(s) of the above copyright\nholders shall not be used in advertising or otherwise to promote the sale,\nuse or other dealings in this Software without prior written authorization.\n\u003c/pre\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrowdin%2Fcrowdin-api-client-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrowdin%2Fcrowdin-api-client-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrowdin%2Fcrowdin-api-client-js/lists"}