Documentation Index
Fetch the complete documentation index at: https://docs.autosend.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
AutoSend provides a set of public API endpoints to migrate your SendGrid assets into your AutoSend project:- Dynamic templates
- Contacts and contact lists
- Custom fields
- Unsubscribe groups and their suppressed emails
Prerequisites
Before you start, make sure you have:- An AutoSend project API key - create one on the API Keys page. Keys look like
AS_xxxxxxxx_xxxxxxxxxxxxxxxxxxxx. - A SendGrid API key - generate one in SendGrid under Settings → API Keys. The key should have at least these scopes:
template_engine.read- fetch templatesmarketing.read- fetch contacts, lists, and custom field definitionssuppressions.read- fetch unsubscribe groups and suppressed emails
- The base URL for all requests:
https://api.autosend.com/v1
Authentication
Every request uses two headers:| Header | Value |
|---|---|
Authorization | Bearer <YOUR_AUTOSEND_API_KEY> |
Content-Type | application/json |
Recommended Flow
Preview the migration
Call
POST /migrations/sendgrid/plan to confirm the SendGrid key is valid and see what will be migrated.Run the full migration
Call
POST /migrations/sendgrid/migrate with migrateAll: true or with specific IDs you want to import.Endpoints
Get migration plan
Fetches a preview of everything that can be migrated from your SendGrid account: templates, unsubscribe groups, custom fields, contact lists, and the total contact count.POST /v1/migrations/sendgrid/plan
Request body
| Field | Type | Required | Description |
|---|---|---|---|
sendgridApiKey | string | yes | Your SendGrid API key |
Response 200
Run the full migration
Kicks off a background migration job that imports the selected SendGrid assets into your AutoSend project. Returns abulkOperationId immediately; the work continues in the background.
POST /v1/migrations/sendgrid/migrate
Request body
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
sendgridApiKey | string | yes | - | Your SendGrid API key |
migrateAll | boolean | no | false | If true, migrate everything returned by /plan. Per-type ID arrays below are populated from the plan when empty. |
templateIds | string[] | no | [] | Specific SendGrid template IDs to migrate |
unsubscribeGroupIds | string[] | no | [] | Specific SendGrid unsubscribe group IDs |
contactListIds | string[] | no | [] | Specific SendGrid contact list IDs |
customFieldMappings | object[] | no | [] | SendGrid to AutoSend custom field mappings (see schema below) |
ignoreTemplates | boolean | no | false | Skip templates phase |
ignoreUnsubscribeGroups | boolean | no | false | Skip unsubscribe groups phase |
ignoreContactLists | boolean | no | false | Skip contact lists phase |
ignoreCustomFields | boolean | no | false | Skip custom fields phase |
ignoreContacts | boolean | no | false | Skip contacts phase |
customFieldMappings item schema:
fieldType must be one of: string, number, date.
Migration phases
The job runs in this order:- Custom fields - creates AutoSend custom field definitions from the mappings.
- Templates - fetches each SendGrid template’s active version. Images hosted on
cdn.mcauto-images-production.sendgrid.netare downloaded and re-uploaded to your AutoSend media library, and the HTML is rewritten to point at the new URLs. - Unsubscribe groups - creates the matching suppression group in AutoSend and imports its suppressed email list.
- Contact lists - creates the AutoSend list metadata.
- Contacts - uses SendGrid’s Export Contacts API to import all global contacts, then associates them with the lists created in step 4.
Example A - migrate everything
Example B - migrate selected assets only
Example C - contacts only, skip everything else
Response 202 Accepted
Hold on to the
bulkOperationId. Your AutoSend dashboard shows progress against it.Common errors
| HTTP | Code | Meaning |
|---|---|---|
| 400 | SENDGRID_MIGRATION_IN_PROGRESS | A migration is already running for this project - wait for it to finish |
| 400 | SENDGRID_NO_ITEMS_TO_MIGRATE | Nothing selected and migrateAll was not set |
| 500 | SENDGRID_FAILED_TO_FETCH_PLAN | SendGrid API key is invalid or rejected |
| 500 | SENDGRID_MIGRATION_CREATION_FAILED | Could not schedule the migration job - retry shortly |
Migrate one or more templates
Migrate specific SendGrid dynamic templates without touching anything else. Useful for one-off moves or for syncing a template after edits in SendGrid.POST /v1/migrations/sendgrid/sg-template
Request body
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
sendgridApiKey | string | yes | - | Your SendGrid API key |
sendgridTemplateIds | string[] | yes | - | SendGrid dynamic template IDs (e.g. d-abc123) |
onExistUpdateHTML | boolean | no | false | If a template with the same ID already exists in AutoSend, overwrite its HTML and subject |
Response 200
Images referenced from
cdn.mcauto-images-production.sendgrid.net are automatically downloaded and re-hosted on AutoSend so your templates continue to render after you turn SendGrid off.Migrate one unsubscribe group
Migrate a single SendGrid unsubscribe group (ASM group), and optionally its suppressed email addresses.POST /v1/migrations/sendgrid/sg-unsubscribe-group
Request body
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
sendgridApiKey | string | yes | - | Your SendGrid API key |
sendgridUnsubscribeGroupId | string | number | yes | - | The SendGrid unsubscribe group ID |
addEmailsInSuppression | boolean | no | true | Also import all currently suppressed email addresses for the group |
groupExist | boolean | no | false | If true, skip creating a new AutoSend suppression group and only import the emails into the existing group with the matching groupId |
Response 200
When the group was newly created and emails were imported:
addEmailsInSuppression was false, the response is the suppression group DTO instead.
FAQ
Is my SendGrid API key stored anywhere?
Is my SendGrid API key stored anywhere?
The key is held in memory for the lifetime of the migration job and encrypted at rest while the background job is queued.
Can I re-run a migration?
Can I re-run a migration?
Yes. Templates are upserted by their SendGrid
templateId when onExistUpdateHTML: true. Contacts and suppressed emails are upserted by email address, so duplicates are safe. Custom fields are not deduplicated - re-running custom-field migration will fail the duplicate creations and report them in the metrics, but the run continues.How long does it take?
How long does it take?
Templates and unsubscribe groups are usually done in seconds. Contacts use SendGrid’s Export Contacts API, which takes around 1 minute per 100k contacts on SendGrid’s side, plus the time to import on our side. The request returns immediately - the job keeps running after your HTTP connection closes.
What about images embedded in templates?
What about images embedded in templates?
SendGrid-hosted images (
cdn.mcauto-images-production.sendgrid.net) are automatically downloaded and re-uploaded to AutoSend’s media library, and the HTML is rewritten to point at the new URLs.What if my SendGrid API key has limited scopes?
What if my SendGrid API key has limited scopes?
/plan returns whatever the scopes allow. If a scope is missing (e.g. you didn’t grant suppressions.read), that section comes back empty and the corresponding migration phase silently skips it. Grant the missing scope and re-run if needed.Support
If a migration fails or produces unexpected results, send us:- The
bulkOperationIdreturned by/migrate - Your AutoSend project ID
- The approximate time of the request
Next Steps
Email Templates
Manage the templates you just migrated from SendGrid.
Contacts
Browse and segment the contacts imported from SendGrid.
Unsubscribe Groups
Review the suppression groups created during migration.
Sending Domain
Verify your sending domain so migrated templates can start sending.