Wraps Logo
DocsHome
Reference / JSON Output

JSON Output

Machine-readable output for every CLI command. Add --json to any command for structured output that AI agents, CI pipelines, and scripts can parse.

Envelope Format

Every JSON response follows a standardized envelope. Both success and error responses share the same top-level structure, making it easy to handle any command output programmatically.

TypeScripttypes.ts
type JsonOutput = {  success: boolean;  command: string;        // e.g. "email.status"  data?: Record<string, unknown>;  error?: {    code: string;    message: string;    suggestion?: string;    docsUrl?: string;  };};
FieldTypeDescription
successbooleanAlways present. true for successful operations, false for errors.
commandstringDot-notation identifier for the command (e.g. email.status, sms.init).
dataobject | undefinedPresent on success. Contains command-specific output fields.
errorobject | undefinedPresent on failure. Contains structured error details with code, message, and optional suggestion.

Success Response Example

JSONresponse.json
{  "success": true,  "command": "email.status",  "data": {    "integrationLevel": "full",    "region": "us-east-1",    "domains": ["example.com"],    "resources": {      "configSetName": "wraps-email-tracking",      "roleArn": "arn:aws:iam::123456789012:role/wraps-email-role"    },    "tracking": {      "enabled": true,      "events": ["SEND", "DELIVERY", "OPEN", "CLICK", "BOUNCE", "COMPLAINT"]    }  }}

Usage

Add the --json flag to any command. When active, all interactive prompts are suppressed and output is written as a single JSON object to stdout. Logs and spinners are sent to stderr so they do not interfere with JSON parsing.

GNU Bashterminal.sh
# Basic usagewraps email status --json# Pipe to jqwraps email status --json | jq .data.region# Non-interactive deploymentwraps email init --domain example.com --preset production --yes --json# CI/CD error handlingwraps email init --json || echo "Deploy failed"

Email Commands

Core Commands

CommandcommandKey data fields
email initemail.initroleArn, configSetName, region, domain, dkimTokens
email statusemail.statusintegrationLevel, region, domains, resources, tracking
email connectemail.connectroleArn, configSetName, region
email checkemail.checkFull deliverability result (SPF, DKIM, DMARC, scores)
email testemail.testmessageId, from, to
email upgradeemail.upgradeupgraded, region, deployment outputs
email destroyemail.destroydestroyed, region
email configemail.configupdated, region
email restoreemail.restorerestored, region

Domain Commands

CommandcommandKey data fields
email domains addemail.domains.adddomain, dkimTokens
email domains listemail.domains.listdomains[]
email domains verifyemail.domains.verifydomain, verified
email domains get-dkimemail.domains.get-dkimdomain, dkimTokens
email domains removeemail.domains.removedomain, removed

Inbound Commands

CommandcommandKey data fields
email inbound initemail.inbound.initreceivingDomain, bucketName
email inbound statusemail.inbound.statusenabled, receivingDomain, bucketName
email inbound verifyemail.inbound.verifyverified, receivingDomain
email inbound testemail.inbound.testmessageId, receivingDomain
email inbound destroyemail.inbound.destroydestroyed

Templates & Workflows

CommandcommandKey data fields
email templates initemail.templates.initinitialized, directory
email templates pushemail.templates.pushpushed, templates[]
email workflows pushemail.workflows.pushpushed, workflows[]
email workflows validateemail.workflows.validatevalid, errors[]

SMS Commands

CommandcommandKey data fields
sms initsms.initroleArn, region, phoneNumber
sms statussms.statusregion, phoneNumber, phoneNumberType, configSetName
sms testsms.testmessageId, to
sms destroysms.destroydestroyed, region
sms syncsms.syncsynced, region
sms upgradesms.upgradeupgraded, region
sms verify-numbersms.verify-numberphoneNumber, verified
sms registersms.registerregistrationId, status

CDN Commands

CommandcommandKey data fields
cdn initcdn.initbucketName, region, distributionId, distributionDomain
cdn statuscdn.statusbucketName, region, distributionId, distributionDomain, customDomain
cdn synccdn.syncsynced, region
cdn verifycdn.verifyverified, domain
cdn destroycdn.destroydestroyed, region
cdn upgradecdn.upgradeupgraded, region

Auth & Platform Commands

CommandcommandKey data fields
auth loginauth.loginauthenticated, tokenType
auth statusauth.statusauthenticated, user
auth logoutauth.logoutloggedOut
aws doctoraws.doctorchecks[], summary, suggestions
platform connectplatform.connectaccountId, connectionId
platform update-roleplatform.update-roleupdated, roleArn
permissionspermissionspolicy (IAM policy document)

Error Handling

Errors follow the same envelope format. The process exit code is non-zero on failure, so scripts can use standard shell error handling. Error codes match the ones documented in the Error Codes reference.

JSONerror-response.json
{  "success": false,  "command": "email.init",  "error": {    "code": "NO_AWS_CREDENTIALS",    "message": "AWS credentials not found",    "suggestion": "Run: aws configure or aws sso login",    "docsUrl": "https://wraps.dev/docs/guides/aws-setup"  }}
Error FieldDescription
codeMachine-readable error identifier (e.g. NO_AWS_CREDENTIALS). Matches codes in the Error Codes reference.
messageHuman-readable error description.
suggestionOptional. Actionable fix or next step the user can take.
docsUrlOptional. Link to relevant documentation for further guidance.

Destructive Commands

Destructive commands (destroy) require the --force flag when used with --json. This prevents accidental deletion in automated pipelines where interactive confirmation is not available.

GNU Bashterminal.sh
# This will error in JSON mode without --forcewraps email destroy --json# Error: "--force flag is required in JSON mode"# Correct usagewraps email destroy --force --json