{"id":16222,"library":"snyk-api-ts-client","title":"Snyk API TypeScript Client","description":"This package provides a TypeScript client for interacting with Snyk API v1 endpoints. It is generated from Snyk's API Blueprint definitions, offering type definitions for both request bodies and responses to enhance developer experience with type safety. The current stable version is 1.11.2. The project is explicitly in 'maintenance mode,' meaning new feature development has ceased, with ongoing support limited to bug and security fixes. A critical distinction is that this client exclusively supports Snyk API v1 and does not offer integration with Snyk API v3 endpoints. Releases are irregular, typically driven by necessary bug fixes or updates to the underlying Snyk API v1 definitions. It requires Node.js version 14 or above.","status":"maintenance","version":"1.11.2","language":"javascript","source_language":"en","source_url":"https://github.com/snyk-labs/snyk-api-ts-client","tags":["javascript","typescript"],"install":[{"cmd":"npm install snyk-api-ts-client","lang":"bash","label":"npm"},{"cmd":"yarn add snyk-api-ts-client","lang":"bash","label":"yarn"},{"cmd":"pnpm add snyk-api-ts-client","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core HTTP client for making API requests, frequently updated in patch releases.","package":"axios"}],"imports":[{"note":"The library is TypeScript-first and intended for ESM usage. CommonJS `require` is not officially supported and may lead to issues.","wrong":"const Orgs = require('snyk-api-ts-client')","symbol":"Orgs","correct":"import { Orgs } from 'snyk-api-ts-client'"},{"note":"Most API client classes are named exports, not default exports.","wrong":"import Org from 'snyk-api-ts-client'","symbol":"Org","correct":"import { Org } from 'snyk-api-ts-client'"},{"note":"Specific types for request bodies often reside in nested paths reflecting their associated API resource.","wrong":"import { ProjectsPostBodyType } from 'snyk-api-ts-client'","symbol":"ProjectsPostBodyType","correct":"import { ProjectsPostBodyType } from 'snyk-api-ts-client/dist/client/generated/org'"}],"quickstart":{"code":"import { Org, ProjectsPostBodyType } from 'snyk-api-ts-client';\n\nconst SNYK_API_TOKEN = process.env.SNYK_API_TOKEN ?? ''; // Replace with your Snyk API Token\nconst ORG_ID = 'your-org-id'; // Replace with your Snyk Organization ID\n\nconst main = async () => {\n  if (!SNYK_API_TOKEN || !ORG_ID) {\n    console.error('SNYK_API_TOKEN and ORG_ID must be set in environment variables or hardcoded.');\n    return;\n  }\n\n  try {\n    // Initialize the Org client with authentication and specific orgId\n    const orgClient = new Org({ orgId: ORG_ID, apiToken: SNYK_API_TOKEN });\n\n    // Example: List projects using a POST request with filters\n    const body: ProjectsPostBodyType = { filters: { type: ['npm'], isPrivate: true } };\n    console.log(`Fetching projects for organization ${ORG_ID}...`);\n    const result = await orgClient.projects.post(body);\n\n    console.log('Successfully fetched projects:');\n    if (result && result.projects && result.projects.length > 0) {\n      result.projects.slice(0, 3).forEach((project: any) => {\n        console.log(`  - Project Name: ${project.name}, ID: ${project.id}`);\n      });\n      if (result.projects.length > 3) {\n        console.log(`  ... and ${result.projects.length - 3} more.`);\n      }\n    } else {\n      console.log('No projects found with the specified filters.');\n    }\n\n    // You can also get a full response object (including headers, status) by passing true\n    // const fullResponse = await orgClient.projects.post(body, true);\n    // console.log('Full response status:', fullResponse.status);\n\n  } catch (error: any) {\n    console.error('Error interacting with Snyk API:', error.message);\n    if (error.response) {\n      console.error('API Error Details:', error.response.data);\n    }\n  }\n};\n\nmain();\n","lang":"typescript","description":"This quickstart demonstrates how to initialize the Snyk API client, authenticate using an API token, and list projects for a specific organization using a POST request with filters. It also highlights type usage for request bodies."},"warnings":[{"fix":"Update your code to use `aggregated-issues` or `paths` endpoints. Consult the Snyk API documentation for updated endpoint details and data structures.","message":"The `/issues` endpoint was decommissioned as of version 1.7.3. Developers should migrate to the `/aggregated-issues` endpoint or the `/paths` endpoint for vulnerable path information, which now includes `fixVersion` details.","severity":"deprecated","affected_versions":">=1.7.3"},{"fix":"Ensure your integration targets Snyk API v1. For Snyk API v3 interactions, an alternative client or direct HTTP requests to the v3 API are required.","message":"This client strictly supports Snyk API v1 endpoints. Snyk API v3 endpoints are explicitly not supported, and attempts to use v3-specific functionalities or data structures through this client will fail or result in unexpected behavior.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Be aware of the limited development scope. For new features or breaking API changes in Snyk, you may need to consider alternative integration methods or direct API calls.","message":"The `snyk-api-ts-client` package is in 'maintenance mode'. This means no new features will be developed, and future releases will focus exclusively on bug fixes and security patches. Major API changes or new Snyk functionalities will not be integrated.","severity":"gotcha","affected_versions":">=1.9.1"},{"fix":"Upgrade your Node.js environment to version 14 or higher.","message":"This package requires Node.js version 14 or above to function correctly. Using older Node.js versions (e.g., Node.js 12) may lead to compatibility issues or runtime errors.","severity":"gotcha","affected_versions":">=1.11.2"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"Verify that your `SNYK_API_TOKEN` environment variable or hardcoded token is correct, has the necessary permissions, and has not expired.","cause":"Incorrect or missing Snyk API token, or an expired token.","error":"Error: Request failed with status code 401"},{"fix":"Confirm that the API endpoint or resource you are trying to access is part of Snyk API v1. This client does not support Snyk API v3.","cause":"Attempting to call a Snyk API v3 endpoint or property using this v1-only client.","error":"TypeError: Cannot read properties of undefined (reading 'someV3Endpoint')"},{"fix":"Ensure you are on the latest version of `snyk-api-ts-client`. If the issue persists, the client might not yet reflect the API change due to its maintenance mode, requiring a workaround or manual type assertion.","cause":"The client's generated types are outdated relative to recent Snyk API v1 changes, or you're trying to access a property that doesn't exist.","error":"TS2339: Property 'someNewV1Property' does not exist on type 'V1ResourceType'"}],"ecosystem":"npm"}