Create a subscriber

v1
post
/1/newsletters/{domain}/subscribers

Create a subscriber.

If a subscriber already exists, it will be updated with new values. This is non-destructive operation, omitted parameters will not affect the subscriber.

Path parameters

domain
requiredinteger

Unique identifier of the Domain

Examples:27325

Body Parameters

application/json
emailrequiredstring

Valid email address as per RFC 2821

Examples:mwolff@bernier.com
fieldsarray

Object keys must correspond to field's key.

Examples:{"firstname": "John","lastname": "Wick"}
groupsarray

An array of valid identifiers or the names of groups to be created.

Examples:[1234, "my new group"]
statusstring

Status of the resource {name}

Examples:example

Response Body

application/json
resultrequiredstring
Possible values:successerrorasynchronous

Result of the HTTP request

Examples:success
dataSubscriber

Example request

                <?php
use GuzzleHttp\Client;

$client = new Client();
$headers = [
	'Authorization' => 'Bearer YOUR-TOKEN-HERE',
	'Content-Type' => 'application/json'
];

$body = '{
    "email": "mwolff@bernier.com"
}';

$request = new Request('POST', 'https://api.infomaniak.com/1/newsletters/{domain}/subscribers', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
            

Example response

application/json
                
                    
{
"result":"success",
"data":{
"id":67403,
"email":"estrella.lesch@streich.org",
"status":"unsubscribed",
"created_at":1731840230
}
}