These commands need CLI v0.3.0 or later. Check your version with
ahasend --version, and upgrade if it is older.Prerequisites
Authenticate with a full API key. Contact tasks need these scopes:
Attribute keys must already exist in the dashboard. Creating a contact does not add it to a list; add it with
ahasend lists members add. The shell examples need Bash.
Commands that take <id-or-email> accept a contact ID or a raw email address. Pass the address exactly as written, including +, and do not percent-encode it.
Create, Read and Update
Save these commands in one Bash script. The script creates two test contacts, and its last step deletes them.update sends only the flags you give, and needs at least one. --first-name "", --last-name "" and --status-reason "" clear those fields. To remove an attribute, set its value to null in --attributes, such as --attributes '{"old_key":null}'. Status values are enabled, disabled and blocked.
To find contacts, filter the list by email, status, subscription or creation time. Times are RFC 3339, such as 2026-01-15T10:30:00Z, or relative, such as 7d for 7 days ago:
Batch Import
Continue the script.contacts batch creates or updates up to 1,000 contacts in one request. Save this as contacts.json:
contacts.json
- The file is a JSON object whose only field is
data. The 1,000 limit counts every item, duplicates included. - Items may hold only contact fields, and no field may be
null; leave a field out to keep it unchanged. Insideattributes,nullremoves that attribute. - The command prints the result of each item, and exits with code 1 when any item failed.
- With
--idempotency-key, reuse a key only to retry the same file contents.
List a Contact’s Lists
Continue the script:unconfirmed, confirmed, unsubscribed or complained.
Delete the Test Contacts
Finish the script by deleting the contacts it created.contacts delete asks for confirmation first; see prompts.
Command Flags
These flags come from the CLI’s--help. All commands also accept the global flags.
contacts batch
contacts create
Attribute values cannot be
null on create.
contacts delete
contacts get
contacts list
The list is newest first.
--subscribed=false lists unsubscribed contacts.

