🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@logto/api

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@logto/api

Logto API types and clients.

latest
Source
npmnpm
Version
1.34.0
Version published
Weekly downloads
1.8K
19.75%
Maintainers
2
Weekly downloads
 
Created
Source

@logto/api

A TypeScript SDK for interacting with Logto's Management API using client credentials authentication.

Installation

npm install @logto/api

Quick start

Prerequisites

Before using this SDK, you need to:

  • Create a machine-to-machine application in your Logto Console
  • Grant the application access to the Management API
  • Note down the client ID and client secret

For detailed setup instructions, visit: https://a.logto.io/m2m-mapi

Basic usage

Logto Cloud

import { createManagementApi } from '@logto/api/management';

// For Logto Cloud
const { apiClient } = createManagementApi('your-tenant-id', {
  clientId: 'your-client-id',
  clientSecret: 'your-client-secret',
});

// Make API calls
const response = await apiClient.GET('/api/users');
console.log(response.data);

Self-hosted / OSS

import { createManagementApi } from '@logto/api/management';

const { apiClient } = createManagementApi('default', {
  clientId: 'your-client-id',
  clientSecret: 'your-client-secret',
  baseUrl: 'https://your-logto-instance.com',
  apiIndicator: 'https://your-logto-instance.com/api',
});

API documentation

For detailed API documentation, refer to the Logto Management API documentation.

Development

To avoid unnecessary build time in CI, full type generation only happens before publishing. The build script will generate mock types if no types are found.

To explicitly generate types, run:

pnpm generate-types

This will start a local Docker Compose environment, generate types by fetching the OpenAPI endpoints, and then shut down the environment.

FAQs

Package last updated on 28 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts