Skip to content

API Reference

This section contains the complete API reference for Legend.

Creates a new Legend instance.

Parameters:

ParameterTypeDescription
configobjectConfiguration object

Returns: Legend instance

Example:

import { createLegend } from '@legend/core'
const legend = createLegend({
apiKey: 'your-api-key',
})

Query a collection for documents.

Parameters:

ParameterTypeDescription
collectionstringCollection name
optionsobjectQuery options

Returns: Promise<Document[]>

Example:

const users = await legend.query('users', {
where: { status: 'active' },
limit: 10,
})