API Reference
API Reference

API Reference

This section documents the main methods available in the AZTP Client for both npm (TypeScript/JavaScript) and pip (Python).


1. initialize / Aztp()

TypeScript:

const client = aztp.initialize({
  apiKey: "your_api_key_here",
});

Python:

client = Aztp(api_key="your_api_key_here")

Description: Initializes the AZTP client with your API key.

Parameters:

  • apiKey (string): Your API key from astha.ai.

Returns: A client instance for further operations.


2. secureConnect / secure_connect

TypeScript:

const securedAgent = await client.secureConnect(agent, "agent-name", options?);

Python:

secured_agent = await client.secure_connect(agent, "agent-name", options)

Description: Issues a new identity for an agent. Supports global, linked, and parent/child identities.

Parameters:

  • agent: Your agent object.
  • name (string): Name for the agent.
  • options (object, optional):
    • isGlobalIdentity (bool): If true, issues a global identity.
    • trustDomain (string): Trusted domain for the identity.
    • parentIdentity (string): Parent AZTP ID for hierarchical relationships.
    • linkTo (array): List of AZTP IDs to link this identity to.

Returns: A secured agent object with an identity property.


3. verifyIdentity / verify_identity

TypeScript:

const isValid = await client.verifyIdentity(securedAgent);

Python:

is_valid = await client.verify_identity(secured_agent)

Description: Verifies the validity of an agent's identity.

Parameters:

  • securedAgent: The agent object with an issued identity.

Returns: true if valid, false otherwise.


4. verifyIdentityConnection / verify_identity_connection

TypeScript:

const isValid = await client.verifyIdentityConnection(fromAgentId, toAgentId);

Python:

is_valid = await client.verify_identity_connection(from_agent_id, to_agent_id)

Description: Verifies the connection (trust relationship) between two identities.

Parameters:

  • fromAgentId (string): Source AZTP ID.
  • toAgentId (string): Target AZTP ID.

Returns: true if the connection is valid, false otherwise.


5. getIdentity / get_identity

TypeScript:

const identity = await client.getIdentity(securedAgent);

Python:

identity = await client.get_identity(secured_agent)

Description: Retrieves identity details for a secured agent.

Parameters:

  • securedAgent: The agent object with an issued identity.

Returns: Identity details object.


6. discoverIdentity / discover_identity

TypeScript:

const discoveredIdentities = await client.discoverIdentity(options?);

Python:

discovered_identities = await client.discover_identity(options)

Description: Discovers available identities, optionally filtered by trust domain or requestor identity.

Parameters:

  • options (object, optional):
    • trustDomain (string): Filter by trust domain.
    • requestorIdentity (string): Filter by requestor AZTP ID.

Returns: List of discovered identities.


7. getPolicy / get_policy

TypeScript:

const identityAccessPolicy = await client.getPolicy(aztpId);

Python:

identity_access_policy = await client.get_policy(aztp_id)

Description: Retrieves the access policy for a specific AZTP identity.

Parameters:

  • aztpId (string): The AZTP ID.

Returns: Policy data object.


8. revokeIdentity / revoke_identity

TypeScript:

const revokeResult = await client.revokeIdentity(aztpId, reason);

Python:

revoke_result = await client.revoke_identity(aztp_id, reason)

Description: Revokes an AZTP identity.

Parameters:

  • aztpId (string): The AZTP ID to revoke.
  • reason (string): Reason for revocation.

Returns: Object with success (boolean) and message (string).


9. undoRevokeIdentity / undo_revoke_identity (TypeScript: reissueIdentity)

TypeScript:

const undoResult = await client.reissueIdentity(aztpId);

Python:

undo_result = await client.undo_revoke_identity(aztp_id)

Description: Undoes a previous identity revocation.

Parameters:

  • aztpId (string): The AZTP ID to restore.

Returns: Object with success (boolean) and message (string).