Credentials

Credentials are a core part of Emailit for Marketers On this page, we'll dive into the different audience endpoints you can use to manage audiences programmatically. We'll look at how to query, create, update, and delete audiences.

The credential model

The credential model contains all the information about your credential.

Properties

  • Name
    id
    Type
    string
    Description

    Unique identifier for the credential.

  • Name
    name
    Type
    string
    Description

    Name of the credential.

  • Name
    type
    Type
    string
    Description

    Type of the credential. Valid are smtp or api.

  • Name
    key
    Type
    string
    Description

    The key of the credential. Only visible in creation.

  • Name
    last_used_at
    Type
    date
    Description

    The timestamp of when the credential was last used.

  • Name
    created_at
    Type
    date
    Description

    The timestamp of when the credential was created.

  • Name
    updated_at
    Type
    date
    Description

    The timestamp of when the credential was last updated.


GET/v1/credentials

List all credentials

This endpoint allows you to retrieve a paginated list of all your credentials. By default, a maximum of 25 credentials are shown per page.

Optional attributes

  • Name
    per_page
    Type
    integer
    Description

    Limit the number of credentials returned.

  • Name
    page
    Type
    integer
    Description

    The page number to retrieve.

  • Name
    filter[name]
    Type
    string
    Description

    Filter credentials by name.

  • Name
    filter[type]
    Type
    string
    Description

    Filter credentials by type.

Request

GET
/v1/credentials
curl -G https://api.emailit.com/v1/credentials \
   -H 'Authorization: Bearer {api_key}' \
   -H 'Content-Type: application/json' \
   -d $'{
     "per_page": 25,
     "page": 1,
     "filter[name]": "My Credential",
     "filter[type]": "smtp"
   }'

Response

{
  "data": [
    {
      "id": "WAz8eIbvDR60rouK",
      "name": "My Credential",
      "type": "smtp",
      "last_used_at": "2024-09-26T08:16:03.000000Z",
      "created_at": "2024-09-26T08:16:03.000000Z",
      "updated_at": "2024-09-26T08:16:03.000000Z"
    },
    {
      "id": "hSIhXBhNe8X1d8Et"
      // ...
    }
  ]
}

POST/v1/credentials

Create an credential

This endpoint allows you to add a new credential to your account. To add a credential, you must provide its name and type.

Required attributes

  • Name
    name
    Type
    string
    Description

    The name for the credential.

  • Name
    type
    Type
    string
    Description

    The type of the credential. Valid are smtp or api.

Request

POST
/v1/credentials
curl https://api.emailit.com/v1/credentials \
  -H "Authorization: Bearer {api_key}" \
  -H 'Content-Type: application/json' \
  -d $'{
    "name": "My Credential",
    "type": "smtp"
  }'

Response

{
  "id": "WAz8eIbvDR60rouK",
  "name": "My Credential",
  "type": "smtp",
  "key": "em_1234567890",
  "last_used_at": "2024-09-26T08:16:03.000000Z",
  "created_at": "2024-09-26T08:16:03.000000Z",
  "updated_at": "2024-09-26T08:16:03.000000Z"
}

GET/v1/credentials/:id

Retrieve an credential

This endpoint allows you to retrieve a credential by providing their id. Refer to the list at the top of this page to see which properties are included with credential objects.

Request

GET
/v1/credentials/WAz8eIbvDR60rouK
curl https://api.emailit.com/v1/credentials/WAz8eIbvDR60rouK \
  -H "Authorization: Bearer {api_key}" \
  -H "Content-Type: application/json"

Response

{
  "id": "WAz8eIbvDR60rouK",
  "name": "My Credential",
  "type": "smtp",
  "last_used_at": "2024-09-26T08:16:03.000000Z",
  "created_at": "2024-09-26T08:16:03.000000Z",
  "updated_at": "2024-09-26T08:16:03.000000Z"
}

PUT/v1/credentials/:id

Update an credential

This endpoint allows you to perform an update on an credential. Currently, the only attribute that can be updated on credentials is the name attribute.

Optional attributes

  • Name
    name
    Type
    string
    Description

    The name of the credential.

Request

PUT
/v1/credentials/WAz8eIbvDR60rouK
curl -X PUT https://api.emailit.com/v1/credentials/WAz8eIbvDR60rouK \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d $'{
    "name": "My Credential"
  }'

Response

{
  "id": "WAz8eIbvDR60rouK",
  "name": "My Credential",
  "type": "smtp",
  "last_used_at": "2024-09-26T08:16:03.000000Z",
  "created_at": "2024-09-26T08:16:03.000000Z",
  "updated_at": "2024-09-26T08:16:03.000000Z"
}

DELETE/v1/credentials/:id

Delete an credential

This endpoint allows you to delete an credential. There always have to be at least one credential in your account.

Request

DELETE
/v1/credentials/WAz8eIbvDR60rouK
curl -X DELETE https://api.emailit.com/v1/credentials/WAz8eIbvDR60rouK \
  -H "Authorization: Bearer {api_key}"
  -H "Content-Type: application/json"

Was this page helpful?