Skip to main content

SDK reference

Package: @withfoundry/sdk
API base: https://api.withfoundry.ai
Auth: API key with prefix key_ passed as Authorization: Bearer key_...

Client

new Foundry(options)


Memory

foundry.memory.write(params)

Params: { namespace: string, entries: Array<{ content: string, metadata?: object }> }
Returns: Promise<{ data: { ids: string[] }, meta }>

foundry.memory.search(params)

Params: { namespace: string, query: string, limit?: number, metadataFilter?: object }
Returns: Promise<{ data: Array<{ id, content, metadata, score? }>, meta }>

foundry.memory.getContext(params)

Params: { namespace: string, query: string, limit?: number }
Returns: Promise<{ data: { text: string, entryIds: string[] }, meta }>

Security

foundry.security.scanRepo(params)

Params: { repoUrl: string, branch?: string, waitForCompletion?: boolean }
Returns: Promise<{ data: { scanId: string, status: string, findings?: Finding[] }, meta }>

foundry.security.getScanResult(scanId)

Params: scanId: string
Returns: Promise<{ data: { scanId, status, findings?, error? }, meta }>

Response envelope

All successful responses follow the API envelope:
The SDK typically exposes data and meta; success may be omitted if errors are thrown. On HTTP errors (4xx/5xx), the SDK may throw or return an error object—see package docs for exact behavior.

Finding type (Security)