# SendGrid

### Snapshot

| Features                        | Details                                           |
| ------------------------------- | ------------------------------------------------- |
| Release Status                  | Released                                          |
| Source API Version              | v3                                                |
| Table Selection                 | Yes                                               |
| Column Selection                | Yes                                               |
| Edit Integration                | Yes                                               |
| Replication Type Selection      | No                                                |
| Authentication Parameters       | <p>SendGrid API Key<br>SendGrid Email Address</p> |
| Replication Type                | <p>Key Based Replication<br>Full Replication</p>  |
| Replication Key                 | Date                                              |
| Suggested Replication Frequency | 24 hrs                                            |

| Tables/APIs Supported |                   |
| --------------------- | ----------------- |
| Bounce                | GlobalSuppression |
| Campaign              | Blocks            |
| Contacts              | Groups            |
| Invalid               | ListAll           |
| Segments              | SpamReports       |
| Templates             |                   |

### Pre-requisites

1. Generate Sendgrid API Key for Daton
2. Read more on How to create Sendgrid API Keys [here](https://docs.sarasanalytics.com/source-api-keys/sendgrid-api-keys)

### Integrate SendGrid with Daton

1. Signin to Daton&#x20;
2. Select SendGrid from Integrations page
3. Provide Integration Name, Replication Frequency, and History. Integration name would be used in creating tables for the integration and cannot be changed later&#x20;
4. Provide SendGrid API Key and Email Address to authorize Daton to periodically extract data from SendGrid
5. Post successful authentication, you will be prompted to choose from the list of available tables
6. Then select all required fields for each table
7. Submit the integration

### Workflow

1. Integrations would be in Pending state initially and will be moved to Active state as soon as the first job loads data successfully on to the configured warehouse
2. Users would be able to edit/pause/re-activate/delete integration anytime
3. Users can view job status and process logs from the integration details page by clicking on the integration name from the active list

### SendGrid Data

**Bounce**

Purpose: This endpoint allows you to retrieve all of your bounces.

Source API Documentation  <https://sendgrid.com/docs/api-reference/>

Replication: Key-Based Replication

Replication Key: created

**Fields**

| Name    | Target Datatype |
| ------- | --------------- |
| email   | STRING          |
| created | INTEGER         |
| reason  | STRING          |
| status  | NUMERIC         |

**GlobalSuppression**

Purpose: This endpoint allows you to retrieve a list of all email address that are globally suppressed.

Source API Documentation  <https://sendgrid.com/docs/api-reference/>

Replication: Key-Based Replication

Replication Key: created

**Fields**

| Name    | Target Datatype |
| ------- | --------------- |
| email   | STRING          |
| created | INTEGER         |

**Campaign**

Purpose: This endpoint allows you to retrieve a list of all of your campaigns.

Source API Documentation  <https://sendgrid.com/docs/api-reference/>

Replication: Full Replication

Replication Key: NA

**Fields**

| Name                     | Target Datatype |
| ------------------------ | --------------- |
| id                       | INTEGER         |
| title                    | STRING          |
| subject                  | STRING          |
| sender\_id               | INTEGER         |
| list\_ids                | RECORD          |
| segment\_ids             | RECORD          |
| categories               | RECORD          |
| suppression\_group\_id   | INTEGER         |
| custom\_unsubscribe\_url | STRING          |
| ip\_pool                 | STRING          |
| html\_content            | STRING          |
| plain\_content           | STRING          |
| status                   | STRING          |

**Blocks**

Purpose: This endpoint allows you to retrieve a list of all email addresses that are currently on your blocks list.

Source API Documentation  <https://sendgrid.com/docs/api-reference/>

Replication: Key-Based Replication

Replication Key: created

**Fields**

| Name    | Target Datatype |
| ------- | --------------- |
| email   | STRING          |
| created | INTEGER         |
| status  | STRING          |

**Contacts**

Purpose: This endpoint allows you to add a Marketing Campaigns recipient.

Source API Documentation  <https://sendgrid.com/docs/api-reference/>

Replication: Full Replication

Replication Key: NA

**Fields**

| Name           | Target Datatype |
| -------------- | --------------- |
| created\_at    | INTEGER         |
| email          | STRING          |
| first\_name    | STRING          |
| id             | STRING          |
| last\_clicked  | STRING          |
| last\_emailed  | STRING          |
| last\_name     | STRING          |
| last\_opened   | STRING          |
| updated\_at    | STRING          |
| custom\_fields | RECORD          |

**Groups**

Purpose: This endpoint allows you to retrieve a list of all suppression groups created by this user.

Source API Documentation  <https://sendgrid.com/docs/api-reference/>

Replication: Full Replication

Replication Key: NA

**Fields**

| Name                  | Target Datatype |
| --------------------- | --------------- |
| id                    | INTEGER         |
| name                  | STRING          |
| description           | STRING          |
| last\_email\_sent\_at | STRING          |
| is\_default           | BOOLEAN         |
| unsubscribes          | INTEGER         |

**Invalid**

Purpose: This endpoint allows you to retrieve a list of all invalid email addresses.

Source API Documentation  <https://sendgrid.com/docs/api-reference/>

Replication: Key-Based Replication

Replication Key: created

**Fields**

| Name    | Target Datatype |
| ------- | --------------- |
| created | INTEGER         |
| email   | STRING          |
| reason  | STRING          |

**ListAll**

Purpose: This endpoint allows you to retrieve all of your recipient lists. If you don't have any lists, an empty array will be returned.

Source API Documentation  <https://sendgrid.com/docs/api-reference/>

Replication: Key-Based Replication

Replication Key: created

**Fields**

| Name             | Target Datatype |
| ---------------- | --------------- |
| id               | INTEGER         |
| name             | STRING          |
| recipient\_count | INTEGER         |

**Segments**

Purpose: This endpoint allows you to retrieve all of your segments.

Source API Documentation  <https://sendgrid.com/docs/api-reference/>

Replication: Key-Based Replication

Replication Key: created\_at

**Fields**

| Name             | Target Datatype |
| ---------------- | --------------- |
| id               | INTEGER         |
| name             | STRING          |
| recipient\_count | INTEGER         |
| conditions       | RECORD          |

**SpamReports**

Purpose: This endpoint allows you to retrieve all spam reports.

Source API Documentation  <https://sendgrid.com/docs/api-reference/>

Replication: Key-Based Replication

Replication Key: created

**Fields**

| Name    | Target Datatype |
| ------- | --------------- |
| email   | STRING          |
| created | INTEGER         |
| status  | STRING          |

**Templates**

Purpose: This endpoint allows you to retrieve all transactional templates.

Source API Documentation  <https://sendgrid.com/docs/api-reference/>

Replication: Full Replication

Replication Key: NA

**Fields**

| Name       | Target Datatype |
| ---------- | --------------- |
| id         | INTEGER         |
| name       | STRING          |
| versions   | RECORD          |
| generation | STRING          |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://daton-sarasanalytics.gitbook.io/daton/integrations/data-sources/saas-integrations/sendgrid.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
