ts-mailcow-api
    Preparing search index...

    ts-mailcow-api

    TypeScript wrapper for the mailcow API

    npm version Build Status License Downloads GitHub Pages

    Provides typing and a easy to use interface for the Mailcow API.

    The interface is exposed via the MailcowClient class. It's typedoc reference can be found here.

    To use the client, create a new wrapper using the base url and API_KEY.

    import MailCowClient from "./index";

    // Create MailCowClient based on BASE_URL and API_KEY
    const mcc = new MailCowClient(
    "https://demo.mailcow.email/api/v1",
    "390448-22B69F-FA37D9-19701B-6F033F",
    );

    Then you can use the created wrapper for promised-based API calls according to the Mailcow API specification.

    // Get all the mailboxes available.
    mcc.mailbox
    .get()
    .then((e) => {
    // Print all mailboxes.
    console.log(JSON.stringify(e, null, 4));
    })
    .catch((e) => {
    // Error handling.
    console.log(e);
    });

    The Mailcow OpenAPI spec doesn’t pass validation and isn’t RESTful (e.g. POST /api/v1/add/domain). If Mailcow ever fixes the naming or structure, a generated client would break. This wrapper acts as a middleman, so those changes can be patched internally without ruining the client interface.