### Get Account Information (HTTP)
Source: https://app.smartemailing.cz/docs/api/v3/index
Example of retrieving basic account information using an HTTP GET request. The successful response includes account details like ID, username, and contact information.
```http
GET /account-info
HTTP/1.1 200 OK
{
"status": "ok",
"meta": [],
"data": {
"account_id": 2,
"guid": "d5f930b3-07ff-11e7-9gh9-0242acr3j004",
"username": "martin@smartemailing.cz",
"firstname": "Martin",
"surname": "Strouhal",
"company": "Smartemailing s.r.o.",
"phone": "+420111222333"
}
}
```
--------------------------------
### Get Emails API Example
Source: https://app.smartemailing.cz/docs/api/v3/index
This snippet demonstrates how to retrieve a list of emails using the API. It shows a successful GET request with query parameters for limiting and offsetting results. The response includes email data, status, and metadata.
```HTTP
GET /contactlists?limit=2
HTTP/1.1 200 OK
{
"status": "ok",
"meta": {
"total_count": 26,
"displayed_count": 2,
"offset": 0,
"limit": 2
},
"data": [
{
"attachments": [
"l1_dXNlcjItMTYweDE2MC5qcGc1464349087.png"
],
"id": 3,
"footer_id": null,
"title": "subject",
"created": "2015-07-27 15:42:07",
"structure": null,
"textbody": "Hello Johnny!",
"htmlbody": "<html>\n<head>\n\t<title>subject</title>\n</head>\n<body>\n<p>Hello Johnny!</p>\n</body>\n</html>\n",
"name": "name",
"template": false
},
{
"attachments": [],
"id": 4,
"footer_id": null,
"title": "smartkampan",
"created": "2015-08-01 23:12:43",
"structure": null,
"textbody": "Hi! Nancy!",
"htmlbody": "<html>\n<head>\n\t<title>smartkampan</title>\n</head>\n<body>Hi <b>Nancy</b></body>\n</html>\n",
"name": "smartkampan",
"template": false
}
]
}
```
--------------------------------
### Get Automations List (HTTP)
Source: https://app.smartemailing.cz/docs/api/v3/index
Shows how to retrieve a collection of automations using an HTTP GET request. Optional query parameters allow for selecting, sorting, filtering, and paginating the results.
```http
GET /automations
# Example with query parameters:
# ?select=id,name&sort=activated_at,-name&id=a3ac238ccfa94b3e979aea2cb78c48c2&name=Welcome&limit=500&offset=0
```
--------------------------------
### POST /import - Unauthorized Response Example
Source: https://app.smartemailing.cz/docs/api/v3/index
This example shows the response when a request to POST /import fails due to invalid or missing credentials.
```APIDOC
## POST /import - Unauthorized
### Description
This example shows the response when a request to POST /import fails due to invalid or missing credentials. This applies to any kind of request with bad credentials.
### Method
POST
### Endpoint
/import
### Parameters
#### Path Parameters
(None)
#### Query Parameters
(None)
#### Request Body
(Request body for POST /import is not detailed in this specific example, but would typically contain contact data for import.)
### Request Example
```json
{
"example": "POST /import"
}
```
### Response
#### Error Response (401)
- **status** (string) - Error status code, typically "error".
- **meta** (array) - Metadata about the error (empty in this example).
- **message** (string) - A message indicating authentication failure.
#### Response Example
```json
{
"status": "error",
"meta": [],
"message": "Authentication Failed"
}
```
```
--------------------------------
### Get Custom Field Values (HTTP GET)
Source: https://app.smartemailing.cz/docs/api/v3/index
This example outlines how to retrieve custom field values. It shows the available query parameters for selecting, sorting, filtering, limiting, and offsetting results. No specific code example is provided, but the parameters define the request structure.
```http
GET /customfields
Query Parameters:
select optional | string | Comma separated list of properties to select. eg. `?select=contact_id,value` If not provided, all fields are selected. Allowed values: "id", "contact_id", "customfield_id", "value", "customfield_options_id"
sort optional | string | Comma separated list of sorting keys from left side. Prepend `-` to any key for desc direction, eg. `?sort=customfield_id,-value,id` Allowed values: "id", "contact_id", "customfield_id", "value", "customfield_options_id"
FILTER_PARAM_GOES_HERE optional | string | As a parameter name, you can use any combination of these properties to filter the results. To select everyone with cutomfield #3 of value "Hello", use this query params: `?customfield_id=3&value=Hello` Allowed values: "id", "contact_id", "customfield_id", "value", "customfield_options_id"
limit optional | number | Number of records per page. Maximum allowed value is `500` Default value: `500`
offset optional | number | Skip given number of records to allow pagination. Default value: `0`
```
--------------------------------
### API v3 GET Login Test (HTTP)
Source: https://app.smartemailing.cz/docs/api/v3/index
Tests the API's ability to authenticate using GET requests with provided credentials. Returns a success message and account ID upon successful authentication.
```http
GET /check-credentials
HTTP/1.1 200 OK
{
"status": "ok",
"meta": [
],
"message": "Hi there! Your credentials are valid!",
"account_id": 2
}
```
```http
// Any kind of request with bad credentials
HTTP/1.1 401 Unauthorized
{
"status": "error",
"meta": [],
"message": "Authentication Failed"
}
```
--------------------------------
### Get Confirmation Emails - GET /emails
Source: https://app.smartemailing.cz/docs/api/v3/index
This snippet shows how to retrieve a list of confirmation emails using the GET /emails endpoint. It supports query parameters for selecting specific fields, sorting the results, and paginating through records with limit and offset. If no select parameter is provided, all fields are returned.
```HTTP
GET /emails?select=name,id
GET /emails?sort=name,title
GET /emails?limit=500&offset=0
```
--------------------------------
### Get Contacts - Query Parameters Example
Source: https://app.smartemailing.cz/docs/api/v3/index
This snippet details the query parameters available for the 'Get Contacts' endpoint. It allows for selecting specific fields, sorting, filtering by various contact properties, expanding custom fields, and pagination using limit and offset.
```query
GET /contacts?select=id,emailaddress&sort=emailaddress,-name,id&name=Johnny&country=Japan&expand=customfields&limit=500&offset=0
```
--------------------------------
### Get Confirmation Emails Response
Source: https://app.smartemailing.cz/docs/api/v3/index
Example of a successful HTTP 200 OK response when retrieving confirmation emails. It details the structure of the returned email objects, including fields like id, name, subject, body, creation date, and tracking information. The response includes metadata about the request.
```json
{
"status": "ok",
"meta": {
"displayed_count": 1,
"total_count": 20,
"limit": 1,
"offset": 0
},
"data": [
{
"id": 4,
"name": "Confirmation email campaign",
"title": "Confirmation email campaign",
"htmlbody": "<html>\n<head>\n\t<title>smartkampan</title>\n</head>\n<body>{{confirmlink}}</b></body>\n</html>\n",
"textbody": "Hi Nancy!",
"structure": null,
"created": "2018-06-11 23:12:43",
"template": true,
"footer_id": null,
"attachments": [],
"track": "{\"utm_source\":\"newsletter\",\"utm_medium\":\"email\",\"utm_campaign\":\"campaign\",\"utm_content\":\"campaign\"}"
}
]
}
```
--------------------------------
### Select Specific Fields for Contactlist (HTTP)
Source: https://app.smartemailing.cz/docs/api/v3/index
This example shows how to retrieve a single contact list while specifying which fields to include in the response using the `select` query parameter. This is useful for optimizing performance by reducing the amount of data transferred. The example is presented in HTTP.
```http
GET /contactlists?select=name,sendername
```
--------------------------------
### POST /import - Import Contacts (Validation Error Example)
Source: https://app.smartemailing.cz/docs/api/v3/index
This example demonstrates the response format for a validation error when attempting to import contacts via the POST /import endpoint.
```APIDOC
## POST /import - Validation Error
### Description
This example demonstrates the response format for a validation error when attempting to import contacts via the POST /import endpoint. Any validation error will terminate the import request with a 422 status code, and no data will be imported.
### Method
POST
### Endpoint
/import
### Parameters
#### Path Parameters
(None)
#### Query Parameters
(None)
#### Request Body
(Request body for POST /import is not detailed in this specific example, but would typically contain contact data for import.)
### Request Example
```json
{
"example": "POST /import"
}
```
### Response
#### Error Response (422)
- **status** (string) - Error status code, typically "error".
- **meta** (array) - Metadata about the error (empty in this example).
- **message** (string) - A detailed message explaining the validation error.
#### Response Example
```json
{
"status": "error",
"meta": [],
"message": "Emailaddress invalid@email@gmail.com is not valid email address."
}
```
```
--------------------------------
### Send Transactional Emails in Bulk (JSON Example)
Source: https://app.smartemailing.cz/docs/api/v3/index
This example demonstrates how to send multiple transactional emails in a single API request. It includes sender credentials, a tag for grouping, an email ID, and a list of tasks, each specifying recipient details, content replacements, template variables, and attachments. Note that 'data_base64' for attachments should be replaced with actual base64 encoded content.
```json
{
"sender_credentials": {
"from": "martin@smartemailing.cz",
"reply_to": "martin@smartemailing.cz",
"sender_name": "Martin"
},
"tag": "transactional_1",
"email_id": 14,
"tasks": [
{
"recipient": {
"emailaddress": "martin@smartemailing.cz"
},
"replace": [
{
"key": "header_block",
"content": "
{% if df_gender == 'M' %}Hi man!{% elseif df_gender == 'F' %}Hello lady!{% else %}Howdy!{% endif %}
"
},
{
"key": "footer_block",
"content": "Bye!"
}
],
"template_variables": {
"order_id": "0037565",
"products": [
{
"name": "Red car",
"description": "lightning fast!",
"image_url": "https://upload.wikimedia.org/wikipedia/en/8/82/Lightning_McQueen.png"
},
{
"name": "Zed's chopper",
"description": "It's not a motorcycle, baby. It's a chopper.",
"image_url": "http://www.imcdb.org/i013795.jpg"
}
]
},
"attachments": [
{
"file_name": "Invoice.pdf",
"content_type": "application/pdf",
"data_base64": "..."
},
{
"file_name": "TermsAndConditions.pdf",
"content_type": "application/pdf",
"data_base64": "..."
}
]
},
{
"recipient": {
"emailaddress": "honza@smartemailing.cz"
},
"replace": [
{
"key": "header_block",
"content": "What happened to my Honda?
"
},
{
"key": "footer_block",
"content": "Bye!"
}
],
"attachments": []
}
]
}
```
--------------------------------
### Add Placed Order Request Example (JSON)
Source: https://app.smartemailing.cz/docs/api/v3/index
This code snippet demonstrates the structure of a POST request to the /orders endpoint for adding a placed order. It includes details about the e-shop, contact, and order items, supporting both direct item data and references to item feeds. Ensure all required fields like 'eshop_name', 'eshop_code', 'emailaddress', and 'created_at' are provided.
```json
{
"eshop_name": "my-eshop",
"eshop_code": "ORDER0001",
"emailaddress": "michal@smartemailing.cz",
"created_at": "2019-01-01 00:00:00",
"attributes": [
{
"name": "discount",
"value": "Black friday"
}
],
"items": [
{
"id": "ABC123",
"name": "My product",
"description": "My product description",
"price": {
"without_vat": 123.97,
"with_vat": 150.00,
"currency": "CZK"
},
"quantity": 1,
"url": "https://www.example.com/my-product",
"image_url": "https://www.example.com/images/my-product.jpg",
"attributes": [
{
"name": "manufacturer",
"value": "Factory ltd."
},
{
"name": "my other custom attribute",
"value": "some value"
}
]
},
{
"id": "XYZ789",
"name": "My another product",
"description": "My another product description",
"price": {
"without_vat": 165.70,
"with_vat": 200.50,
"currency": "CZK"
},
"quantity": 2,
"url": "https://www.example.com/my-another-product",
"image_url": "https://www.example.com/images/my-another-product.jpg"
}
],
"item_feeds": [
{
"item_id": "ZYX987",
"feed_name": "my-feed",
"quantity": 3
}
]
}
```
--------------------------------
### GET Single Customfield Option - Success Response
Source: https://app.smartemailing.cz/docs/api/v3/index
Provides an example of a successful 200 OK response when retrieving a single customfield option by its ID. The response contains the details of the requested option.
```HTTP
GET /customfield-options/1
HTTP/1.1 200 OK
{
"status": "ok",
"meta": [],
"data": {
"id": 1,
"customfield_id": 1,
"name": "1",
"order": 0
}
}
```
--------------------------------
### Import Orders API Request Example
Source: https://app.smartemailing.cz/docs/api/v3/index
This snippet demonstrates how to format a POST request to the /import-orders endpoint. It includes settings for handling invalid orders and a detailed structure for multiple orders, each with attributes, items, and promo codes. The API allows up to 500 orders per request.
```json
{
"settings": {
"skip_invalid_orders": false
},
"data": [
{
"eshop_name": "my-eshop",
"eshop_code": "ORDER0001",
"emailaddress": "michal@smartemailing.cz",
"created_at": "2019-01-01 00:00:00",
"attributes": [
{
"name": "discount",
"value": "Black friday"
}
],
"items": [
{
"id": "ABC123",
"name": "My product",
"description": "My product description",
"price": {
"without_vat": 123.97,
"with_vat": 150.00,
"currency": "CZK"
},
"quantity": 1,
"url": "https://www.example.com/my-product",
"image_url": "https://www.example.com/images/my-product.jpg",
"attributes": [
{
"name": "manufacturer",
"value": "Factory ltd."
},
{
"name": "my other custom attribute",
"value": "some value"
}
]
},
{
"id": "XYZ789",
"name": "My another product",
"description": "My another product description",
"price": {
"without_vat": 165.70,
"with_vat": 200.50,
"currency": "CZK"
},
"quantity": 2,
"url": "https://www.example.com/my-another-product",
"image_url": "https://www.example.com/images/my-another-product.jpg"
}
],
"promo_codes_used": [
{
"pool_name": "My pool",
"value": "PROMO001"
}
]
},
{
"eshop_name": "my-eshop",
"eshop_code": "ORDER0002",
"emailaddress": "michal+2@smartemailing.cz",
"created_at": "2019-01-01 00:50:00",
"attributes": [],
"items": [
{
"id": "ABC123",
"name": "My product",
"description": "My product description",
"price": {
"without_vat": 123.97,
"with_vat": 150.00,
"currency": "CZK"
},
"quantity": 2,
"url": "https://www.example.com/my-product",
"image_url": "https://www.example.com/images/my-product.jpg",
"attributes": [
{
"name": "manufacturer",
"value": "Factory ltd."
},
{
"name": "my other custom attribute",
"value": "some value"
}
]
}
]
}
]
}
```
--------------------------------
### GET Customfield Option - 404 Not Found Example
Source: https://app.smartemailing.cz/docs/api/v3/index
Illustrates the 404 Not Found error response when attempting to retrieve a specific customfield option that does not exist. The response includes a status of 'error' and a 'Not Found' message.
```HTTP
GET /customfield-options/100
HTTP/1.1 404 Not Found
{
"status": "error",
"meta": [],
"message": "Not Found"
}
```
--------------------------------
### HTTP 201 Created Success Response Example
Source: https://app.smartemailing.cz/docs/api/v3/index
This code snippet demonstrates a successful API response with an HTTP 201 Created status code. It includes the expected JSON structure for a successful creation operation, detailing fields like 'status', 'meta', and 'data' which contains resource-specific information such as order IDs, creation timestamps, contact details, and itemized product information with pricing and attributes.
```http
HTTP/1.1 201 Created
{
"status": "ok",
"meta": [],
}
{
"status": "ok",
"meta": [],
"data": {
"id": "11e91b137503deb2a4e66c4008be149e",
"created_at": "2019-01-01 00:00:00",
"contact_id": 35839,
"status": "placed",
"eshop_name": "my-eshop",
"eshop_code": "ORDER0001",
"items": [
{
"id": "ABC123",
"name": "My product",
"description": "My product description",
"price": {
"without_vat": 123.97,
"with_vat": 150,
"currency": "CZK"
},
"quantity": 1,
"url": "https://www.example.com/my-product",
"image_url": "https://www.example.com/images/my-product.jpg",
"attributes": [
{
"name": "manufacturer",
"value": "Factory ltd."
},
{
"name": "my other custom attribute",
"value": "some value"
}
]
},
{
"id": "XYZ789",
"name": "My another product",
"description": "My another product description",
"price": {
"without_vat": 165.7,
"with_vat": 200.5,
"currency": "CZK"
},
"quantity": 2,
"url": "https://www.example.com/my-another-product",
"image_url": "https://www.example.com/images/my-another-product.jpg"
},
{
"id": "ZYX987",
"name": "Product loaded from feed",
"description": "Description",
"price": {
"without_vat": 100.0,
"with_vat": 121.0,
"currency": "CZK"
},
"quantity": 3,
"url": "https://www.example.com/my-feed-product",
"image_url": "https://www.example.com/images/my-feed-product.jpg"
}
]
}
}
```
--------------------------------
### Order Creation API
Source: https://app.smartemailing.cz/docs/api/v3/index
This section details the parameters required to create a new order. It includes essential order information, contact details, and item specifics.
```APIDOC
## POST /orders
### Description
This endpoint allows for the creation of a new order within the e-shop.
### Method
POST
### Endpoint
/orders
### Parameters
#### Request Body
- **eshop_name** (string) - Required - E-shop name
- **eshop_code** (string) - Required - Unique order code
- **emailaddress** (string) - Required - Contact's email address
- **status** (string) - Optional - Status of order (defaults to `placed` when not specified). Available values are `placed`,`processing`,`shipped`,`canceled`,`unknown`.
- **paid_at** (string) - Optional - Order payment date in `YYYY-MM-DD HH:MM:SS` format
- **created_at** (string) - Required - `YYYY-MM-DD HH:MM:SS` format
- **attributes** (object[]) - Optional - Custom order attributes
- **attributes.name** (string) - Required - Attribute name
- **attributes.value** (string) - Required - Attribute value
- **items** (object[]) - Optional - Array of items in order
- **items.id** (string) - Required - item ID
- **items.name** (string) - Required - item name
- **items.description** (string) - Optional - item description
- **items.price** (object) - Required - price per item
- **items.price.without_vat** (number) - Required - item price without VAT
- **items.price.with_vat** (number) - Required - item price with VAT
- **items.price.currency** (string) - Required - item price currency code (ISO-4217 three-letter ("Alpha-3")) i.e.: `CZK`, `EUR`
- **items.quantity** (number) - Required - item quantity
- **items.unit** (string) - Optional - quantity unit (defaults to pieces if omitted)
- **items.url** (string) - Optional - item URL
- **items.image_url** (string) - Optional - item image URL
- **items.attributes** (object[]) - Optional - Custom item attributes
- **item_feeds** (object[]) - Optional - Array of items in shopping cart with feed reference
- **item_feeds.item_id** (string) - Required - item ID.
- **item_feeds.feed_name** (string) - Required - name of feed
- **item_feeds.quantity** (string) - Required - item quantity
### Request Example
```json
{
"eshop_name": "MyEshop",
"eshop_code": "ORD12345",
"emailaddress": "customer@example.com",
"status": "placed",
"created_at": "2023-10-27 10:00:00",
"items": [
{
"id": "ITEM001",
"name": "Example Product",
"price": {
"without_vat": 100.00,
"with_vat": 121.00,
"currency": "EUR"
},
"quantity": 2
}
]
}
```
### Response
#### Success Response (200)
- **order_id** (string) - The unique identifier for the created order.
- **message** (string) - A confirmation message indicating successful order creation.
#### Response Example
```json
{
"order_id": "ORDABCDEF123",
"message": "Order created successfully."
}
```
```
--------------------------------
### HTTP 200 Success Response Example
Source: https://app.smartemailing.cz/docs/api/v3/index
This code snippet illustrates a successful HTTP 200 response from the API. It includes 'status' set to 'ok', an empty 'meta' array, and a 'data' array containing order details. The 'data' array includes information about created orders, their items, prices, and attributes.
```json
HTTP/1.1 200 Created
{
"status": "ok",
"meta": [],
"data": [
{
"id": "11e91b137503deb2a4e66c4008be149e",
"created_at": "2019-01-01 00:00:00",
"contact_id": 35839,
"status": "placed",
"eshop_name": "my-eshop",
"eshop_code": "ORDER0001",
"items": [
{
"id": "ABC123",
"name": "My product",
"description": "My product description",
"price": {
"without_vat": 123.97,
"with_vat": 150,
"currency": "CZK"
},
"quantity": 1,
"url": "https://www.example.com/my-product",
"image_url": "https://www.example.com/images/my-product.jpg",
"attributes": [
{
"name": "manufacturer",
"value": "Factory ltd."
},
{
"name": "my other custom attribute",
"value": "some value"
}
]
},
{
"id": "XYZ789",
"name": "My another product",
"description": "My another product description",
"price": {
"without_vat": 165.7,
"with_vat": 200.5,
"currency": "CZK"
},
"quantity": 2,
"url": "https://www.example.com/my-another-product",
"image_url": "https://www.example.com/images/my-another-product.jpg"
}
]
},
{
"eshop_name": "my-eshop",
"eshop_code": "ORDER0002"
"emailaddress": "michal+2@smartemailing.cz",
"created_at": "2019-01-01 00:50:00",
"attributes": [],
"items": [
{
"id": "ABC123",
"name": "My product",
"description": "My product description",
"price": {
"without_vat": 123.97,
"with_vat": 150.00,
"currency": "CZK"
},
"quantity": 2,
"url": "https://www.example.com/my-product",
"image_url": "https://www.example.com/images/my-product.jpg",
"attributes": [
{
"name": "manufacturer",
"value": "Factory ltd."
},
{
"name": "my other custom attribute",
"value": "some value"
}
]
}
]
}
]
}
```
--------------------------------
### HTTP 201 Created Success Response Example
Source: https://app.smartemailing.cz/docs/api/v3/index
This snippet demonstrates a successful creation response (HTTP 201 Created) from the Smartemailing API v3. It includes the status, metadata, and a data array containing created resources, such as orders with their associated items and attributes. The structure can vary based on the specific endpoint and data being created.
```json
HTTP/1.1 201 Created
{
"status": "ok",
"meta": [],
"meta": [],
"data": [
{
"id": "11e91b137503deb2a4e66c4008be149e",
"created_at": "2019-01-01 00:00:00",
"contact_id": 35839,
"status": "placed",
"eshop_name": "my-eshop",
"eshop_code": "ORDER0001",
"items": [
{
"id": "ABC123",
"name": "My product",
"description": "My product description",
"price": {
"without_vat": 123.97,
"with_vat": 150,
"currency": "CZK"
},
"quantity": 1,
"url": "https://www.example.com/my-product",
"image_url": "https://www.example.com/images/my-product.jpg",
"attributes": [
{
"name": "manufacturer",
"value": "Factory ltd."
},
{
"name": "my other custom attribute",
"value": "some value"
}
]
},
{
"id": "XYZ789",
"name": "My another product",
"description": "My another product description",
"price": {
"without_vat": 165.7,
"with_vat": 200.5,
"currency": "CZK"
},
"quantity": 2,
"url": "https://www.example.com/my-another-product",
"image_url": "https://www.example.com/images/my-another-product.jpg"
},
{
"id": "ZYX987",
"name": "Product loaded from feed",
"description": "Description",
"price": {
"without_vat": 100.0,
"with_vat": 121.0,
"currency": "CZK"
},
"quantity": 3,
"url": "https://www.example.com/my-feed-product",
"image_url": "https://www.example.com/images/my-feed-product.jpg"
}
]
},
{
"eshop_name": "my-eshop",
"eshop_code": "ORDER0002"
"emailaddress": "michal+2@smartemailing.cz",
"created_at": "2019-01-01 00:50:00",
"attributes": [],
"items": [
{
"id": "ABC123",
"name": "My product",
"description": "My product description",
"price": {
"without_vat": 123.97,
"with_vat": 150.00,
"currency": "CZK"
},
"quantity": 2,
"url": "https://www.example.com/my-product",
"image_url": "https://www.example.com/images/my-product.jpg",
"attributes": [
{
"name": "manufacturer",
"value": "Factory ltd."
},
{
"name": "my other custom attribute",
"value": "some value"
}
]
}
]
}
]
}
```
--------------------------------
### Data Import API
Source: https://app.smartemailing.cz/docs/api/v3/index
This section details the parameters for importing data into the Smartemailing platform. It covers settings for order processing, customer data, and item details.
```APIDOC
## POST /websites/app_smartemailing_cz_api_v3
### Description
Endpoint for importing data batches, including order details, customer information, and item specifics.
### Method
POST
### Endpoint
/websites/app_smartemailing_cz_api_v3
### Parameters
#### Request Body
- **settings** (object) - Optional - Import settings.
- **skip_invalid_orders** (boolean) - Optional - Settings for skipping invalid orders. If `false`, no orders will be imported if any are invalid. If `true`, invalid orders will be skipped, and valid orders will be imported. Default value: `false`.
- **data** (object[]) - Required - Imported data batch.
- **eshop_name** (string) - Required - E-shop name.
- **eshop_code** (string) - Required - Unique order code.
- **emailaddress** (string) - Required - Contact's email address.
- **status** (string) - Optional - Status of order. Available values are `placed`, `processing`, `shipped`, `canceled`, `unknown`. Defaults to `placed` when not specified.
- **paid_at** (string) - Optional - Order payment date in `YYYY-MM-DD HH:MM:SS` format.
- **created_at** (string) - Required - Order creation date in `YYYY-MM-DD HH:MM:SS` format.
- **attributes** (object[]) - Optional - Custom order attributes.
- **name** (string) - Required - Attribute name.
- **value** (string) - Required - Attribute value.
- **items** (object[]) - Optional - Array of items in order.
- **id** (string) - Required - Item ID.
- **name** (string) - Required - Item name.
- **description** (string) - Optional - Item description.
- **price** (object) - Required - Price per item.
- **without_vat** (number) - Required - Item price without VAT.
- **with_vat** (number) - Required - Item price with VAT.
- **currency** (string) - Required - Item price currency code (ISO-4217 three-letter ("Alpha-3")) i.e.: `CZK`, `EUR`.
- **quantity** (number) - Required - Item quantity.
- **unit** (string) - Optional - Quantity unit (defaults to pieces if omitted).
- **url** (string) - Optional - Item URL.
- **image_url** (string) - Optional - Item image URL.
- **attributes** (object[]) - Optional - Custom item attributes.
- **promo_codes_used** (object[]) - Optional - Promo codes that should be marked as used.
- **pool_name** (string) - Required - Pool name.
- **value** (string) - Required - Promo code.
- **used_at** (string) - Optional - Usage date in `YYYY-MM-DD HH:MM:SS` format.
### Request Example
```json
{
"settings": {
"skip_invalid_orders": false
},
"data": [
{
"eshop_name": "ExampleShop",
"eshop_code": "ORDER123",
"emailaddress": "customer@example.com",
"created_at": "2023-10-27 10:00:00",
"items": [
{
"id": "ITEM001",
"name": "Product A",
"price": {
"without_vat": 100.00,
"with_vat": 121.00,
"currency": "CZK"
},
"quantity": 2
}
]
}
]
}
```
### Response
#### Success Response (200)
- **status** (string) - Indicates the success or failure of the import operation.
- **message** (string) - A message providing details about the import result.
#### Response Example
```json
{
"status": "success",
"message": "Data imported successfully."
}
```
```
--------------------------------
### PATCH Customfield Option - Example Usage
Source: https://app.smartemailing.cz/docs/api/v3/index
Demonstrates an example of how to update a customfield option using a PATCH request. The request body includes the fields to be updated, such as name and order.
```HTTP
POST /customfield-options/10
{
"customfield_id": 1,
"order": 6,
"name": "Washington"
}
```
--------------------------------
### POST /import with Double Opt-In
Source: https://app.smartemailing.cz/docs/api/v3/index
Imports contacts and configures a double opt-in process, including campaign details, sender credentials, thank you page URL, send-to mode, and silence period.
```APIDOC
## POST /import (Double Opt-In)
### Description
Imports contacts and configures a double opt-in process, including campaign details, sender credentials, thank you page URL, send-to mode, and silence period.
### Method
POST
### Endpoint
/import
### Parameters
#### Request Body
- **settings** (object) - Required - Configuration for the import process.
- **update** (boolean) - Optional - If true, existing contacts will be updated.
- **preserve_unsubscribed** (boolean) - Optional - If true, unsubscribed status will be preserved.
- **skip_invalid_emails** (boolean) - Optional - If true, invalid email addresses will be skipped.
- **double_opt_in_settings** (object) - Optional - Settings for the double opt-in process.
- **campaign** (object) - Required if `double_opt_in_settings` is present - Campaign details for the opt-in email.
- **email_id** (integer) - Required - The ID of the email to send for confirmation.
- **sender_credentials** (object) - Required - Credentials for the sender.
- **from** (string) - Required - The sender's email address.
- **reply_to** (string) - Required - The reply-to email address.
- **sender_name** (string) - Required - The sender's name.
- **confirmation_thank_you_page_url** (string) - Optional - The URL of the thank you page after confirmation.
- **send_to_mode** (string) - Optional - Specifies who to send the opt-in email to (e.g., "all").
- **silence_period** (object) - Optional - The period during which no further communication should be sent.
- **unit** (string) - Required - The unit of time for the silence period (e.g., "days").
- **value** (integer) - Required - The value for the silence period.
- **data** (array) - Required - An array of contact objects to import.
- **emailaddress** (string) - Required - The email address of the contact.
- **contactlists** (array) - Optional - A list of contact lists to associate with the contact.
- **id** (integer) - Required - The ID of the contact list.
- **status** (string) - Required - The status of the contact in the list (e.g., "confirmed").
### Request Example
```json
{
"settings": {
"update": true,
"preserve_unsubscribed": true,
"skip_invalid_emails": false,
"double_opt_in_settings": {
"campaign": {
"email_id": 169,
"sender_credentials": {
"from": "martin@smartemailing.cz",
"reply_to": "martin@smartemailing.cz",
"sender_name": "Martin"
},
"confirmation_thank_you_page_url": "https://www.smartemailing.cz"
},
"send_to_mode": "all",
"silence_period": {
"unit": "days",
"value": 10
}
}
},
"data": [
{
"emailaddress": "i-like-to-click@smartemailing.cz",
"contactlists": [
{
"id": 1,
"status": "confirmed"
}
]
}
]
}
```
```
--------------------------------
### Generic Event Deletion - 404 Not Found Response Example
Source: https://app.smartemailing.cz/docs/api/v3/index
This example illustrates a 404 Not Found error response when attempting to delete a generic event that does not exist. The response includes a status of 'error' and a 'Not Found' message.
```http
DELETE /generic/event/called-support/non-existent-id
HTTP/1.1 404 Not Found
{
"status": "error",
"meta": [],
"message": "Not Found"
}
```
--------------------------------
### Get Automations List (API)
Source: https://app.smartemailing.cz/docs/api/v3/index
Retrieves a list of automations with pagination. Supports filtering by limit. Returns status, metadata, and automation data.
```HTTP
GET /automations?limit=2
HTTP/1.1 200 OK
{
"status": "ok",
"meta": {
"total_count": 10,
"displayed_count": 2,
"offset": 0,
"limit": 2
},
"data": [
{
"id": "a3ac238ccfa94b3e979aea2cb78c48c2",
"activated_at": "2023-08-19 07:32:15"
"name": "Scenario Welcome"
},
{
"id": "5b2e6c2ae13b4d2c835a73daead5be59",
"activated_at": null
"name": "Scenario Birthday"
}
]
}
```
--------------------------------
### GET /automations
Source: https://app.smartemailing.cz/docs/api/v3/index
Retrieves a collection of automations, with options to filter, sort, select specific fields, and paginate results.
```APIDOC
## GET /automations
### Description
Gets a collection of automations with options for filtering, sorting, selecting fields, and pagination.
### Method
GET
### Endpoint
/automations
### Parameters
#### Query Parameters
- **select** (string) - Optional - Comma-separated list of properties to select (e.g., `?select=id,name`). If not provided, all fields are selected. Allowed values: `"id"`, `"name"`, `"activated_at"`.
- **sort** (string) - Optional - Comma-separated list of sorting keys (e.g., `?sort=activated_at,-name`). Prepend `-` for descending order. Allowed values: `"id"`, `"name"`, `"activated_at"`.
- **[FILTER_PARAM_GOES_HERE]** (string) - Optional - Filter by properties like `id`, `name`, `activated_at` (e.g., `?id=a3ac238ccfa94b3e979aea2cb78c48c2&name=Welcome`).
- **limit** (number) - Optional - Number of records per page. Maximum value is `500`. Default value: `500`.
- **offset** (number) - Optional - Skip records for pagination. Default value: `0`.
### Request Example
```
GET /automations?select=id,name&sort=-activated_at&limit=10&offset=0
```
### Response
#### Success Response (200)
- **data** (object) - Automations data (structure depends on selected fields)
#### Response Example
```json
{
"status": "ok",
"meta": {
"limit": 10,
"offset": 0,
"total": 50
},
"data": [
{
"id": "a3ac238ccfa94b3e979aea2cb78c48c2",
"name": "Welcome Series",
"activated_at": "2023-01-01T10:00:00Z"
}
]
}
```
#### Error Responses
- **401 Unauthorized**: Returned if authentication fails.
```
--------------------------------
### GET /import Success Response - Smartemailing API v3
Source: https://app.smartemailing.cz/docs/api/v3/index
This snippet illustrates a successful response from the GET /import endpoint. It includes the status, metadata, and a mapping of imported contacts' email addresses to their IDs. This 'contacts_map' is empty if double opt-in is used.
```json
HTTP/1.1 201 Created
{
"status": "created",
"meta": [],
"contacts_map": [
{
"emailaddress": "martin@smartemailing.cz"
"contact_id": 123
},
{
"emailaddress": "honza@smartemailing.cz"
"contact_id": 124
}
],
"double_opt_in_map": []
}
```