Browse documentation

Documentation

List available services

Load the tenant-enabled service catalog and render a useful empty state.

Use the catalog to show only services an organization has enabled.

Prerequisites

Create a server-only API key with catalog read access and install @authlane/sdk.

Implement the workflow

TypeScript
import { Authlane } from '@authlane/sdk';

const authlane = new Authlane({
  apiKey: process.env.AUTHLANE_API_KEY!,
});

export async function GET() {
  const { data: services, error } = await authlane.services.list();
  if (error) return Response.json({ error }, { status: error.statusCode ?? 400 });

  // An empty list is a valid answer: this tenant has nothing enabled yet.
  return Response.json({ services });
}

The equivalent API request is GET /api/v1/catalog/services with the tenant key in Authorization: Bearer <key>.

Expected result

data is an array of service records. An empty array is not an error; direct an administrator to enable a service in the Authlane dashboard.

Each record carries id, authType, kind, enabled, connectable, toolAccessPolicy, and config, plus everything needed to render the service without hardcoding it on your side:

FieldTypeWhat to do with it
namestringThe provider's own name for the service.
descriptionstring | nullOne sentence for a card or list row.
iconUrlstring | nullAbsolute URL for <img src>. No credentials, no CORS request.
brandColorstring | nullLowercase hex, for the placeholder behind the initials.
initialsstringOne or two characters. Always present.
categorystring | nullFor grouping or filtering a picker.

iconUrl is null when Authlane ships no mark for a service, because not every owner permits theirs to be redistributed, and for MCP servers a workspace registered itself. Draw initials over brandColor in that case — and on the image's onerror, so one failed request does not leave a blank square:

TSX
import { useState } from 'react';
import type { Service } from '@authlane/sdk';

export function ServiceMark({ service }: { service: Service }) {
  const [failed, setFailed] = useState(false);

  if (service.iconUrl && !failed) {
    return <img src={service.iconUrl} alt="" onError={() => setFailed(true)} />;
  }

  return (
    <span style={service.brandColor ? { background: service.brandColor } : undefined}>
      {service.initials}
    </span>
  );
}

Handle errors

Handle UNAUTHORIZED, INSUFFICIENT_SCOPE, and RATE_LIMIT_EXCEEDED by code. Honor Retry-After on a 429 response.

Security boundary

Call this route from your backend. Do not expose the tenant API key in browser code.

Next step

Create a connect session for a signed-in user.