Skip to main content

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
All endpoints are authenticated with your AutoSend project API key sent as a Bearer token. The SendGrid API key required to read from your SendGrid account is passed in the request body for each call. It is never persisted in plaintext.

Prerequisites

Before you start, make sure you have:
  1. An AutoSend project API key - create one on the API Keys page. Keys look like AS_xxxxxxxx_xxxxxxxxxxxxxxxxxxxx.
  2. A SendGrid API key - generate one in SendGrid under Settings → API Keys. The key should have at least these scopes:
    • template_engine.read - fetch templates
    • marketing.read - fetch contacts, lists, and custom field definitions
    • suppressions.read - fetch unsubscribe groups and suppressed emails
  3. The base URL for all requests: https://api.autosend.com/v1

Authentication

Every request uses two headers:
1

Preview the migration

Call POST /migrations/sendgrid/plan to confirm the SendGrid key is valid and see what will be migrated.
2

Run the full migration

Call POST /migrations/sendgrid/migrate with migrateAll: true or with specific IDs you want to import.
3

Or run targeted migrations

Use POST /migrations/sendgrid/sg-template to migrate selected templates, or POST /migrations/sendgrid/sg-unsubscribe-group to migrate a single unsubscribe group.

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 a bulkOperationId 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:
  1. Custom fields - creates AutoSend custom field definitions from the mappings.
  2. Templates - fetches each SendGrid template’s active version. Images hosted on cdn.mcauto-images-production.sendgrid.net are downloaded and re-uploaded to your AutoSend media library, and the HTML is rewritten to point at the new URLs.
  3. Unsubscribe groups - creates the matching suppression group in AutoSend and imports its suppressed email list.
  4. Contact lists - creates the AutoSend list metadata.
  5. 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.
Always test migrated templates that contain complex Handlebars expressions before sending production traffic to them.
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:
If the group already existed and addEmailsInSuppression was false, the response is the suppression group DTO instead.

FAQ

The key is held in memory for the lifetime of the migration job and encrypted at rest while the background job is queued.
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.
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.
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.
/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:
  1. The bulkOperationId returned by /migrate
  2. Your AutoSend project ID
  3. The approximate time of the request
Email [email protected] with these details and we’ll investigate.

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.