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: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
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
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
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
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
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.