Team API

Team API quickstart

Use these requests to verify a Team API token, list domains, and create a project.

Before making requests, you'll need a Team API token. See API Tokens for detailed instructions on creating and managing tokens.

Get team details

Retrieve information about your team including name, plan, included monthly volume, and verification status.

import { Lettermint } from "lettermint"; const lettermint = new Lettermint({ teamToken: process.env.LETTERMINT_TEAM_TOKEN!, }); const team = await lettermint.team.retrieve(); console.log(team.name);

Response:

JSONCode
{ "id": "9a8b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d", "name": "Acme Corp", "plan": "starter", "included_volume": 10000, "tier": 10000, "verified_at": "2024-01-15T10:30:00.000Z", "created_at": "2024-01-01T00:00:00.000Z" }

tier is a deprecated compatibility alias for included_volume.

List your domains

Retrieve all verified domains in your team. This endpoint supports cursor-based pagination.

import { Lettermint } from "lettermint"; const lettermint = new Lettermint({ teamToken: process.env.LETTERMINT_TEAM_TOKEN!, }); const domains = await lettermint.domains.list({ page: { size: 30 } }); console.log(domains.data);

Response:

JSONCode
{ "data": [ { "id": "1a2b3c4d", "domain": "example.com", "verified_at": "2024-01-15T10:30:00.000Z", "created_at": "2024-01-10T00:00:00.000Z" } ], "next_cursor": "eyJpZCI6MTUsIl9wb2ludHNUb05leHRJdGVtcyI6dHJ1ZX0", "next_page_url": "https://api.lettermint.co/v1/domains?page[cursor]=eyJpZCI...", "per_page": 30 }

Create a new project

Create a new project within your team. Projects are used to organize your email sending and contain routes.

import { Lettermint } from "lettermint"; const lettermint = new Lettermint({ teamToken: process.env.LETTERMINT_TEAM_TOKEN!, }); const project = await lettermint.projects.create({ name: "Production App", initial_routes: "both", }); console.log(project.data.id);

Set short_token to true when the generated project token needs to work with printers or older devices that reject long token values. It is optional and defaults to false.

Success Response (201):

JSONCode
{ "data": { "id": "5f4e3d2c", "name": "Production App", "smtp_enabled": false, "default_route_id": "7e6d5c4b", "created_at": "2024-01-20T15:45:00.000Z" }, "message": "Project created successfully.", "api_token": "lm_example_project_token" }

Validation Error (422):

JSONCode
{ "message": "The name field is required.", "errors": { "name": ["The name field is required."] } }

Use descriptive names for your resources to make them easier to identify in the dashboard and API responses.

Next steps