Contents

  1. Rest API
    1. API Base URLs
    2. Types
    3. Parameter Locations
    4. Responses
    5. Error responses
    6. Authentication
  2. Resource URLs
  3. Resource Models

REST API

The Flowmailer API is a RESTful API. Everything you can manipulate is a resource with its own unique URL. The API calls are identified by their resource URL and HTTP method.

The following HTTP methods are used:

The requests and responses for all requests (except the OAuth2 authentication calls) are in JSON format. There is no guarantee about the field ordering in JSON responses.

All requests should contain the Accept header with value application/vnd.flowmailer.v1.5+json.

The OAuth2 authentication requests are in application/x-www-form-urlencoded format. The authentication responses are in JSON format.

API Base urls

OAuth2 https https://login.flowmailer.net
http http://api.flowmailer.net
https https://api.flowmailer.net

Types

Name Format Example Description
integer 12640 A whole number
boolean true, false true
string Test flow Text string
base64 RXhhbXBsZQo= Base64 encoded binary data as described by rfc4648
items_range items={start}-{end} items=0-10 Range header
content_range items {start}-{end}/{total} items 0-10/22 Content-Range header
date yyyy-MM-dd'T'HH:mm:ssZZ 2014-12-16T05:50:11Z ISO8601 datetime format without milliseconds
date_range yyyy-MM-dd'T'HH:mm:ssZZ,yyyy-MM-dd'T'HH:mm:ssZZ 2014-12-16T05:50:00Z,2014-12-16T06:00:00Z Start and end date in ISO8601 format (without milliseconds) separated by a comma. Start date is inclusive and end date is exclusive.

Parameter locations

The Flowmailer REST API uses request parameters in different locations: path, matrix, query, form and body.

Arrays (types ending with []) in path and matrix parameters should be structured as comma-separated values.

path

Path parameters appear in the URL path component as a complete path segment.

Example url with path parameter with value 123:
http://api.flowmailer.com/123/flows

matrix

Matrix parameters appear in the URL path component, at the end of a path segment and begin with a semicolon (;). Matrix parameters are seperated by a semicolon (;), each parameter is a name value pair seperated by an equal sign (=).

Example url with matrix parameter daterange with value 2014-12-16T05:50:00Z,2014-12-16T06:00:00Z:
http://api.flowmailer.com/123/messages;daterange=2014-12-16T05:50:00Z,2014-12-16T06:00:00Z

query

Query parameters appear in the URL query component, the query component starts with a question mark (?). Query parameters seperated by ampersand (&), each parameter is a name value pair seperated by an equal sign (=).

Example url with query parameter addreturns with value true:
http://api.flowmailer.com/123/messages?addreturns=true

form

Form parameters do not appear in the URL. They are encoded as application/x-www-form-urlencoded and supplied as request body.

Example request body with two form parameters grant_type with value client_credentials and scope with value api:
grant_type=client_credentials&scope=api

body

There can only be one body parameter per request and it is an model object encoded as json and supplied as the request body.

The Content-Type header for the request should be application/vnd.flowmailer.v1.5+json.

Example request body:
{
    "name" : "value",
    "name2" : "value2"
}

Responses

All API responses are in JSON format and have the with mime type application/vnd.flowmailer.v1.5+json.

The following response codes are used by the Flowmailer API for success conditions:
HTTP Status code Extra headers Description
200 Ok Used to indicate that the request was successful
201 Created Location header Used to indicate that the response contains a Location header with the URL of the newly created API resource
206 Partial Content Content-Range header Used as indication that a subset of the requested data is returned. Only applicable to requests with the Range header

Error responses

The following response codes are used by the Flowmailer API for failure conditions:
HTTP Status code Description Extra headers Response Model
400 Bad Request Errors
403 Forbidden Exception
404 Not Found Exception
401 Unauthorized, reason is specified in the WWW-Authenticate header and response body, used for example when the access token is expired WWW-Authenticate header OAuthErrorResponse
500 Internal Server Error

Authentication

The Flowmailer REST API requires authentication using OAuth 2. A full specification for OAuth 2 is available in rfc6749.

Supported authentication types:

To use the Flowmailer API, an access token must be requested using the client id and secret. The access token must be included with every API call in the Authorization header using authentication scheme Bearer.

Access tokens are valid for 1 minute. When an access token expires, API calls using that token will result in a 401 Unauthorized http response. The 401 response will have a JSON encoded response body of type OAuthErrorResponse with error invalid_token. This response signals that the current access token is expired or invalid and a new access token should be requested.

Example Authorization header:
Authorization: Bearer e600a31c-cf8f-4c0a-8f26-386c555f6a54

Example API call sequence:

Resource URLs

POST /oauth/token

This call is used to request an access token using the client id and secret provided by flowmailer.

The form parameters must be posted in application/x-www-form-urlencoded format. But the response will be in JSON format.

Resource URL

Type URL format
POST https://login.flowmailer.net/oauth/token

Parameters

Name Location Type Required Default Description
client_id form string yes The API client id provided by Flowmailer
client_secret form string yes The API client secret provided by Flowmailer
grant_type form string yes must be client_credentials
scope form string no api Must be absent or api

Response Messages

HTTP Status Code Response Model Response Headers Description
200 OAuthTokenResponse The request was successfull, the access token can be found in the JSON encoded response
400 OAuthErrorResponse Bad Request, could also be an text/html response if the credentials are invalid

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'POST',
    'header' =>
    array (
      'Accept: application/vnd.flowmailer.v1.5+json',
      'Content-Type: application/x-www-form-urlencoded',
    ),
    'content' => http_build_query(  
      array (
        'client_id' => $client_id,
        'client_secret' => $client_secret,
        'grant_type' => $grant_type,
        'scope' => $scope,
      )
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://login.flowmailer.net/oauth/token',
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

GET /{account_id}/filters

List filters per account

Resource URL

Type URL format
GET https://api.flowmailer.net/{account_id}/filters

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

daterange matrix date_range no

Date range the filter was added in

range header items_range yes

Limits the returned list

Response Messages

HTTP Status Code Response Model Response Headers Description
206 Filter[] Content-Range

Extra Response Headers

Name Type HTTP status code Description
Content-Range content_range 206 Used to specify which subset of the requested data is returned

Example request

GET /392/filters;daterange=2017-04-04T00:00:00Z,2017-04-05T00:00:00Z HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8
Range: items=0-10


HTTP/1.1 206 Partial Content
Content-Range: items 0-10/0
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

[ ]

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'GET',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
      'range: '.$range,
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/filters'
    .';'.http_build_query(array(
        'daterange' => $daterange,
      ), '', ';'),
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

GET /{account_id}/flow_rules

Get flow rule list for all flows

Resource URL

Type URL format
GET https://api.flowmailer.net/{account_id}/flow_rules

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

Response Messages

HTTP Status Code Response Model Response Headers Description
200 FlowRuleItem[]

Example request

GET /392/flow_rules HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8


HTTP/1.1 200 OK
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

[ {
  "flow" : {
    "id" : "12367",
    "description" : "Re-sent messages"
  },
  "conditions" : [ {
    "type" : "sourceId",
    "name" : null,
    "value" : "2026",
    "matchType" : null
  }, {
    "type" : "header",
    "name" : "X-Flowmailer",
    "value" : "resend",
    "matchType" : null
  } ]
}, {
  "flow" : {
    "id" : "12368",
    "description" : "test flow 1 (updated)"
  },
  "conditions" : [ {
    "type" : "sender",
    "name" : null,
    "value" : "test@test.test",
    "matchType" : null
  }, {
    "type" : "header",
    "name" : "Subject",
    "value" : "Test",
    "matchType" : null
  } ]
}, {
  "flow" : {
    "id" : "12369",
    "description" : "test flow 2"
  },
  "conditions" : [ {
    "type" : "sender",
    "name" : null,
    "value" : "support@flowmailer.com",
    "matchType" : null
  }, {
    "type" : "header",
    "name" : "X-Flow",
    "value" : "flow2",
    "matchType" : null
  } ]
}, {
  "flow" : {
    "id" : "12366",
    "description" : "Default"
  },
  "conditions" : [ ]
} ]

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'GET',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/flow_rules',
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

GET /{account_id}/flows

List flows per account

Resource URL

Type URL format
GET https://api.flowmailer.net/{account_id}/flows

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

statistics query boolean no true

Whether to return statistics per flow

Response Messages

HTTP Status Code Response Model Response Headers Description
200 Flow[]

Example request

GET /392/flows?statistics=false HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8


HTTP/1.1 200 OK
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

[ {
  "id" : "12366",
  "templateId" : "1",
  "description" : "Default",
  "steps" : null
}, {
  "id" : "12367",
  "templateId" : "1",
  "description" : "Re-sent messages",
  "steps" : null
}, {
  "id" : "12368",
  "templateId" : "1",
  "description" : "test flow 1 (updated)",
  "steps" : null
}, {
  "id" : "12369",
  "templateId" : "1",
  "description" : "test flow 2",
  "steps" : null
} ]

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'GET',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/flows'
    .';'.http_build_query(array(
        'daterange' => $daterange,
      ), '', ';')
    .'?'.http_build_query(array(
        'statistics' => $statistics,
      )),
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

POST /{account_id}/flows

Create a new flow.

Resource URL

Type URL format
POST https://api.flowmailer.net/{account_id}/flows

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

body body Flow yes

Flow object

Response Messages

HTTP Status Code Response Model Response Headers Description
201 Location

Extra Response Headers

Name Type HTTP status code Description
Location url 201 Contains the URL of the newly created API resource

Example request

POST /392/flows HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

{
  "description" : "test flow 2",
  "steps" : [ {
    "template" : {
      "id" : "6887"
    },
    "type" : "template"
  }, {
    "onlineLink" : true,
    "type" : "archive"
  } ],
  "templateId" : 1
}

HTTP/1.1 201 Created
Location: http://localhost:7979/flowmailer-api/392/flows/12369
Content-Length: 0

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'POST',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
      'Content-Type: application/vnd.flowmailer.v1.5+json',
    ),
    'content' => json_encode($requestbody),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/flows',
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

DELETE /{account_id}/flows/{flow_id}

Delete flow by id.

Resource URL

Type URL format
DELETE https://api.flowmailer.net/{account_id}/flows/{flow_id}

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

flow_id path string yes

Flow ID

Response Messages

HTTP Status Code Response Model Response Headers Description
200 void

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'DELETE',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/flows/'.$flow_id.'',
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

GET /{account_id}/flows/{flow_id}

Get flow by id

Resource URL

Type URL format
GET https://api.flowmailer.net/{account_id}/flows/{flow_id}

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

flow_id path string yes

Flow ID

Response Messages

HTTP Status Code Response Model Response Headers Description
200 Flow

Example request

GET /392/flows/12369 HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8


HTTP/1.1 200 OK
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

{
  "id" : "12369",
  "templateId" : "1",
  "description" : "test flow 2",
  "steps" : [ {
    "id" : "32052",
    "type" : "template",
    "template" : {
      "id" : "6887",
      "description" : "test template 2"
    }
  }, {
    "id" : "32053",
    "type" : "archive",
    "onlineLink" : true
  } ]
}

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'GET',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/flows/'.$flow_id.'',
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

PUT /{account_id}/flows/{flow_id}

Save flow.

Resource URL

Type URL format
PUT https://api.flowmailer.net/{account_id}/flows/{flow_id}

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

body body Flow yes

Flow object

flow_id path string yes

Flow ID

Response Messages

HTTP Status Code Response Model Response Headers Description
200 Flow

Example request

PUT /392/flows/12368 HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

{
  "description" : "test flow 1 (updated)",
  "templateId" : 1,
  "steps" : [ {
    "template" : {
      "id" : "6886"
    },
    "type" : "template"
  } ]
}

HTTP/1.1 200 OK
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

{
  "id" : "12368",
  "templateId" : "1",
  "description" : "test flow 1 (updated)",
  "steps" : [ {
    "id" : "32051",
    "type" : "template",
    "template" : {
      "id" : "6886",
      "description" : "test template 1"
    }
  } ]
}

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'PUT',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/flows/'.$flow_id.'',
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

GET /{account_id}/flows/{flow_id}/messages

List messages per flow

Resource URL

Type URL format
GET https://api.flowmailer.net/{account_id}/flows/{flow_id}/messages

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

addheaders query boolean no false

Whether to add e-mail headers

addonlinelink query boolean no false
daterange matrix date_range yes

Date range the message was submitted in

flow_id path string yes

Flow ID

range header items_range yes

Limits the returned list

Response Messages

HTTP Status Code Response Model Response Headers Description
206 Message[] Content-Range

Extra Response Headers

Name Type HTTP status code Description
Content-Range content_range 206 Used to specify which subset of the requested data is returned

Example request

GET /392/flows/12368/messages;daterange=2017-04-04T00:00:00Z,2017-04-05T00:00:00Z?addheaders=true&addonlinelink=true HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8
Range: items=0-10


HTTP/1.1 206 Partial Content
Content-Range: items 0-10/0
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

[ ]

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'GET',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
      'range: '.$range,
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/flows/'.$flow_id.'/messages'
    .';'.http_build_query(array(
        'daterange' => $daterange,
      ), '', ';')
    .'?'.http_build_query(array(
        'addheaders' => $addheaders,
        'addonlinelink' => $addonlinelink,
      )),
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

GET /{account_id}/flows/{flow_id}/rule

Get flow conditions for a flow

Resource URL

Type URL format
GET https://api.flowmailer.net/{account_id}/flows/{flow_id}/rule

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

flow_id path string yes

Flow ID

Response Messages

HTTP Status Code Response Model Response Headers Description
200 FlowRuleSimple

Example request

GET /392/flows/12368/rule HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8


HTTP/1.1 200 OK
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

{
  "flowId" : "12368",
  "sourceId" : null,
  "sender" : "test@test.test",
  "headers" : [ {
    "name" : "Subject",
    "value" : "Test"
  } ]
}

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'GET',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/flows/'.$flow_id.'/rule',
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

PUT /{account_id}/flows/{flow_id}/rule

Set flow rules for a flow.

Resource URL

Type URL format
PUT https://api.flowmailer.net/{account_id}/flows/{flow_id}/rule

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

body body FlowRuleSimple yes

Flow rules

flow_id path string yes

Flow ID

Response Messages

HTTP Status Code Response Model Response Headers Description
200 void

Example request

PUT /392/flows/12369/rule HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

{
  "headers" : [ {
    "name" : "X-Flow",
    "value" : "flow2"
  } ],
  "sender" : "support@flowmailer.com"
}

HTTP/1.1 200 OK
Content-Length: 0

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'PUT',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/flows/'.$flow_id.'/rule',
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

GET /{account_id}/flows/{flow_id}/stats

Get time based message statistics for a message flow

The resolution of the returned data may be lower than specified in the interval parameter if the data is old or the requested date range is too large.

Resource URL

Type URL format
GET https://api.flowmailer.net/{account_id}/flows/{flow_id}/stats

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

daterange matrix date_range yes

Date range the messages were submitted in

flow_id path string yes

Flow ID

interval matrix integer no

Time difference between samples

Response Messages

HTTP Status Code Response Model Response Headers Description
200 DataSets

Example request

GET /392/flows/12368/stats;daterange=2017-04-04T00:00:00Z,2017-04-05T00:00:00Z;interval=86400 HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8


HTTP/1.1 200 OK
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

{
  "list" : [ {
    "name" : "processed",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 0
    } ]
  }, {
    "name" : "email",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 0
    } ]
  }, {
    "name" : "sms",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 0
    } ]
  }, {
    "name" : "sent",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 0
    } ]
  }, {
    "name" : "delivered",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 0
    } ]
  }, {
    "name" : "deliver_time",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 0
    } ]
  }, {
    "name" : "opened",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 0
    } ]
  }, {
    "name" : "unique_opened",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 0
    } ]
  }, {
    "name" : "clicked",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 0
    } ]
  }, {
    "name" : "unique_clicked",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 0
    } ]
  } ]
}

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'GET',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/flows/'.$flow_id.'/stats'
    .';'.http_build_query(array(
        'daterange' => $daterange,
        'interval' => $interval,
      ), '', ';'),
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

GET /{account_id}/message_events

List message events

Ordered by received, new events first.

Resource URL

Type URL format
GET https://api.flowmailer.net/{account_id}/message_events

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

daterange matrix date_range no
flow_ids matrix string[] no

Filter results on message flow ID

range header items_range yes

Limits the returned list

receivedrange matrix date_range yes
source_ids matrix string[] no

Filter results on message source ID

Response Messages

HTTP Status Code Response Model Response Headers Description
206 MessageEvent[] Content-Range

Extra Response Headers

Name Type HTTP status code Description
Content-Range content_range 206 Used to specify which subset of the requested data is returned

Example request

GET /392/message_events;daterange=2017-04-04T00:00:00Z,2017-04-05T00:00:00Z;receivedrange=2017-04-04T00:00:00Z,2017-04-05T00:00:00Z HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8
Range: items=0-10


HTTP/1.1 206 Partial Content
Content-Range: items 0-10/3
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

[ {
  "id" : "d9b8a953-d8b9-443a-81c6-6b01dd5186de",
  "messageId" : "201704041250599826f7bfb8fd1683b1",
  "type" : "CLICKED",
  "received" : "2017-04-04T12:51:21.662Z",
  "referer" : "http://www.flowmailer.com/test.html",
  "remoteAddr" : null,
  "userAgentString" : null,
  "deviceCategory" : null,
  "userAgent" : null,
  "userAgentType" : null,
  "userAgentVersion" : null,
  "userAgentDisplayName" : null,
  "operatingSystem" : null,
  "operatingSystemVersion" : null,
  "linkTarget" : "http://www.flowmailer.com/test.html",
  "linkName" : "test link"
}, {
  "id" : "d2ddf9af-7fe9-4a3e-afd9-6fb8e0e6ed29",
  "messageId" : "201704041251108f43c41d632c4754ef",
  "type" : "DELIVERED",
  "received" : "2017-04-04T12:51:10.000Z",
  "snippet" : "smtp;250 Ok",
  "mta" : "[127.0.0.1] (127.0.0.1)",
  "data" : null
}, {
  "id" : "40367339-302a-4caa-9269-9802915fe015",
  "messageId" : "201704041250599826f7bfb8fd1683b1",
  "type" : "DELIVERED",
  "received" : "2017-04-04T12:50:59.000Z",
  "snippet" : "smtp;250 Ok",
  "mta" : "[127.0.0.1] (127.0.0.1)",
  "data" : null
} ]

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'GET',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
      'range: '.$range,
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/message_events'
    .';'.http_build_query(array(
        'daterange' => $daterange,
        'flow_ids' => $flow_ids,
        'receivedrange' => $receivedrange,
        'source_ids' => $source_ids,
      ), '', ';'),
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

GET /{account_id}/message_hold

List messages which could not be processed

Resource URL

Type URL format
GET https://api.flowmailer.net/{account_id}/message_hold

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

daterange matrix date_range no

Date range the message was submitted in

range header items_range yes

Limits the returned list

Response Messages

HTTP Status Code Response Model Response Headers Description
206 MessageHold[] Content-Range

Extra Response Headers

Name Type HTTP status code Description
Content-Range content_range 206 Used to specify which subset of the requested data is returned

Example request

GET /392/message_hold;daterange=2017-04-04T00:00:00Z,2017-04-05T00:00:00Z HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8
Range: items=0-10


HTTP/1.1 206 Partial Content
Content-Range: items 0-10/0
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

[ ]

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'GET',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
      'range: '.$range,
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/message_hold'
    .';'.http_build_query(array(
        'daterange' => $daterange,
      ), '', ';'),
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

GET /{account_id}/message_hold/{message_id}

Get a held message by its id

Resource URL

Type URL format
GET https://api.flowmailer.net/{account_id}/message_hold/{message_id}

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

message_id path string yes

Message ID

Response Messages

HTTP Status Code Response Model Response Headers Description
200 MessageHold

Example request

GET /392/message_hold/201704041250599826f7bfb8fd1683b1 HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8


HTTP/1.1 404 Not Found
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

{
  "allErrors" : [ {
    "code" : "notfound",
    "arguments" : null,
    "defaultMessage" : "Not found.",
    "objectName" : null,
    "field" : null,
    "rejectedValue" : null
  } ]
}

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'GET',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/message_hold/'.$message_id.'',
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

GET /{account_id}/messages

List messages

Either transaction_id or both daterange and range are required

Resource URL

Type URL format
GET https://api.flowmailer.net/{account_id}/messages

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

addevents query boolean no false

Whether to add message events

addheaders query boolean no false

Whether to add e-mail headers

addonlinelink query boolean no false
daterange matrix date_range yes

Date range the message was submitted in

flow_ids matrix string[] no

Filter results on flow ID

range header items_range yes

Limits the returned list

transaction_id matrix string no

Filter on the SMTP transaction id

Response Messages

HTTP Status Code Response Model Response Headers Description
200 Message[]
206 Message[] Content-Range

Extra Response Headers

Name Type HTTP status code Description
Content-Range content_range 206 Used to specify which subset of the requested data is returned

Example request

GET /392/messages;daterange=2017-04-04T00:00:00Z,2017-04-05T00:00:00Z?addheaders=true&addonlinelink=true HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8
Range: items=0-10


HTTP/1.1 206 Partial Content
Content-Range: items 0-10/2
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

[ {
  "submitted" : "2017-04-04T12:51:10.000Z",
  "id" : "201704041251108f43c41d632c4754ef",
  "transactionId" : "00f4abaf2e68407294cd57fb03eadcfa",
  "messageIdHeader" : "<201704041251108f43c41d632c4754ef@return.flowmailer.local>",
  "messageType" : "EMAIL",
  "source" : {
    "id" : "2027",
    "description" : "test source 1"
  },
  "flow" : {
    "id" : "12369",
    "description" : "test flow 2"
  },
  "senderAddress" : "support@flowmailer.com",
  "recipientAddress" : "richard@flowmailer.com",
  "backendStart" : "2017-04-04T12:51:10.541Z",
  "backendDone" : "2017-04-04T12:51:10.567Z",
  "headersIn" : [ {
    "name" : "MIME-Version",
    "value" : "1.0"
  }, {
    "name" : "From",
    "value" : "Casper Mout <casper@flowmailer.com>"
  }, {
    "name" : "To",
    "value" : "Richard van Looijen <richard@flowmailer.com>"
  }, {
    "name" : "X-Flow",
    "value" : "flow2"
  }, {
    "name" : "Subject",
    "value" : "test message 2"
  }, {
    "name" : "Content-Type",
    "value" : "multipart/mixed; boundary=\"-=Part.12.39f76a417e1b8d44.15b3904d84b.850afbb35a30d456=-\""
  } ],
  "headersOut" : [ {
    "name" : "MIME-Version",
    "value" : "1.0"
  }, {
    "name" : "From",
    "value" : "Casper Mout <casper@flowmailer.com>"
  }, {
    "name" : "To",
    "value" : "Richard van Looijen <richard@flowmailer.com>"
  }, {
    "name" : "X-Flow",
    "value" : "flow2"
  }, {
    "name" : "Subject",
    "value" : "test message 2"
  }, {
    "name" : "Content-Type",
    "value" : "multipart/mixed; boundary=\"-=Part.12.39f76a417e1b8d44.15b3904d84b.850afbb35a30d456=-\""
  }, {
    "name" : "Feedback-ID",
    "value" : "392:392-2027:392-12369:flowmailer"
  }, {
    "name" : "Message-ID",
    "value" : "<201704041251108f43c41d632c4754ef@return.flowmailer.local>"
  }, {
    "name" : "Date",
    "value" : "Tue, 4 Apr 2017 12:51:10 +0000"
  }, {
    "name" : "X-Job",
    "value" : "fm-2027-12369"
  } ],
  "onlineLink" : "https://web.flowmailer.net/viewonline.html?id=e157da1311a3423bf13e03a5c29754754238adb716ebee66c81bccd11217a9fb3287e5eecaa48ac0",
  "status" : "DELIVERED",
  "subject" : "test message 2",
  "from" : "casper@flowmailer.com",
  "events" : null,
  "messageDetailsLink" : "https://web.flowmailer.net/viewmessage.html?id=e157da1311a3423bf13e03a5c29754754238adb716ebee66c81bccd11217a9fb3287e5eecaa48ac0&code=bf8cdf9cd80628b27e08d79d82915b7ff4d64417",
  "fromAddress" : {
    "name" : "Casper Mout",
    "address" : "casper@flowmailer.com"
  },
  "toAddressList" : [ {
    "name" : "Richard van Looijen",
    "address" : "richard@flowmailer.com"
  } ]
}, {
  "submitted" : "2017-04-04T12:50:59.000Z",
  "id" : "201704041250599826f7bfb8fd1683b1",
  "transactionId" : "793d07e9ee46480e91a555147bc7ba87",
  "messageIdHeader" : "<201704041250599826f7bfb8fd1683b1@return.flowmailer.local>",
  "messageType" : "EMAIL",
  "source" : {
    "id" : "2027",
    "description" : "test source 1"
  },
  "flow" : {
    "id" : "12369",
    "description" : "test flow 2"
  },
  "senderAddress" : "support@flowmailer.com",
  "recipientAddress" : "richard@flowmailer.com",
  "backendStart" : "2017-04-04T12:50:59.520Z",
  "backendDone" : "2017-04-04T12:50:59.556Z",
  "headersIn" : [ {
    "name" : "MIME-Version",
    "value" : "1.0"
  }, {
    "name" : "From",
    "value" : "Casper Mout <casper@flowmailer.com>"
  }, {
    "name" : "To",
    "value" : "Richard van Looijen <richard@flowmailer.com>"
  }, {
    "name" : "X-Flow",
    "value" : "flow2"
  }, {
    "name" : "Subject",
    "value" : "test message 1"
  }, {
    "name" : "Content-Type",
    "value" : "multipart/alternative; boundary=\"-=Part.10.9ee58ecdae4713c.15b3904ad3d.4b8e722d73feb546=-\""
  } ],
  "headersOut" : [ {
    "name" : "MIME-Version",
    "value" : "1.0"
  }, {
    "name" : "From",
    "value" : "Casper Mout <casper@flowmailer.com>"
  }, {
    "name" : "To",
    "value" : "Richard van Looijen <richard@flowmailer.com>"
  }, {
    "name" : "X-Flow",
    "value" : "flow2"
  }, {
    "name" : "Subject",
    "value" : "test message 1"
  }, {
    "name" : "Content-Type",
    "value" : "multipart/alternative; boundary=\"-=Part.10.9ee58ecdae4713c.15b3904ad3d.4b8e722d73feb546=-\""
  }, {
    "name" : "Feedback-ID",
    "value" : "392:392-2027:392-12369:flowmailer"
  }, {
    "name" : "Message-ID",
    "value" : "<201704041250599826f7bfb8fd1683b1@return.flowmailer.local>"
  }, {
    "name" : "Date",
    "value" : "Tue, 4 Apr 2017 12:50:59 +0000"
  }, {
    "name" : "X-Job",
    "value" : "fm-2027-12369"
  } ],
  "onlineLink" : "https://web.flowmailer.net/viewonline.html?id=4983a5a2e4df0662d31b7d129e3d0d43498bd732e18b46bd7eff8cf8bc45e655a1b57703aa892a6d",
  "status" : "CLICKED",
  "subject" : "test message 1",
  "from" : "casper@flowmailer.com",
  "events" : null,
  "messageDetailsLink" : "https://web.flowmailer.net/viewmessage.html?id=4983a5a2e4df0662d31b7d129e3d0d43498bd732e18b46bd7eff8cf8bc45e655a1b57703aa892a6d&code=a27a5213cd4c40fca05e3e96f4066acfe3c72268",
  "fromAddress" : {
    "name" : "Casper Mout",
    "address" : "casper@flowmailer.com"
  },
  "toAddressList" : [ {
    "name" : "Richard van Looijen",
    "address" : "richard@flowmailer.com"
  } ]
} ]

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'GET',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
      'range: '.$range,
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/messages'
    .';'.http_build_query(array(
        'daterange' => $daterange,
        'flow_ids' => $flow_ids,
        'transaction_id' => $transaction_id,
      ), '', ';')
    .'?'.http_build_query(array(
        'addevents' => $addevents,
        'addheaders' => $addheaders,
        'addonlinelink' => $addonlinelink,
      )),
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

POST /{account_id}/messages/submit

Send an email or sms message

Resource URL

Type URL format
POST https://api.flowmailer.net/{account_id}/messages/submit

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

body body SubmitMessage yes

Message to submit

Response Messages

HTTP Status Code Response Model Response Headers Description
201 Location

Extra Response Headers

Name Type HTTP status code Description
Location url 201 Contains the URL of the newly created API resource

Example request

POST /392/messages/submit HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

{
  "attachments" : [ {
    "content" : "YWJjCg==",
    "contentType" : "application/pdf",
    "filename" : "test-pdf1.pdf"
  }, {
    "content" : "YWJjCg==",
    "contentType" : "application/pdf",
    "filename" : "test-pdf2.pdf"
  } ],
  "data" : {
    "name" : "Richard van Looijen"
  },
  "headerFromAddress" : "casper@flowmailer.com",
  "headerFromName" : "Casper Mout",
  "headerToName" : "Richard van Looijen",
  "headers" : [ {
    "name" : "X-Flow",
    "value" : "flow2"
  } ],
  "html" : "<html>\n<body>\nBeste test,<br/>\n<br/>\ntest submit 2<br/>\n</body></html>",
  "messageType" : "EMAIL",
  "recipientAddress" : "richard@flowmailer.com",
  "senderAddress" : "support@flowmailer.com",
  "subject" : "test message 2",
  "text" : "Beste test,\n\ntest submit 2\n"
}

HTTP/1.1 201 Created
Location: https://api.flowmailer.net/392/messages/201704041251108f43c41d632c4754ef
Content-Length: 0

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'POST',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
      'Content-Type: application/vnd.flowmailer.v1.5+json',
    ),
    'content' => json_encode($requestbody),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/messages/submit',
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

GET /{account_id}/messages/{message_id}

Get message by id

Resource URL

Type URL format
GET https://api.flowmailer.net/{account_id}/messages/{message_id}

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

message_id path string yes

Message ID

Response Messages

HTTP Status Code Response Model Response Headers Description
200 Message

Example request

GET /392/messages/201704041250599826f7bfb8fd1683b1 HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8


HTTP/1.1 200 OK
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

{
  "submitted" : "2017-04-04T12:50:59.000Z",
  "id" : "201704041250599826f7bfb8fd1683b1",
  "transactionId" : "793d07e9ee46480e91a555147bc7ba87",
  "messageIdHeader" : "<201704041250599826f7bfb8fd1683b1@return.flowmailer.local>",
  "messageType" : "EMAIL",
  "source" : {
    "id" : "2027",
    "description" : "test source 1"
  },
  "flow" : {
    "id" : "12369",
    "description" : "test flow 2"
  },
  "senderAddress" : "support@flowmailer.com",
  "recipientAddress" : "richard@flowmailer.com",
  "backendStart" : "2017-04-04T12:50:59.520Z",
  "backendDone" : "2017-04-04T12:50:59.556Z",
  "headersIn" : [ {
    "name" : "MIME-Version",
    "value" : "1.0"
  }, {
    "name" : "From",
    "value" : "Casper Mout <casper@flowmailer.com>"
  }, {
    "name" : "To",
    "value" : "Richard van Looijen <richard@flowmailer.com>"
  }, {
    "name" : "X-Flow",
    "value" : "flow2"
  }, {
    "name" : "Subject",
    "value" : "test message 1"
  }, {
    "name" : "Content-Type",
    "value" : "multipart/alternative; boundary=\"-=Part.10.9ee58ecdae4713c.15b3904ad3d.4b8e722d73feb546=-\""
  } ],
  "headersOut" : [ {
    "name" : "MIME-Version",
    "value" : "1.0"
  }, {
    "name" : "From",
    "value" : "Casper Mout <casper@flowmailer.com>"
  }, {
    "name" : "To",
    "value" : "Richard van Looijen <richard@flowmailer.com>"
  }, {
    "name" : "X-Flow",
    "value" : "flow2"
  }, {
    "name" : "Subject",
    "value" : "test message 1"
  }, {
    "name" : "Content-Type",
    "value" : "multipart/alternative; boundary=\"-=Part.10.9ee58ecdae4713c.15b3904ad3d.4b8e722d73feb546=-\""
  }, {
    "name" : "Feedback-ID",
    "value" : "392:392-2027:392-12369:flowmailer"
  }, {
    "name" : "Message-ID",
    "value" : "<201704041250599826f7bfb8fd1683b1@return.flowmailer.local>"
  }, {
    "name" : "Date",
    "value" : "Tue, 4 Apr 2017 12:50:59 +0000"
  }, {
    "name" : "X-Job",
    "value" : "fm-2027-12369"
  } ],
  "onlineLink" : "https://web.flowmailer.net/viewonline.html?id=4983a5a2e4df0662d31b7d129e3d0d43498bd732e18b46bd7eff8cf8bc45e655a1b57703aa892a6d",
  "status" : "CLICKED",
  "subject" : "test message 1",
  "from" : "casper@flowmailer.com",
  "events" : [ {
    "id" : "d9b8a953-d8b9-443a-81c6-6b01dd5186de",
    "messageId" : "201704041250599826f7bfb8fd1683b1",
    "type" : "CLICKED",
    "received" : "2017-04-04T12:51:21.662Z",
    "extraData" : { },
    "referer" : "http://www.flowmailer.com/test.html",
    "remoteAddr" : null,
    "userAgentString" : null,
    "deviceCategory" : null,
    "userAgent" : null,
    "userAgentType" : null,
    "userAgentVersion" : null,
    "userAgentDisplayName" : null,
    "operatingSystem" : null,
    "operatingSystemVersion" : null,
    "linkTarget" : "http://www.flowmailer.com/test.html",
    "linkName" : "test link"
  }, {
    "id" : "40367339-302a-4caa-9269-9802915fe015",
    "messageId" : "201704041250599826f7bfb8fd1683b1",
    "type" : "DELIVERED",
    "received" : "2017-04-04T12:50:59.000Z",
    "snippet" : "smtp;250 Ok",
    "mta" : "[127.0.0.1] (127.0.0.1)",
    "data" : null
  }, {
    "id" : null,
    "messageId" : "201704041250599826f7bfb8fd1683b1",
    "type" : "PROCESSED",
    "received" : "2017-04-04T12:50:59.556Z",
    "snippet" : null,
    "mta" : null,
    "data" : null
  }, {
    "id" : null,
    "messageId" : "201704041250599826f7bfb8fd1683b1",
    "type" : "SUBMITTED",
    "received" : "2017-04-04T12:50:59.000Z",
    "snippet" : null,
    "mta" : null,
    "data" : null
  } ],
  "messageDetailsLink" : "https://web.flowmailer.net/viewmessage.html?id=4983a5a2e4df0662d31b7d129e3d0d43498bd732e18b46bd7eff8cf8bc45e655a1b57703aa892a6d&code=a27a5213cd4c40fca05e3e96f4066acfe3c72268",
  "fromAddress" : {
    "name" : "Casper Mout",
    "address" : "casper@flowmailer.com"
  },
  "toAddressList" : [ {
    "name" : "Richard van Looijen",
    "address" : "richard@flowmailer.com"
  } ]
}

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'GET',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/messages/'.$message_id.'',
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

GET /{account_id}/messages/{message_id}/archive

List the message as archived by one or more flow steps

Resource URL

Type URL format
GET https://api.flowmailer.net/{account_id}/messages/{message_id}/archive

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

addattachments query boolean no false
message_id path string yes

Message ID

Response Messages

HTTP Status Code Response Model Response Headers Description
200 MessageArchive[]

Example request

GET /392/messages/201704041251108f43c41d632c4754ef/archive?addattachments=true HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8


HTTP/1.1 200 OK
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

[ {
  "flowStepId" : "32053",
  "messageType" : "EMAIL",
  "onlineVersion" : true,
  "subject" : "test message 2",
  "text" : "Beste test,\r\n\r\ntest submit 2\r\n",
  "html" : "<html><body>html template<br/>\r\nmet twee regions<br/>\r\nnog wat onaanpasbare tekst<br/>\r\ntekst in de tweede region<br/>\r\nnog een regel<br/>\r\nnog meer onaanpasbare tekst\r\n<br/></body></html>",
  "attachments" : [ {
    "contentId" : "201704041251108f43c41d632c4754ef-index-0@flowmailer.com",
    "filename" : "test-pdf1.pdf",
    "contentType" : "application/pdf"
  }, {
    "contentId" : "201704041251108f43c41d632c4754ef-index-1@flowmailer.com",
    "filename" : "test-pdf2.pdf",
    "contentType" : "application/pdf"
  } ],
  "onlineLink" : "https://web.flowmailer.net/viewonline.html?id=e157da1311a3423bf13e03a5c29754754238adb716ebee66c81bccd11217a9fb3287e5eecaa48ac0",
  "messageDetailsLink" : "https://web.flowmailer.net/viewmessage.html?id=e157da1311a3423bf13e03a5c29754754238adb716ebee66c81bccd11217a9fb3287e5eecaa48ac0&code=bf8cdf9cd80628b27e08d79d82915b7ff4d64417"
} ]

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'GET',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/messages/'.$message_id.'/archive'
    .'?'.http_build_query(array(
        'addattachments' => $addattachments,
        'adddata' => $adddata,
      )),
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

GET /{account_id}/messages/{message_id}/archive/{flow_step_id}/attachment/{content_id}

Fetch an attachment including data for an archived message.

Resource URL

Type URL format
GET https://api.flowmailer.net/{account_id}/messages/{message_id}/archive/{flow_step_id}/attachment/{content_id}

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

content_id path string yes

Attachment content ID

flow_step_id path string yes

Flow step ID

message_id path string yes

Message ID

Response Messages

HTTP Status Code Response Model Response Headers Description
200 Attachment

Example request

GET /392/messages/201704041251108f43c41d632c4754ef/archive/32053/attachment/201704041251108f43c41d632c4754ef-index-0@flowmailer.com HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8


HTTP/1.1 200 OK
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

{
  "contentId" : "201704041251108f43c41d632c4754ef-index-0@flowmailer.com",
  "filename" : "test-pdf1.pdf",
  "contentType" : "application/pdf",
  "content" : "YWJjCg=="
}

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'GET',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/messages/'.$message_id.'/archive/'.$flow_step_id.'/attachment/'.$content_id.'',
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

POST /{account_id}/messages/{message_id}/resend

Resend message by id

Resource URL

Type URL format
POST https://api.flowmailer.net/{account_id}/messages/{message_id}/resend

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

body body ResendMessage yes
message_id path string yes

Message ID

Response Messages

HTTP Status Code Response Model Response Headers Description
201 Location

Extra Response Headers

Name Type HTTP status code Description
Location url 201 Contains the URL of the newly created API resource

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'POST',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
      'Content-Type: application/vnd.flowmailer.v1.5+json',
    ),
    'content' => json_encode($requestbody),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/messages/'.$message_id.'/resend',
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

GET /{account_id}/messagestats

Get time based message statistics for whole account

The resolution of the returned data may be lower than specified in the interval parameter if the data is old or the requested date range is too large.

Resource URL

Type URL format
GET https://api.flowmailer.net/{account_id}/messagestats

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

daterange matrix date_range no

Date range the messages were submitted in

flow_ids matrix string[] no
interval query integer no

Time difference between samples

Response Messages

HTTP Status Code Response Model Response Headers Description
200 DataSets

Example request

GET /392/messagestats;daterange=2017-04-04T00:00:00Z,2017-04-05T00:00:00Z?interval=86400 HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8


HTTP/1.1 200 OK
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

{
  "list" : [ {
    "name" : "processed",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 2
    } ]
  }, {
    "name" : "email",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 2
    } ]
  }, {
    "name" : "sms",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 0
    } ]
  }, {
    "name" : "sent",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 2
    } ]
  }, {
    "name" : "delivered",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 2
    } ]
  }, {
    "name" : "deliver_time",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 0
    } ]
  }, {
    "name" : "opened",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 0
    } ]
  }, {
    "name" : "unique_opened",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 0
    } ]
  }, {
    "name" : "clicked",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 1
    } ]
  }, {
    "name" : "unique_clicked",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 1
    } ]
  } ]
}

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'GET',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/messagestats'
    .';'.http_build_query(array(
        'daterange' => $daterange,
        'flow_ids' => $flow_ids,
      ), '', ';')
    .'?'.http_build_query(array(
        'interval' => $interval,
      )),
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

GET /{account_id}/recipient/{recipient}

Get information about a recipient

Message statistics are only included if a date range is specified.

Resource URL

Type URL format
GET https://api.flowmailer.net/{account_id}/recipient/{recipient}

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

daterange matrix date_range no

Specifies the date range for message statistics

recipient path string yes

Recipient email address or phone number

Response Messages

HTTP Status Code Response Model Response Headers Description
200 Recipient

Example request

GET /392/recipient/richard@flowmailer.com;daterange=2017-04-04T00:00:00Z,2017-04-05T00:00:00Z HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8


HTTP/1.1 200 OK
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

{
  "address" : "richard@flowmailer.com",
  "filters" : [ ],
  "messageSummary" : {
    "processed" : 2,
    "sent" : 2,
    "delivered" : 2,
    "opened" : 0,
    "uniqueOpened" : 0,
    "clicked" : 1,
    "uniqueClicked" : 1,
    "averageDeliverTimeMillis" : 0
  }
}

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'GET',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/recipient/'.$recipient.''
    .';'.http_build_query(array(
        'daterange' => $daterange,
      ), '', ';'),
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

GET /{account_id}/recipient/{recipient}/messages

List messages per recipient

Resource URL

Type URL format
GET https://api.flowmailer.net/{account_id}/recipient/{recipient}/messages

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

addheaders query boolean no false

Whether to add e-mail headers

addonlinelink query boolean no false

Whether to add online link

daterange matrix date_range yes

Date range the messages were submitted in

range header items_range yes

Limits the returned list

recipient path string yes

Recipient email address or phone number

Response Messages

HTTP Status Code Response Model Response Headers Description
206 Message[] Content-Range

Extra Response Headers

Name Type HTTP status code Description
Content-Range content_range 206 Used to specify which subset of the requested data is returned

Example request

GET /392/recipient/richard@flowmailer.com/messages;daterange=2017-04-04T00:00:00Z,2017-04-05T00:00:00Z?addheaders=true&addonlinelink=true HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8
Range: items=0-10


HTTP/1.1 206 Partial Content
Content-Range: items 0-10/2
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

[ {
  "submitted" : "2017-04-04T12:51:10.000Z",
  "id" : "201704041251108f43c41d632c4754ef",
  "transactionId" : "00f4abaf2e68407294cd57fb03eadcfa",
  "messageIdHeader" : "<201704041251108f43c41d632c4754ef@return.flowmailer.local>",
  "messageType" : "EMAIL",
  "source" : {
    "id" : "2027",
    "description" : "test source 1"
  },
  "flow" : {
    "id" : "12369",
    "description" : "test flow 2"
  },
  "senderAddress" : "support@flowmailer.com",
  "recipientAddress" : "richard@flowmailer.com",
  "backendStart" : "2017-04-04T12:51:10.541Z",
  "backendDone" : "2017-04-04T12:51:10.567Z",
  "headersIn" : [ {
    "name" : "MIME-Version",
    "value" : "1.0"
  }, {
    "name" : "From",
    "value" : "Casper Mout <casper@flowmailer.com>"
  }, {
    "name" : "To",
    "value" : "Richard van Looijen <richard@flowmailer.com>"
  }, {
    "name" : "X-Flow",
    "value" : "flow2"
  }, {
    "name" : "Subject",
    "value" : "test message 2"
  }, {
    "name" : "Content-Type",
    "value" : "multipart/mixed; boundary=\"-=Part.12.39f76a417e1b8d44.15b3904d84b.850afbb35a30d456=-\""
  } ],
  "headersOut" : [ {
    "name" : "MIME-Version",
    "value" : "1.0"
  }, {
    "name" : "From",
    "value" : "Casper Mout <casper@flowmailer.com>"
  }, {
    "name" : "To",
    "value" : "Richard van Looijen <richard@flowmailer.com>"
  }, {
    "name" : "X-Flow",
    "value" : "flow2"
  }, {
    "name" : "Subject",
    "value" : "test message 2"
  }, {
    "name" : "Content-Type",
    "value" : "multipart/mixed; boundary=\"-=Part.12.39f76a417e1b8d44.15b3904d84b.850afbb35a30d456=-\""
  }, {
    "name" : "Feedback-ID",
    "value" : "392:392-2027:392-12369:flowmailer"
  }, {
    "name" : "Message-ID",
    "value" : "<201704041251108f43c41d632c4754ef@return.flowmailer.local>"
  }, {
    "name" : "Date",
    "value" : "Tue, 4 Apr 2017 12:51:10 +0000"
  }, {
    "name" : "X-Job",
    "value" : "fm-2027-12369"
  } ],
  "onlineLink" : "https://web.flowmailer.net/viewonline.html?id=e157da1311a3423bf13e03a5c29754754238adb716ebee66c81bccd11217a9fb3287e5eecaa48ac0",
  "status" : "DELIVERED",
  "subject" : "test message 2",
  "from" : "casper@flowmailer.com",
  "events" : [ {
    "id" : "d2ddf9af-7fe9-4a3e-afd9-6fb8e0e6ed29",
    "messageId" : "201704041251108f43c41d632c4754ef",
    "type" : "DELIVERED",
    "received" : "2017-04-04T12:51:10.000Z",
    "snippet" : "smtp;250 Ok",
    "mta" : "[127.0.0.1] (127.0.0.1)",
    "data" : null
  }, {
    "id" : null,
    "messageId" : "201704041251108f43c41d632c4754ef",
    "type" : "PROCESSED",
    "received" : "2017-04-04T12:51:10.567Z",
    "snippet" : null,
    "mta" : null,
    "data" : null
  }, {
    "id" : null,
    "messageId" : "201704041251108f43c41d632c4754ef",
    "type" : "SUBMITTED",
    "received" : "2017-04-04T12:51:10.000Z",
    "snippet" : null,
    "mta" : null,
    "data" : null
  } ],
  "messageDetailsLink" : "https://web.flowmailer.net/viewmessage.html?id=e157da1311a3423bf13e03a5c29754754238adb716ebee66c81bccd11217a9fb3287e5eecaa48ac0&code=bf8cdf9cd80628b27e08d79d82915b7ff4d64417",
  "fromAddress" : {
    "name" : "Casper Mout",
    "address" : "casper@flowmailer.com"
  },
  "toAddressList" : [ {
    "name" : "Richard van Looijen",
    "address" : "richard@flowmailer.com"
  } ]
}, {
  "submitted" : "2017-04-04T12:50:59.000Z",
  "id" : "201704041250599826f7bfb8fd1683b1",
  "transactionId" : "793d07e9ee46480e91a555147bc7ba87",
  "messageIdHeader" : "<201704041250599826f7bfb8fd1683b1@return.flowmailer.local>",
  "messageType" : "EMAIL",
  "source" : {
    "id" : "2027",
    "description" : "test source 1"
  },
  "flow" : {
    "id" : "12369",
    "description" : "test flow 2"
  },
  "senderAddress" : "support@flowmailer.com",
  "recipientAddress" : "richard@flowmailer.com",
  "backendStart" : "2017-04-04T12:50:59.520Z",
  "backendDone" : "2017-04-04T12:50:59.556Z",
  "headersIn" : [ {
    "name" : "MIME-Version",
    "value" : "1.0"
  }, {
    "name" : "From",
    "value" : "Casper Mout <casper@flowmailer.com>"
  }, {
    "name" : "To",
    "value" : "Richard van Looijen <richard@flowmailer.com>"
  }, {
    "name" : "X-Flow",
    "value" : "flow2"
  }, {
    "name" : "Subject",
    "value" : "test message 1"
  }, {
    "name" : "Content-Type",
    "value" : "multipart/alternative; boundary=\"-=Part.10.9ee58ecdae4713c.15b3904ad3d.4b8e722d73feb546=-\""
  } ],
  "headersOut" : [ {
    "name" : "MIME-Version",
    "value" : "1.0"
  }, {
    "name" : "From",
    "value" : "Casper Mout <casper@flowmailer.com>"
  }, {
    "name" : "To",
    "value" : "Richard van Looijen <richard@flowmailer.com>"
  }, {
    "name" : "X-Flow",
    "value" : "flow2"
  }, {
    "name" : "Subject",
    "value" : "test message 1"
  }, {
    "name" : "Content-Type",
    "value" : "multipart/alternative; boundary=\"-=Part.10.9ee58ecdae4713c.15b3904ad3d.4b8e722d73feb546=-\""
  }, {
    "name" : "Feedback-ID",
    "value" : "392:392-2027:392-12369:flowmailer"
  }, {
    "name" : "Message-ID",
    "value" : "<201704041250599826f7bfb8fd1683b1@return.flowmailer.local>"
  }, {
    "name" : "Date",
    "value" : "Tue, 4 Apr 2017 12:50:59 +0000"
  }, {
    "name" : "X-Job",
    "value" : "fm-2027-12369"
  } ],
  "onlineLink" : "https://web.flowmailer.net/viewonline.html?id=4983a5a2e4df0662d31b7d129e3d0d43498bd732e18b46bd7eff8cf8bc45e655a1b57703aa892a6d",
  "status" : "CLICKED",
  "subject" : "test message 1",
  "from" : "casper@flowmailer.com",
  "events" : [ {
    "id" : "d9b8a953-d8b9-443a-81c6-6b01dd5186de",
    "messageId" : "201704041250599826f7bfb8fd1683b1",
    "type" : "CLICKED",
    "received" : "2017-04-04T12:51:21.662Z",
    "extraData" : { },
    "referer" : "http://www.flowmailer.com/test.html",
    "remoteAddr" : null,
    "userAgentString" : null,
    "deviceCategory" : null,
    "userAgent" : null,
    "userAgentType" : null,
    "userAgentVersion" : null,
    "userAgentDisplayName" : null,
    "operatingSystem" : null,
    "operatingSystemVersion" : null,
    "linkTarget" : "http://www.flowmailer.com/test.html",
    "linkName" : "test link"
  }, {
    "id" : "40367339-302a-4caa-9269-9802915fe015",
    "messageId" : "201704041250599826f7bfb8fd1683b1",
    "type" : "DELIVERED",
    "received" : "2017-04-04T12:50:59.000Z",
    "snippet" : "smtp;250 Ok",
    "mta" : "[127.0.0.1] (127.0.0.1)",
    "data" : null
  }, {
    "id" : null,
    "messageId" : "201704041250599826f7bfb8fd1683b1",
    "type" : "PROCESSED",
    "received" : "2017-04-04T12:50:59.556Z",
    "snippet" : null,
    "mta" : null,
    "data" : null
  }, {
    "id" : null,
    "messageId" : "201704041250599826f7bfb8fd1683b1",
    "type" : "SUBMITTED",
    "received" : "2017-04-04T12:50:59.000Z",
    "snippet" : null,
    "mta" : null,
    "data" : null
  } ],
  "messageDetailsLink" : "https://web.flowmailer.net/viewmessage.html?id=4983a5a2e4df0662d31b7d129e3d0d43498bd732e18b46bd7eff8cf8bc45e655a1b57703aa892a6d&code=a27a5213cd4c40fca05e3e96f4066acfe3c72268",
  "fromAddress" : {
    "name" : "Casper Mout",
    "address" : "casper@flowmailer.com"
  },
  "toAddressList" : [ {
    "name" : "Richard van Looijen",
    "address" : "richard@flowmailer.com"
  } ]
} ]

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'GET',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
      'range: '.$range,
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/recipient/'.$recipient.'/messages'
    .';'.http_build_query(array(
        'daterange' => $daterange,
      ), '', ';')
    .'?'.http_build_query(array(
        'addheaders' => $addheaders,
        'addonlinelink' => $addonlinelink,
      )),
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

GET /{account_id}/sender_identities

List sender identities by account

Resource URL

Type URL format
GET https://api.flowmailer.net/{account_id}/sender_identities

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

Response Messages

HTTP Status Code Response Model Response Headers Description
200 SenderIdentity[]

Example request

GET /392/sender_identities HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8


HTTP/1.1 200 OK
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

[ ]

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'GET',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/sender_identities',
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

POST /{account_id}/sender_identities

Resource URL

Type URL format
POST https://api.flowmailer.net/{account_id}/sender_identities

Parameters

Name Location Type Required Default Description
account_id path string yes
body body SenderIdentity yes

Response Messages

HTTP Status Code Response Model Response Headers Description
201 Location

Extra Response Headers

Name Type HTTP status code Description
Location url 201 Contains the URL of the newly created API resource

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'POST',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
      'Content-Type: application/vnd.flowmailer.v1.5+json',
    ),
    'content' => json_encode($requestbody),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/sender_identities',
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

GET /{account_id}/sender_identities/{identity_id}

Resource URL

Type URL format
GET https://api.flowmailer.net/{account_id}/sender_identities/{identity_id}

Parameters

Name Location Type Required Default Description
account_id path string yes
identity_id path string yes

Response Messages

HTTP Status Code Response Model Response Headers Description
200 SenderIdentity

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'GET',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/sender_identities/'.$identity_id.'',
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

PUT /{account_id}/sender_identities/{identity_id}

Resource URL

Type URL format
PUT https://api.flowmailer.net/{account_id}/sender_identities/{identity_id}

Parameters

Name Location Type Required Default Description
account_id path string yes
body body SenderIdentity yes
identity_id path string yes

Response Messages

HTTP Status Code Response Model Response Headers Description
200 void

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'PUT',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/sender_identities/'.$identity_id.'',
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

GET /{account_id}/sources

List source systems per account

Resource URL

Type URL format
GET https://api.flowmailer.net/{account_id}/sources

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

statistics query boolean no true

Whether to include message statistics or not

Response Messages

HTTP Status Code Response Model Response Headers Description
200 Source[]

Example request

GET /392/sources?statistics=false HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8


HTTP/1.1 200 OK
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

[ {
  "id" : "2026",
  "type" : "FLOWMAILER",
  "description" : "Flowmailer",
  "maxMessageSize" : null,
  "dsnAddress" : null,
  "feedbackLoopAddress" : null,
  "lastActive" : "2017-04-04T10:50:55.000+0000",
  "statistics" : null,
  "messageSummary" : null
}, {
  "id" : "2027",
  "type" : "NORMAL",
  "description" : "test source 1",
  "maxMessageSize" : null,
  "dsnAddress" : null,
  "feedbackLoopAddress" : null,
  "lastActive" : "2017-04-04T10:51:01.000+0000",
  "statistics" : null,
  "messageSummary" : null
} ]

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'GET',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/sources'
    .';'.http_build_query(array(
        'daterange' => $daterange,
      ), '', ';')
    .'?'.http_build_query(array(
        'statistics' => $statistics,
      )),
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

GET /{account_id}/sources/{source_id}

Get a source by id

Resource URL

Type URL format
GET https://api.flowmailer.net/{account_id}/sources/{source_id}

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

source_id path string yes

Source ID

Response Messages

HTTP Status Code Response Model Response Headers Description
200 Source

Example request

GET /392/sources/2027 HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8


HTTP/1.1 200 OK
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

{
  "id" : "2027",
  "type" : "NORMAL",
  "description" : "test source 1",
  "maxMessageSize" : null,
  "dsnAddress" : null,
  "feedbackLoopAddress" : null,
  "lastActive" : "2017-04-04T10:51:01.000+0000",
  "statistics" : null,
  "messageSummary" : null
}

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'GET',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/sources/'.$source_id.'',
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

GET /{account_id}/sources/{source_id}/messages

List messages per source

Resource URL

Type URL format
GET https://api.flowmailer.net/{account_id}/sources/{source_id}/messages

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

addheaders query boolean no false

Whether to add e-mail headers

addonlinelink query boolean no false
daterange matrix date_range yes

Date range the message was submitted in

range header items_range yes

Limits the returned list

source_id path string yes

Source ID

Response Messages

HTTP Status Code Response Model Response Headers Description
206 Message[] Content-Range

Extra Response Headers

Name Type HTTP status code Description
Content-Range content_range 206 Used to specify which subset of the requested data is returned

Example request

GET /392/sources/2027/messages;daterange=2017-04-04T00:00:00Z,2017-04-05T00:00:00Z?addheaders=true&addonlinelink=true HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8
Range: items=0-10


HTTP/1.1 206 Partial Content
Content-Range: items 0-10/2
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

[ {
  "submitted" : "2017-04-04T12:51:10.000Z",
  "id" : "201704041251108f43c41d632c4754ef",
  "transactionId" : "00f4abaf2e68407294cd57fb03eadcfa",
  "messageIdHeader" : "<201704041251108f43c41d632c4754ef@return.flowmailer.local>",
  "messageType" : "EMAIL",
  "source" : {
    "id" : "2027",
    "description" : "test source 1"
  },
  "flow" : {
    "id" : "12369",
    "description" : "test flow 2"
  },
  "senderAddress" : "support@flowmailer.com",
  "recipientAddress" : "richard@flowmailer.com",
  "backendStart" : "2017-04-04T12:51:10.541Z",
  "backendDone" : "2017-04-04T12:51:10.567Z",
  "headersIn" : [ {
    "name" : "MIME-Version",
    "value" : "1.0"
  }, {
    "name" : "From",
    "value" : "Casper Mout <casper@flowmailer.com>"
  }, {
    "name" : "To",
    "value" : "Richard van Looijen <richard@flowmailer.com>"
  }, {
    "name" : "X-Flow",
    "value" : "flow2"
  }, {
    "name" : "Subject",
    "value" : "test message 2"
  }, {
    "name" : "Content-Type",
    "value" : "multipart/mixed; boundary=\"-=Part.12.39f76a417e1b8d44.15b3904d84b.850afbb35a30d456=-\""
  } ],
  "headersOut" : [ {
    "name" : "MIME-Version",
    "value" : "1.0"
  }, {
    "name" : "From",
    "value" : "Casper Mout <casper@flowmailer.com>"
  }, {
    "name" : "To",
    "value" : "Richard van Looijen <richard@flowmailer.com>"
  }, {
    "name" : "X-Flow",
    "value" : "flow2"
  }, {
    "name" : "Subject",
    "value" : "test message 2"
  }, {
    "name" : "Content-Type",
    "value" : "multipart/mixed; boundary=\"-=Part.12.39f76a417e1b8d44.15b3904d84b.850afbb35a30d456=-\""
  }, {
    "name" : "Feedback-ID",
    "value" : "392:392-2027:392-12369:flowmailer"
  }, {
    "name" : "Message-ID",
    "value" : "<201704041251108f43c41d632c4754ef@return.flowmailer.local>"
  }, {
    "name" : "Date",
    "value" : "Tue, 4 Apr 2017 12:51:10 +0000"
  }, {
    "name" : "X-Job",
    "value" : "fm-2027-12369"
  } ],
  "onlineLink" : "https://web.flowmailer.net/viewonline.html?id=e157da1311a3423bf13e03a5c29754754238adb716ebee66c81bccd11217a9fb3287e5eecaa48ac0",
  "status" : "DELIVERED",
  "subject" : "test message 2",
  "from" : "casper@flowmailer.com",
  "events" : null,
  "messageDetailsLink" : "https://web.flowmailer.net/viewmessage.html?id=e157da1311a3423bf13e03a5c29754754238adb716ebee66c81bccd11217a9fb3287e5eecaa48ac0&code=bf8cdf9cd80628b27e08d79d82915b7ff4d64417",
  "fromAddress" : {
    "name" : "Casper Mout",
    "address" : "casper@flowmailer.com"
  },
  "toAddressList" : [ {
    "name" : "Richard van Looijen",
    "address" : "richard@flowmailer.com"
  } ]
}, {
  "submitted" : "2017-04-04T12:50:59.000Z",
  "id" : "201704041250599826f7bfb8fd1683b1",
  "transactionId" : "793d07e9ee46480e91a555147bc7ba87",
  "messageIdHeader" : "<201704041250599826f7bfb8fd1683b1@return.flowmailer.local>",
  "messageType" : "EMAIL",
  "source" : {
    "id" : "2027",
    "description" : "test source 1"
  },
  "flow" : {
    "id" : "12369",
    "description" : "test flow 2"
  },
  "senderAddress" : "support@flowmailer.com",
  "recipientAddress" : "richard@flowmailer.com",
  "backendStart" : "2017-04-04T12:50:59.520Z",
  "backendDone" : "2017-04-04T12:50:59.556Z",
  "headersIn" : [ {
    "name" : "MIME-Version",
    "value" : "1.0"
  }, {
    "name" : "From",
    "value" : "Casper Mout <casper@flowmailer.com>"
  }, {
    "name" : "To",
    "value" : "Richard van Looijen <richard@flowmailer.com>"
  }, {
    "name" : "X-Flow",
    "value" : "flow2"
  }, {
    "name" : "Subject",
    "value" : "test message 1"
  }, {
    "name" : "Content-Type",
    "value" : "multipart/alternative; boundary=\"-=Part.10.9ee58ecdae4713c.15b3904ad3d.4b8e722d73feb546=-\""
  } ],
  "headersOut" : [ {
    "name" : "MIME-Version",
    "value" : "1.0"
  }, {
    "name" : "From",
    "value" : "Casper Mout <casper@flowmailer.com>"
  }, {
    "name" : "To",
    "value" : "Richard van Looijen <richard@flowmailer.com>"
  }, {
    "name" : "X-Flow",
    "value" : "flow2"
  }, {
    "name" : "Subject",
    "value" : "test message 1"
  }, {
    "name" : "Content-Type",
    "value" : "multipart/alternative; boundary=\"-=Part.10.9ee58ecdae4713c.15b3904ad3d.4b8e722d73feb546=-\""
  }, {
    "name" : "Feedback-ID",
    "value" : "392:392-2027:392-12369:flowmailer"
  }, {
    "name" : "Message-ID",
    "value" : "<201704041250599826f7bfb8fd1683b1@return.flowmailer.local>"
  }, {
    "name" : "Date",
    "value" : "Tue, 4 Apr 2017 12:50:59 +0000"
  }, {
    "name" : "X-Job",
    "value" : "fm-2027-12369"
  } ],
  "onlineLink" : "https://web.flowmailer.net/viewonline.html?id=4983a5a2e4df0662d31b7d129e3d0d43498bd732e18b46bd7eff8cf8bc45e655a1b57703aa892a6d",
  "status" : "CLICKED",
  "subject" : "test message 1",
  "from" : "casper@flowmailer.com",
  "events" : null,
  "messageDetailsLink" : "https://web.flowmailer.net/viewmessage.html?id=4983a5a2e4df0662d31b7d129e3d0d43498bd732e18b46bd7eff8cf8bc45e655a1b57703aa892a6d&code=a27a5213cd4c40fca05e3e96f4066acfe3c72268",
  "fromAddress" : {
    "name" : "Casper Mout",
    "address" : "casper@flowmailer.com"
  },
  "toAddressList" : [ {
    "name" : "Richard van Looijen",
    "address" : "richard@flowmailer.com"
  } ]
} ]

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'GET',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
      'range: '.$range,
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/sources/'.$source_id.'/messages'
    .';'.http_build_query(array(
        'daterange' => $daterange,
      ), '', ';')
    .'?'.http_build_query(array(
        'addheaders' => $addheaders,
        'addonlinelink' => $addonlinelink,
      )),
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

GET /{account_id}/sources/{source_id}/stats

Get time based message statistics for a message source

The resolution of the returned data may be lower than specified in the interval parameter if the data is old or the requested date range is too large.

Resource URL

Type URL format
GET https://api.flowmailer.net/{account_id}/sources/{source_id}/stats

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

daterange matrix date_range yes

Date range the messages were submitted in

interval matrix integer no

Time difference between samples

source_id path string yes

Source ID

Response Messages

HTTP Status Code Response Model Response Headers Description
200 DataSets

Example request

GET /392/sources/2027/stats;daterange=2017-04-04T00:00:00Z,2017-04-05T00:00:00Z;interval=86400 HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8


HTTP/1.1 200 OK
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

{
  "list" : [ {
    "name" : "processed",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 2
    } ]
  }, {
    "name" : "email",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 2
    } ]
  }, {
    "name" : "sms",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 0
    } ]
  }, {
    "name" : "sent",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 2
    } ]
  }, {
    "name" : "delivered",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 2
    } ]
  }, {
    "name" : "deliver_time",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 0
    } ]
  }, {
    "name" : "opened",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 0
    } ]
  }, {
    "name" : "unique_opened",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 0
    } ]
  }, {
    "name" : "clicked",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 1
    } ]
  }, {
    "name" : "unique_clicked",
    "samples" : [ {
      "timestamp" : "2017-04-04T00:00:00.000Z",
      "value" : 1
    } ]
  } ]
}

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'GET',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/sources/'.$source_id.'/stats'
    .';'.http_build_query(array(
        'daterange' => $daterange,
        'interval' => $interval,
      ), '', ';'),
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

GET /{account_id}/templates

List templates by account

Resource URL

Type URL format
GET https://api.flowmailer.net/{account_id}/templates

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

Response Messages

HTTP Status Code Response Model Response Headers Description
200 Template[]

Example request

GET /392/templates HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8


HTTP/1.1 200 OK
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

[ {
  "id" : "6886",
  "description" : "test template 1",
  "mimeType" : "text/plain",
  "templateEngine" : "freemarker-2.3.20",
  "data" : null
}, {
  "id" : "6887",
  "description" : "test template 2",
  "mimeType" : "text/html",
  "templateEngine" : "freemarker-2.3.20",
  "data" : null
} ]

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'GET',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/templates',
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

POST /{account_id}/templates

Create template.

Resource URL

Type URL format
POST https://api.flowmailer.net/{account_id}/templates

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

body body Template yes

Template object

Response Messages

HTTP Status Code Response Model Response Headers Description
201 Location

Extra Response Headers

Name Type HTTP status code Description
Location url 201 Contains the URL of the newly created API resource

Example request

POST /392/templates HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

{
  "data" : "<html><body>html template<br/>\n<#-- REGION: region1 -->\nmet twee regions<br/>\n<#-- END REGION: region1 -->\nnog wat onaanpasbare tekst<br/>\n<#-- REGION: region2 -->\ntekst in de tweede region<br/>\nnog een regel<br/>\n<#-- END REGION: region2 -->\nnog meer onaanpasbare tekst\n<br/></body></html>",
  "description" : "test template 2",
  "mimeType" : "text/html",
  "templateEngine" : "freemarker-2.3.20"
}

HTTP/1.1 201 Created
Location: http://localhost:7979/flowmailer-api/392/templates/6887
Content-Length: 0

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'POST',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
      'Content-Type: application/vnd.flowmailer.v1.5+json',
    ),
    'content' => json_encode($requestbody),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/templates',
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

DELETE /{account_id}/templates/{template_id}

Delete template by id.

Resource URL

Type URL format
DELETE https://api.flowmailer.net/{account_id}/templates/{template_id}

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

template_id path string yes

Template ID

Response Messages

HTTP Status Code Response Model Response Headers Description
200 void

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'DELETE',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/templates/'.$template_id.'',
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

GET /{account_id}/templates/{template_id}

Get template by id.

Resource URL

Type URL format
GET https://api.flowmailer.net/{account_id}/templates/{template_id}

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

template_id path string yes

Template ID

Response Messages

HTTP Status Code Response Model Response Headers Description
200 Template

Example request

GET /392/templates/6887 HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8


HTTP/1.1 200 OK
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

{
  "id" : "6887",
  "description" : "test template 2",
  "mimeType" : "text/html",
  "templateEngine" : "freemarker-2.3.20",
  "data" : "<html><body>html template<br/>\n<#-- REGION: region1 -->\nmet twee regions<br/>\n<#-- END REGION: region1 -->\nnog wat onaanpasbare tekst<br/>\n<#-- REGION: region2 -->\ntekst in de tweede region<br/>\nnog een regel<br/>\n<#-- END REGION: region2 -->\nnog meer onaanpasbare tekst\n<br/></body></html>"
}

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'GET',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/templates/'.$template_id.'',
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

PUT /{account_id}/templates/{template_id}

Save template object.

Resource URL

Type URL format
PUT https://api.flowmailer.net/{account_id}/templates/{template_id}

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

body body Template yes

Template object

template_id path string yes

Template ID

Response Messages

HTTP Status Code Response Model Response Headers Description
200 void

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'PUT',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/templates/'.$template_id.'',
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

GET /{account_id}/undeliveredmessages

List undeliverable messages

Resource URL

Type URL format
GET https://api.flowmailer.net/{account_id}/undeliveredmessages

Parameters

Name Location Type Required Default Description
account_id path string yes

Account ID

addevents query boolean no false

Whether to add message events

addheaders query boolean no false

Whether to add e-mail headers

addonlinelink query boolean no false
daterange matrix date_range no

Date range the message was submitted in

range header items_range yes

Limits the returned list

receivedrange matrix date_range no

Date range the message bounced

Response Messages

HTTP Status Code Response Model Response Headers Description
206 BouncedMessage[] Content-Range

Extra Response Headers

Name Type HTTP status code Description
Content-Range content_range 206 Used to specify which subset of the requested data is returned

Example request

GET /392/undeliveredmessages;daterange=2017-04-04T00:00:00Z,2017-04-05T00:00:00Z;receivedrange=2017-04-04T00:00:00Z,2017-04-05T00:00:00Z?addheaders=true&addonlinelink=true HTTP/1.1
Host: api.flowmailer.net
Authorization: Bearer {access_token}
Accept: application/vnd.flowmailer.v1.5+json;charset=UTF-8
Range: items=0-10


HTTP/1.1 206 Partial Content
Content-Range: items 0-10/0
Content-Type: application/vnd.flowmailer.v1.5+json;charset=UTF-8

[ ]

Example PHP request

<?php
$options = array(
  'http' =>
  array (
    'ignore_errors' => true,
    'method' => 'GET',
    'header' =>
    array (
      'Authorization: Bearer '.$access_token,
      'Accept: application/vnd.flowmailer.v1.5+json',
      'range: '.$range,
    ),
  ),
);

$context  = stream_context_create($options);
$response = file_get_contents(
  'https://api.flowmailer.net/'.$account_id.'/undeliveredmessages'
    .';'.http_build_query(array(
        'daterange' => $daterange,
        'receivedrange' => $receivedrange,
      ), '', ';')
    .'?'.http_build_query(array(
        'addevents' => $addevents,
        'addheaders' => $addheaders,
        'addonlinelink' => $addonlinelink,
      )),
  false,
  $context
);
$response = json_decode($response);
$headers = http_parse_headers(implode("\r\n", $http_response_header));
$statuscode = $headers["Response Code"];
?>

Resource Models

Address
Attachment
BouncedMessage
DataSet
DataSets
DkimKey
Error
Errors
Exception
Filter
Flow
FlowStep
FlowStepAggregate
FlowStepExtractData
FlowStepResubmitMessage
FlowStepRewriteRecipient
FlowStepSchedule
FlowStepSetHeader
Header
MailPlusAPICredentials
Message
MessageArchive
MessageEvent
MessageHold
MessageOnlineArchive
MessageReturn
MessageSummary
NamedSample
OAuthErrorResponse
OAuthTokenResponse
ObjectDescription
ObjectSample
Recipient
ResendMessage
Sample
SenderIdentity
Source
SubmitMessage
Template

Address

Fields

Name Type Description
address string

Email address or phone number

name string

Display name, only used for email messages

Attachment

Fields

Name Type Description
content base64

contentId string

contentType string

filename string

BouncedMessage

Undeliverable message

Fields

Name Type Description
backendDone date

The time flowmailer was done processing this message

backendStart date

The time flowmailer started processing this message

bounceReceived date

Date on which the message was bounced

events MessageEvent[]

Message events

Ordered by received, new events first.

flow ObjectDescription

Flow this message was processed in

from string

The email address in From email header

fromAddress Address

The address in From email header

headersIn Header[]

E-Mail headers of the submitted email message.

Only applicable when messageType = EMAIL and addheaders parameter is true

headersOut Header[]

Headers of the final e-mail.

Only applicable when messageType = EMAIL and addheaders parameter is true

id string

Message id

messageDetailsLink string

Link for the message details page. With resend button.

messageIdHeader string

Content of the Message-Id email header

messageType string

Message type: EMAIL or SMS

onlineLink string

Last online link

recipientAddress string

Recipient address

senderAddress string

Sender address

source ObjectDescription

Source system that submitted this message

status string

Current message status

subject string

Message subject

Only applicable when messageType = EMAIL

submitted date

The time this message was submitted to flowmailer

toAddressList Address[]

The recipients in the To email header

transactionId string

The SMTP transaction id, returned with the SMTP 250 response

DataSet

Data set with statistics

Fields

Name Type Description
name string

Data set name

samples Sample[]

List of samples in this dataset

DataSets

Multiple data sets

Fields

Name Type Description
list DataSet[]

List of data sets

DkimKey

Fields

Name Type Description
cnameTarget string

domain string

publicKey string

selector string

Error

Fields

Name Type Description
arguments Object[]

code string

defaultMessage string

field string

objectName string

rejectedValue Object

Errors

Fields

Name Type Description
allErrors Error[]

List of errors

Exception

Fields

Name Type Description
message string

type string

Filter

Filtered recipient address

Fields

Name Type Description
accountId string

Account ID

address string

Filtered recipient address

date date

Date on which this filter was added

id string

Filter ID

messageReturn MessageReturn

Message event that was the reason for creating this filter

messageType string

This filter is for message type: EMAIL or SMS

reason string

Filter reason

Flow

Message flow

Fields

Name Type Description
description string

Flow description

id string

Flow ID

messageSummary MessageSummary

statistics Sample[]

steps FlowStep[]

Flow steps that each message in this flow will be processed by

templateId string

Id of the flow template

FlowStep

A processing step in a flow

Fields

Name Type Description
aggregate FlowStepAggregate

applyToLinkDomains string

Comma separated list of link domains to modify for analytics parameters.

Only applicable when type = analytics

divisor integer

Only applicable when type = qamail

enabled boolean

enabledExpression string

errorOnNotFound boolean

Indicates whether the contact is required or not.

Only applicable when type = mailPlusContact

extractData FlowStepExtractData

Only applicable and required when type = extractdata

headerName string
headerValue string
id string

Flow step ID

mailPlusApiCredentials MailPlusAPICredentials

Credentials to use for retrieving contacts from MailPlus

Only applicable when type = mailPlusContact

onlineLink boolean

Indicates whether this archive is available for online version link

Only applicable when type = archive

overwriteUrlParameters boolean

Overwrite existing URL Parameters in links.

Only applicable when type = analytics

requestHeaders Header[]

Request headers for external data GET request.

Only applicable when type = externalData

resubmitMessage FlowStepResubmitMessage

resultFormat string

Format of the external data, json or json

Only applicable when type = externalData

resultVariable string

Variable to store the external content in

Only applicable when type = externalContent or externalData

rewriteRecipient FlowStepRewriteRecipient

Only applicable and required when type = rewriteRecipient

schedule FlowStepSchedule

senderIdentity ObjectDescription

Only applicable when type = selectSenderIdentity

setHeader FlowStepSetHeader

Only applicable and required when type = addHeader

subjectTemplate string

Template for the new subject. Template variables can be used in this field.

Only applicable when type = subject

template ObjectDescription

Only applicable when type = template

to string

Email address the QA mail will be sent to

Only applicable and required when type = qamail

type string

Flow step type

urlParametersTemplate string

URL Parameters to add to all links. Template variables can be used in this field.

Only applicable when type = analytics

urlTemplate string

URL to load the external content from. Template variables can be used in this field.

Only applicable when type = externalContent or externalData or addAttachment

FlowStepAggregate

Fields

Name Type Description
alwaysSendFirst boolean

maxTimeSeconds integer

quietTimeSeconds integer

FlowStepExtractData

Fields

Name Type Description
dataType string

filename string

htmlDecodeText boolean

mimeType string

removeMimePart boolean

selector string

FlowStepResubmitMessage

Fields

Name Type Description
duplicateMessage boolean

headerName string

Name of the header to add to the email

headerValue string

Value to set in the header

FlowStepRewriteRecipient

Fields

Name Type Description
messageType string

recipientNameTemplate string

recipientTemplate string

FlowStepSchedule

Fields

Name Type Description
maxMessagesPerHour integer

offsetType string

offsetValue integer

scheduledTimeTemplate string

timeRangeDay0 string

timeRangeDay1 string

timeRangeDay2 string

timeRangeDay3 string

timeRangeDay4 string

timeRangeDay5 string

timeRangeDay6 string

timeZone string

FlowStepSetHeader

Fields

Name Type Description
headerName string

Name of the header to add to the email

headerValue string

Value to set in the header

An email header

Fields

Name Type Description
name string

Name of the email header

value string

Value which must match the value of the email header

MailPlusAPICredentials

MailPlus API credentials

Fields

Name Type Description
consumerKey string

MailPlus consumer key

consumerSecret string

MailPlus consumer secret

Message

Fields

Name Type Description
backendDone date

The time flowmailer was done processing this message

backendStart date

The time flowmailer started processing this message

events MessageEvent[]

Message events

Ordered by received, new events first.

flow ObjectDescription

Flow this message was processed in

from string

The email address in From email header

fromAddress Address

The address in From email header

headersIn Header[]

E-Mail headers of the submitted email message.

Only applicable when messageType = EMAIL and addheaders parameter is true

headersOut Header[]

Headers of the final e-mail.

Only applicable when messageType = EMAIL and addheaders parameter is true

id string

Message id

messageDetailsLink string

Link for the message details page. With resend button.

messageIdHeader string

Content of the Message-Id email header

messageType string

Message type: EMAIL or SMS

onlineLink string

Last online link

recipientAddress string

Recipient address

senderAddress string

Sender address

source ObjectDescription

Source system that submitted this message

status string

Current message status

subject string

Message subject

Only applicable when messageType = EMAIL

submitted date

The time this message was submitted to flowmailer

toAddressList Address[]

The recipients in the To email header

transactionId string

The SMTP transaction id, returned with the SMTP 250 response

MessageArchive

Archived message text and/or html

Fields

Name Type Description
attachments Attachment[]

Attachments, without the content

Only applicable when messageType = EMAIL

data Object
flowStepId string

The archive flow step that created this archived message

html string

Archived message html

messageDetailsLink string

Link for the message details page. With resend button.

Only applicable when messageType = EMAIL

messageType string

EMAIL or SMS

onlineLink string

Online link

Only applicable when messageType = EMAIL

onlineVersion boolean

Indicates whether this archive is available for online version link

subject string

Archived message subject

text string

Archived message text

MessageEvent

Message event

Fields

Name Type Description
data base64

Event data

deviceCategory string

extraData

Event data

id string

Message event ID

linkName string

linkTarget string

messageId string

Message ID

mta string

MTA that reported this event

operatingSystem string

operatingSystemVersion string

received date

Event date

referer string

remoteAddr string

snippet string

Bounce snippet or SMTP conversation snippet

subType

Bounce sub type

tag

Custom event type

type string

Event type, must be CUSTOM

userAgent string

userAgentDisplayName string

userAgentString string

userAgentType string

userAgentVersion string

MessageHold

Messages that could not be processed

Fields

Name Type Description
backendDone date

The time flowmailer was done processing this message

data base64

MIME message data or text for SMS messages

dataCoding byte

Only for SMS messages

errorText string

Message error text

messageId string

Message ID

messageType string

Message type: EMAIL or SMS

reason string

Message processing failure reason

recipient string

Message recipient address

sender string

Message sender address

source ObjectDescription

Source system that submitted this message

status string

Message status

submitted date

Message submit date

transactionId string

Transaction ID

MessageOnlineArchive

Archived message text and/or html

Fields

Name Type Description
accountId string

The account id

attachments Attachment[]

Attachments, without the content

Only applicable when messageType = EMAIL

data Object
flowStepId string

The archive flow step that created this archived message

html string

Archived message html

messageDetailsLink string

Link for the message details page. With resend button.

Only applicable when messageType = EMAIL

messageId string

The message id

messageType string

EMAIL or SMS

onlineLink string

Online link

Only applicable when messageType = EMAIL

onlineVersion boolean

Indicates whether this archive is available for online version link

subject string

Archived message subject

text string

Archived message text

MessageReturn

Message event

Fields

Name Type Description
data base64

Event data

deviceCategory string

extraData

Event data

id string

Message event ID

linkName string

linkTarget string

messageId string

Message ID

mta string

MTA that reported this event

operatingSystem string

operatingSystemVersion string

received date

Event date

referer string

remoteAddr string

snippet string

Bounce snippet or SMTP conversation snippet

subType

Bounce sub type

tag

Custom event type

type string

Event type, must be CUSTOM

userAgent string

userAgentDisplayName string

userAgentString string

userAgentType string

userAgentVersion string

MessageSummary

Message statistics summary

Fields

Name Type Description
averageDeliverTimeMillis integer

Average delivery time in milliseconds

clicked integer

Number of times a link has been clicked

delivered integer

Number of messages delivered

opened integer

Number of times a message has been opened

processed integer

Number of messages processed

sent integer

Number of messages sent

uniqueClicked integer

Number of messages in which a link has been clicked

uniqueOpened integer

Number of messages that have been opened

NamedSample

Fields

Name Type Description
name string

other boolean
value integer

OAuthErrorResponse

Described in http://tools.ietf.org/html/rfc6749

Fields

Name Type Description
error string
error_description string
error_uri string

OAuthTokenResponse

Response object which contains the requested access token

Fields

Name Type Description
access_token string The requested access token
expires_in integer The number of seconds this token is valid
scope string Only api is supported.
token_type string Type of the returned token, only bearer is supported.

ObjectDescription

Generic resource model with an ID and description.

Fields

Name Type Description
description string

Resource description

id string

Resource ID

ObjectSample

Fields

Name Type Description
name ObjectDescription
other boolean
value integer

Recipient

Statistics for a single recipient

Fields

Name Type Description
address string

Recipient email address or phone number

filters Filter[]

One or more filters for this recipient

messageSummary MessageSummary

Message statistics for this recipient

ResendMessage

Fields

Name Type Description
recipientAddress string

Override recipient email address or phone number.

Sample

Fields

Name Type Description
timestamp date

value integer

SenderIdentity

Fields

Name Type Description
accountFallback boolean

description string

dkimKeys DkimKey[]

id string

returnPathDomain string

selectionType string

selectionValue string

senderEmail string

senderName string

webDomain string

Source

Information about a source system

A source system can submit messages to flowmailer.

Fields

Name Type Description
description string

Source description

dsnAddress string

Email DSN messages will be sent to this address

feedbackLoopAddress string

Email feedback loop messages will be sent to this address

id string

Source ID

lastActive date

Date this source was last active

maxMessageSize integer

Maximum message size in bytes

messageSummary MessageSummary

Message statistics summary for this source

statistics Sample[]

Message statistics for this source

type

Source type, SMTP, SMTP_RCPT or SMPP

SubmitMessage

An email or sms message that can be submitted to Flowmailer.

Fields

Name Type Description
attachments Attachment[]

Attachments

Only applicable when messageType = EMAIL

data Object

Extra data that will be available in templates

deliveryNotificationType string

NONE, FAILURE or DELIVERY_AND_FAILURE

Defaults to NONE for SMS

Only applicable when messageType = SMS

headerFromAddress string

From header address

Cannot be used in combination with mimedata

Only applicable when messageType = EMAIL

headerFromName string

From header name

Cannot be used in combination with mimedata

Only applicable when messageType = EMAIL

headerToAddress string

To header address

Cannot be used in combination with mimedata

Only applicable when messageType = EMAIL

headerToName string

To header name

Cannot be used in combination with mimedata

Only applicable when messageType = EMAIL

headers Header[]

Email headers

Cannot be used in combination with mimedata

html string

Email HTML content

Cannot be used in combination with mimedata

Only applicable when messageType = EMAIL

messageType string

EMAIL or SMS

mimedata base64

Complete email MIME message with headers.

Only applicable when messageType = EMAIL

recipientAddress string

Recipient email address or phone number.

For email messages this cannot contain a display name.

scheduleAt date

senderAddress string

Sender email address or phone number.

For email messages this cannot contain a display name.

subject string

Email subject

Cannot be used in combination with mimedata

tags string[]

Tags

text string

Text content

Cannot be used in combination with mimedata

Template

A flowmailer content template

Fields

Name Type Description
data string

Template content

description string

Template description

id string

Template ID

mimeType string

Supported mime types:

  • text/plain
  • text/html
  • application/vnd.flowmailer.itext+pdf

templateEngine string

The only supported template engine is freemarker-2.3.20