CSV upload
A campaign can draw its audience from a CSV you upload. Every row is validated before the campaign runs, and the rows that fail come back to you as a file you can fix and re-upload.
Columns
Two columns are required: identifier and phone. first_name, last_name, and email are recognised as standard columns. Anything else you include is kept as a custom column and is available to the agent during the conversation. Header names are matched case-insensitively.
identifier,phone,first_name,last_name,email,plan
lead-8821,+919876543210,Anu,Sharma,anu@acme.example,pro
lead-8822,+919812345678,Ravi,Kumar,ravi@globex.example,starter
lead-8823,+14155550123,Sam,Diaz,sam@initech.example,proLimits
- The file must have a .csv extension.
- Maximum file size is 10MB. The request is aborted as soon as the cap is crossed, so an oversized file fails fast rather than after a long upload.
- Maximum 50,000 rows per file.
Validation
A row is rejected if it has no identifier, if it has no phone, if its identifier duplicates an earlier row (the error names the row it collided with), or if an email is present but malformed. Completely empty rows are skipped rather than reported. Valid and invalid rows are split into two files, so you can start the campaign on the good rows and fix the rest separately.
Uploading and re-uploading
Validate the file first, then attach the resulting upload to a campaign. If you fixed the rejected rows, re-upload against the same campaign rather than creating a second one.
curl -X POST https://api.saaya.ai/api/v1/campaigns/leads/validate-upload \
-H "X-API-Key: sa_..." \
-F "file=@leads.csv"
curl -X POST https://api.saaya.ai/api/v1/campaigns/{campaign_id}/leads/upload \
-H "X-API-Key: sa_..." \
-F "file=@leads.csv"