Jira.js is a powerful, production-ready Node.js and browser-compatible TypeScript library that provides seamless interaction with Atlassian Jira Cloud APIs. This npm package offers comprehensive support for:
Perfect for building Jira integrations, automation tools, webhooks, CI/CD pipelines, custom Jira applications, and browser-based Jira management tools.
Install the Jira.js npm package using your preferred package manager. Requires Node.js 20.0.0 or newer.
# Using npm
npm install jira.js
# Using yarn
yarn add jira.js
# Using pnpm
pnpm add jira.js
TypeScript users: Type definitions are included - no additional @types package needed!
Get started with Jira.js in under 5 minutes. This example shows how to create a Jira issue using the TypeScript client:
import { Version3Client } from 'jira.js';
const client = new Version3Client({
host: 'https://your-domain.atlassian.net',
authentication: {
basic: {
email: 'your@email.com',
apiToken: 'YOUR_API_TOKEN', // Create one: https://id.atlassian.com/manage-profile/security/api-tokens
},
},
});
async function createIssue() {
const project = await client.projects.getProject({ projectIdOrKey: 'Your project id or key' });
const newIssue = await client.issues.createIssue({
fields: {
summary: 'Hello Jira.js!',
issuetype: { name: 'Task' },
project: { key: project.key },
},
});
console.log(`Issue created: ${newIssue.id}`);
}
createIssue();
📚 Full API reference, guides, and examples available at: https://mrrefactoring.github.io/jira.js/
The documentation includes:
Jira.js provides comprehensive support for all major Jira Cloud APIs:
All APIs are fully typed with TypeScript definitions, making development faster and safer.
const client = new Version3Client({
host: 'https://your-domain.atlassian.net',
authentication: {
basic: { email: 'YOUR@EMAIL.ORG', apiToken: 'YOUR_API_TOKEN' },
},
});
Only authorization code grants are supported. Implement your own token acquisition flow using Atlassian's OAuth 2.0 documentation.
const client = new Version3Client({
host: 'https://your-domain.atlassian.net',
authentication: {
oauth2: { accessToken: 'YOUR_ACCESS_TOKEN' },
},
});
Errors are categorized as:
HttpException: Server responded with an error (includes parsed error details)AxiosError: Network/configuration issues (e.g., timeouts)Example handling:
try {
await client.issues.getIssue({ issueIdOrKey: 'INVALID-123' });
} catch (error) {
if (error instanceof HttpException) {
console.error('Server error:', error.message);
console.debug('Response headers:', error.cause.response?.headers);
} else if (error instanceof AxiosError) {
console.error('Network error:', error.code);
} else {
console.error('Unexpected error:', error);
}
}
Access endpoints using the client.<group>.<method> pattern:
// Get all projects
const projects = await client.projects.searchProjects();
// Create a sprint
const sprint = await client.sprint.createSprint({ name: 'Q4 Sprint' });
Available API groups:
See full group list in original documentation.
Jira.js supports tree shaking to minimize your bundle size. Import only the modules you need:
// custom-client.ts
import { BaseClient } from 'jira.js';
import { Issues } from 'jira.js/version3';
import { Board } from 'jira.js/agile';
export class CustomClient extends BaseClient {
issues = new Issues(this);
board = new Board(this);
}
// Usage
const client = new CustomClient({ /* config */ });
await client.issues.getIssue({ issueIdOrKey: 'KEY-1' });
Benefits:
Jira.js is perfect for:
Q: Does this work with Jira Server/Data Center?
A: No, Jira.js is designed specifically for Jira Cloud. For on-premise Jira, consider using the REST API directly.
Q: Is TypeScript required?
A: No, but TypeScript is fully supported with comprehensive type definitions. You can use Jira.js with plain JavaScript too.
Q: Can I use this in the browser?
A: Yes! Jira.js works in both Node.js and modern browsers. Make sure to handle CORS if calling Jira APIs from a browser.
Q: How do I handle authentication?
A: Jira.js supports Basic Auth (email + API token) and OAuth 2.0. See the Authentication section above.
Explore our other Atlassian integration libraries:
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
MIT License © MrRefactoring
See LICENSE for details.