REST API for programmatic access to PatternStack package intelligence. Requires a Workspace subscription or higher.
Get started with the PatternStack API in minutes
https://api.patternstack.ai/v1Include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEYGet your API key from Dashboard → API Keys
curl -X GET "https://api.patternstack.ai/v1/packages/search?q=date&ecosystem=npm" \ -H "Authorization: Bearer ts_live_xxxx"
Daily quotas reset at midnight UTC
| Tier | Search | Compare | AI Insights | Security |
|---|---|---|---|---|
Free | - | - | - | - |
Premium | 500/day | 200/day | 100/day | 50/day |
Workspace | 100/day | 50/day | 10/day* | 10/day |
* Free tier AI Insights returns truncated previews (150 chars). Upgrade to Workspace for full responses.
/v1/packages/searchSearch packages with trend and health signals
| Name | Type | Required | Description |
|---|---|---|---|
q | string | Required | Search query |
ecosystem | string | Optional | Filter by ecosystem (npm, pypi, etc.) |
framework | string | Optional | Filter by framework context |
limit | number | Optional | Max results (default: 20, max: 50) |
/v1/packages/compareCompare 2-10 packages with relative rankings
| Name | Type | Required | Description |
|---|---|---|---|
packages | string[] | Required | Array of package names (2-10) |
ecosystem | string | Optional | Ecosystem context |
/v1/insights/explainAI-powered package explanations and recommendations
| Name | Type | Required | Description |
|---|---|---|---|
packages | string[] | Required | Packages to analyze |
question | string | Optional | Specific question to answer |
context | object | Optional | Framework/project context |
/v1/migrations/{package}Get migration paths for declining packages
| Name | Type | Required | Description |
|---|---|---|---|
package | string | Required | Package name (path parameter) |
ecosystem | string | Optional | Package ecosystem |
/v1/trendsTrending packages by ecosystem and framework
| Name | Type | Required | Description |
|---|---|---|---|
ecosystem | string | Required | Ecosystem (npm, pypi, etc.) |
framework | string | Optional | Filter by framework |
direction | string | Optional | rising, declining, or all |
limit | number | Optional | Max results (default: 20) |
/v1/packages/{name}/alternativesFind alternatives to a specific package
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Required | Package name (path parameter) |
ecosystem | string | Optional | Package ecosystem |
/v1/analyzeStateless analysis for CI/CD pipelines
| Name | Type | Required | Description |
|---|---|---|---|
packageJson | object | Optional | package.json contents |
requirementsTxt | string | Optional | requirements.txt contents |
goMod | string | Optional | go.mod contents |
/v1/security/scanVulnerability scanning for dependencies
| Name | Type | Required | Description |
|---|---|---|---|
packageJson | object | Optional | package.json with dependencies |
requirementsTxt | string | Optional | Python requirements |
severityFilter | string | Optional | critical, high, medium, or low |
/v1/stack/defaultsGet canonical industry-standard stack for a framework (agent-optimized)
| Name | Type | Required | Description |
|---|---|---|---|
framework | string | Optional | Framework name (next, django, etc.) |
ecosystem | string | Optional | Filter by ecosystem |
strict_mode | boolean | Optional | Only return required packages |
/v1/stack/alignCompute how well a project aligns with canonical stack
| Name | Type | Required | Description |
|---|---|---|---|
framework | string | Required | Target framework |
packages | string[] | Required | Project packages to analyze |
strictMode | boolean | Optional | Enforce required packages |
/v1/stack/generateGenerate recommended stacks based on use-case requirements (agent-optimized)
| Name | Type | Required | Description |
|---|---|---|---|
useCases | string[] | Required | Use cases: realtime, ai, ecommerce, cms, saas, api, mobile, desktop, cli, data, devtools |
framework | string | Optional | Target framework (next, django, etc.) |
ecosystem | string | Optional | Target ecosystem (npm, pypi, etc.) |
scale | string | Optional | Scale: startup, growth, enterprise |
priorities | string[] | Optional | Priorities: speed, stability, performance, cost |
| Code | HTTP Status | Description |
|---|---|---|
INVALID_API_KEY | 401 | Missing or invalid API key |
INSUFFICIENT_TIER | 403 | Your plan doesn't include this endpoint |
RATE_LIMIT_EXCEEDED | 429 | Too many requests, check Retry-After header |
QUOTA_EXCEEDED | 429 | Daily quota exhausted, resets at midnight UTC |
INVALID_REQUEST | 400 | Invalid parameters or request body |
INTERNAL_ERROR | 500 | Server error, please try again |
| Header | Description |
|---|---|
X-RateLimit-Limit | Your daily quota for this endpoint |
X-RateLimit-Remaining | Remaining requests in current period |
X-RateLimit-Reset | ISO 8601 timestamp when quota resets |
X-API-Version | API version (currently 1.0.0) |
Retry-After | Seconds to wait before retrying (on 429) |
Need help? Contact API support