npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

node-koyeb-api

v1.0.7

Published

Koyeb API Wrapper

Downloads

54

Readme

Koyeb API Wrapper

This is a Node.js wrapper for the Koyeb API, providing an easy-to-use interface for managing your Koyeb resources programmatically.

Installation

npm install node-koyeb-api

Getting Your Koyeb API Token

Before using this wrapper, you need to obtain an API token from Koyeb. Follow these steps:

  1. Log in to your Koyeb account at https://app.koyeb.com/.
  2. Click on your profile picture in the top right corner and select "Settings" from the dropdown menu.
  3. In the left sidebar, click on "API" under the "Account" section.
  4. Click the "Create API Key" button.
  5. Give your API key a name (e.g., "API Wrapper Access").
  6. Select the appropriate scope for your needs. For full access, choose "Full Access".
  7. Click "Create" to generate your API token.
  8. Copy the displayed token immediately. For security reasons, Koyeb will only show it once.

Keep this token secure and do not share it publicly. You'll use this token to authenticate your requests when using the Koyeb API wrapper.

Usage

First, import the Koyeb class and create an instance with your API token:

const Koyeb = require('node-koyeb-api');
const koyeb = new Koyeb('your-api-token');

API Reference

Apps

Get all apps

const apps = await koyeb.getApps();
console.log(apps);

Get app info

const appInfo = await koyeb.getAppInfo('my-app-name');
console.log(appInfo);

Create a new app

const newApp = await koyeb.createApp('new-app-name', 'App description');
console.log(newApp);

Delete an app

await koyeb.deleteApp('app-to-delete');
console.log('App deleted');

Services

Get all services

const services = await koyeb.getServices();
console.log(services);

Get service info

const serviceInfo = await koyeb.getServiceInfo('service-id');
console.log(serviceInfo);

Redeploy a service

const success = await koyeb.reDeploy('my-app-name');
console.log('Redeployment successful:', success);

Pause a service

await koyeb.pauseService('my-app-name');
console.log('Service paused');

Resume a service

await koyeb.resumeService('my-app-name');
console.log('Service resumed');

Environment Variables

Set an environment variable

await koyeb.setEnv({
  key: 'MY_VAR',
  value: 'my-value',
  serviceName: 'my-app-name'
});
console.log('Environment variable set');

Get all environment variables

const envVars = await koyeb.getAllEnvVars('my-app-name');
console.log(envVars);

Deployments

Get deployments for an app

const deployments = await koyeb.getDeployments('my-app-name');
console.log(deployments);

Create a new deployment

const newDeployment = await koyeb.createDeployment('my-app-name', {
  // deployment definition
});
console.log(newDeployment);

Domains

Get domains for an app

const domains = await koyeb.getDomains('my-app-name');
console.log(domains);

Add a domain to an app

const newDomain = await koyeb.addDomain('my-app-name', 'example.com');
console.log(newDomain);

Remove a domain

await koyeb.removeDomain('domain-id');
console.log('Domain removed');

Logs

Get logs for an app

const logs = await koyeb.getLogs('my-app-name', 100);
console.log(logs);

Other

List activities

const activities = await koyeb.listActivities();
console.log(activities);

Get available regions

const regions = await koyeb.getRegions();
console.log(regions);

Get instances for an app

const instances = await koyeb.getInstances('my-app-name');
console.log(instances);

Error Handling

All methods throw errors if something goes wrong. It's recommended to use try-catch blocks:

try {
  const apps = await koyeb.getApps();
  console.log(apps);
} catch (error) {
  console.error('Error:', error.message);
}

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License.