Numberly
Content

Create an email content

The NMP (Numberly Martech Platform) enables the automation of email content creation via its API. This technical guide details the process of creating HTML content, managing hosted images, and integrating this content into your campaigns.

Prerequisites: Retrieving the Group ID

Content creation requires an association with a specific group. Before initiating creation, you must retrieve the identifier (group_id) of the group the account has access to via the dedicated endpoint.

Endpoint: GET {subdomain}.api.numberly.com/v1/settings/groups

Request Example

curl -X GET "https://{subdomain}.api.numberly.com/v1/settings/groups" \
     -H "Authorization: Bearer <ACCESS_TOKEN>" \
     -H "Content-Type: application/json"

Response Example

{
  "objects": [
    {
      "id": "65df06372b43d70716133716",
      "name": "Groupe Marketing France"
    }
  ],
  "metadata": {
    "timestamp": 1744375392.0
  },
  "pagination": {
    "total": 1,
    "limit": 20,
    "page": 1
  }
}

Creating Email Content via API

The API allows for the creation of HTML content. You can send raw HTML code as well as graphic assets (images) that need to be hosted on the platform's CDN.

Image Management

  • Already hosted images: URLs for images that are already hosted and present in the HTML code are not modified.
  • Images to be hosted by NMP: Images can be attached to the payload. The platform will host them on its CDN.

Endpoint

POST /v1/contents

Payload Parameters (PostContentPayload)

ParameterTypeRequiredDescription
nameStringYesInternal name of the content.
group_idStringYesGroup identifier retrieved previously.
contentStringYesThe HTML source code of the template (or raw text).
typeStringNoContent type, default is html. Only supported value: html.
usageStringNoContent usage, default is email. Only supported value: email.
imagesArrayNoList of image objects to be hosted on the CDN.

Image Object Structure

If you are sending local images, each object in the images array must contain:

  • filename (String): Name of the file (e.g., header.jpg).
  • type (String): MIME type (e.g., image/jpeg).
  • content (String): Content of the image encoded in Base64.

Implementation Example

The example below creates HTML content and requests the hosting of a local image named banner.jpg.

curl -X POST "https://{subdomain}.api.numberly.com/v1/contents" \
     -H "Authorization: Bearer <ACCESS_TOKEN>" \
     -H "Content-Type: application/json" \
     -d '{
           "name": "Newsletter Soldes Hiver 2025",
           "group_id": "65df06372b43d70716133716",
           "type": "html",
           "usage": "email",
           "content": "<html><body><h1>Nos Soldes</h1><img src=\"banner.jpg\" alt=\"Bannière\" /><p>Découvrez nos offres.</p></body></html>",
           "images": [
             {
               "filename": "banner.jpg",
               "type": "image/jpeg",
               "content": "/9j/4AAQSkZJRgABAQEASABIAAD..." 
             }
           ]
         }'

Success Response

The API returns the unique identifier of the created content (id).

{
  "id": 1024
}

Post-Creation Operations

Once the content is created and its id retrieved, you can interact with it via the following endpoints:

  1. Retrieve the content: Get content details (including image URLs transformed by the CDN) via GET {subdomain}.api.numberly.com/v1/contents/{content_id}.
  2. Create a campaign: Use the content ID during campaign creation via POST {subdomain}.api.numberly.com/v1/campaigns.

Conclusion

Content created via the API is centralized and accessible: you can find and edit it directly in the content list within the Factorly interface.