TypeScript SDK Reference¶
Complete API reference for @a2p/sdk.
Installation¶
A2PClient¶
For agents accessing user profiles.
Constructor¶
Methods¶
getProfile¶
requestAccess¶
const result = await client.requestAccess({
userDid: string,
scopes: string[],
purpose: Purpose
}): Promise<AccessResult>
proposeMemory¶
const proposal = await client.proposeMemory({
userDid: string,
content: string,
category: string,
confidence: number,
context?: string
}): Promise<Proposal>
A2PUserClient¶
For users managing their profiles.
Constructor¶
Methods¶
createProfile¶
const profile = await client.createProfile({
displayName: string,
preferences?: Preferences
}): Promise<Profile>
getPendingProposals¶
reviewProposal¶
await client.reviewProposal(
proposalId: string,
decision: { action: 'approve' | 'reject', editedContent?: string }
): Promise<void>
setPolicy¶
await client.setPolicy({
name: string,
agentPattern: string,
allow: string[],
deny?: string[],
permissions: Permission[]
}): Promise<Policy>
Types¶
Profile¶
interface Profile {
id: DID;
version: string;
profileType: 'human' | 'agent' | 'entity';
identity: Identity;
common?: CommonData;
memories?: Record<string, any>;
accessPolicies?: Policy[];
}
Purpose¶
interface Purpose {
type: PurposeType;
description: string;
legalBasis: LegalBasis;
retention?: string;
automated?: {
decisionMaking: boolean;
profiling: boolean;
};
}
AccessResult¶
interface AccessResult {
granted: boolean;
grantedScopes: string[];
deniedScopes: string[];
consentReceipt?: ConsentReceipt;
reason?: string;
}
Next Steps¶
- Python SDK — Python reference
- Quickstart — Get started