Getting Started

Install MyLib and make your first API call in under 5 minutes.

Prerequisites

Before you begin, ensure you have:

  • Node.js 18+ (or Python 3.9+, Java 17+)
  • An API key — get one from the dashboard

Installation

npm install mylib
yarn add mylib
pip install mylib

Configuration

Create a client instance with your API key:

import { MyLib } from 'mylib';

const client = new MyLib({
  apiKey: process.env.MYLIB_API_KEY,
  baseURL: 'https://api.example.com/v1', // optional
});

Your First Request

Fetch the list of users in your organization:

const users = await client.users.list({ limit: 10 });
console.log(users.data);

Expected response:

{
  "data": [
    { "id": "usr_abc123", "name": "Alice", "email": "alice@example.com" }
  ],
  "meta": { "page": 1, "limit": 10, "total": 1 }
}

Error Handling

MyLib throws typed errors for API failures:

import { MyLib, NotFoundError, AuthError } from 'mylib';

try {
  const user = await client.users.get('nonexistent');
} catch (err) {
  if (err instanceof NotFoundError) {
    console.error('User not found:', err.message);
  } else if (err instanceof AuthError) {
    console.error('Check your API key');
  } else {
    throw err;
  }
}

Next Steps