ReferenceCampaigns API
Import segment members from CSV
POST
Replaces a manual segment's members from a multipart UTF-8 CSV upload (field file, optional BOM).
- Columns: Header must include
nameplusphoneand/orbsuid; any additional columns are stored inattributes(an optionalattr_prefix is stripped). - Row rules: Each non-empty data row requires
nameand exactly one ofphoneorbsuid(max 500 rows). Empty data rows clear the segment; blank lines are reported as softempty_rownotices without blocking import. - Validation & dry run: Pass
?dryRun=trueto validate without writing. Hard row errors fail the entire import (imported: 0, no DB write) and return{ imported, dryRun, errors: [{ row, code, message, column? }] }. - Automatic segments return
400(automatic_segment_readonly).
bearerheader
AuthorizationBearer <API key>Key issued in Settings → Developer → API key. Inbox methods need the Inbox scope. Campaigns methods need the Campaigns scope.
segmentId*stringSegment id returned by create or list.
dryRun?stringWhen true, validate only; do not write members.
CSV file in multipart field file.
multipart/form-data- body
file*unknownapplication/json- response
imported*numberHow many members were written (or would be written on dryRun). 0 when hard errors blocked the import.
dryRun*booleanTrue when dryRun=true was requested; no write occurred.
errors*array<>Row/file errors. Soft codes (empty_row) do not block. Any hard error → imported=0 and no write.
curl -X POST 'https://api.1msg.io/api/v1/campaigns/segments/string/members/import'Example Response
{ "imported": 3, "dryRun": false, "errors": [ { "row": 2, "code": "invalid_phone", "message": "phone must be E.164", "column": "phone" } ]}