Skip to main content
Base interface for all API responses with data and metadata This response follows the standard BaseResponse wrapper with data (response payload) and lastResponse (request metadata). All successful API responses follow this wrapper pattern for consistency and debugging. Errors throw GridError instead of returning error objects.

Remarks

The BaseResponse wrapper provides:
  • data: The actual response payload from the API
  • lastResponse: Request metadata for debugging and tracking
This pattern making it easy to:
  • Access response data via the data property
  • Track requests using lastResponse.requestId for support queries
  • Debug issues with status codes and headers
  • Implement idempotency using lastResponse.idempotencyKey
Note: Errors are NOT returned in the response. Instead, they throw GridError with similar metadata.

Examples

const response = await gridClient.getAccount(accountAddress);

console.log(response.data.address);
console.log(response.data.policies);
const response = await gridClient.createAccount({ email: 'user@example.com' });

console.log('Request ID:', response.lastResponse?.requestId);
console.log('Status:', response.lastResponse?.statusCode);
console.log('Idempotency Key:', response.lastResponse?.idempotencyKey);
try {
  const response = await gridClient.getAccount(accountAddress);
  console.log('Success:', response.data);
} catch (error) {
  if (error instanceof GridError) {
    console.error('Error:', error.message);
    console.error('Request ID:', error.lastResponse?.requestId);
  }
}

Properties

PropertyTypeDescription
addressstring-
policiesAccountPolicies-
gridUserIdstring-
authenticationAuthenticationData-