---
agentTools:
  projectIndex: https://developers.etrusted.com/llms.txt
---

# Schedule new invites

This endpoint allows clients to schedule new review invites in eTrusted.

<details>
    <summary>Sample request payload in JSON (Click to view)</summary>

```json
{
  "channel": {
    "id": "chl-f8c8c9c3-93ff-48dd-1111-629196b5955a",
    "type": "user_defined"
  },
  "system": "Magento",
  "systemVersion": "1.0.0",
  "invites": [
    {
      "questionnaireTemplate": {
        "id": "tpl-qst-12261ad3-d36b-4a3a-a4ab-850920d7b11f"
      },
      "template": {
        "id": "tpl-inv-12261ad3-d36b-4a3a-a4ab-850920d7b11f"
      },
      "customer": {
        "firstName": "John",
        "lastName": "Doe",
        "email": "user@example.com"
      },
      "locale": "de_DE",
      "transaction": {
        "reference": "ORDER-121416990",
        "date": "2017-11-01T13:30:15Z"
      },
      "products": [
        {
          "gtin": "1234567890123",
          "imageUrl": "https://www.specialbrandshop.com/article123-TS-WH-M/image.jpg",
          "name": "Specialbrand T-Shirt White M",
          "mpn": "23687778",
          "sku": "1234-TS-WH-M",
          "brand": "specialbrand",
          "url": "https://www.specialbrandshop.com/article123-TS-WH-M/"
        }
      ],
      "preferredSendTime": "2018-02-01T17:09:41.79Z",
      "metadata": {
        "carModel": "Touareg",
        "carColor": "silver"
      }
    }
  ]
}
```

</details>

# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "info": {
    "title": "Invites API",
    "description": "This API allows clients to manually schedule new review invites in eTrusted.",
    "version": "1.0.0",
    "x-api-id": "aab87ef4-5915-4eb2-8d28-1f305d6274be"
  },
  "servers": [
    {
      "url": "https://api.etrusted.com/"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/invites": {
      "post": {
        "summary": "Schedule new invites",
        "description": "This endpoint allows clients to schedule new review invites in eTrusted.",
        "tags": [
          "invites"
        ],
        "requestBody": {
          "description": "The object containing invites to be scheduled.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InvitesRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "207": {
            "description": "Multi-Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvitesResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    },
    "schemas": {
      "InvitesRequest": {
        "description": "The request, that contains all the needed information to schedule new invites.",
        "type": "object",
        "required": [
          "channel",
          "invites",
          "system",
          "systemVersion"
        ],
        "properties": {
          "channel": {
            "required": [
              "id"
            ],
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "description": "The unique identifier of the channel.",
                "example": "chl-f8c8c9c3-93ff-48dd-1111-629196b5955a"
              },
              "type": {
                "type": "string",
                "description": "The type of the id used to refer to the channel.",
                "example": "user_defined",
                "default": "etrusted",
                "enum": [
                  "user_defined",
                  "etrusted"
                ]
              }
            },
            "description": "The channel which will be associated with the invites."
          },
          "system": {
            "type": "string",
            "description": "Name of the customer's system",
            "example": "Magento"
          },
          "systemVersion": {
            "type": "string",
            "description": "Version of the customer's system",
            "example": "1.0.0"
          },
          "invites": {
            "maxItems": 10000,
            "minItems": 1,
            "type": "array",
            "description": "The invites to be scheduled.",
            "items": {
              "$ref": "#/components/schemas/Invite"
            }
          }
        }
      },
      "InvitesResponse": {
        "type": "object",
        "description": "The response, if something went wrong.",
        "required": [
          "successfulInvites"
        ],
        "properties": {
          "batchId": {
            "type": "string",
            "description": "The eTrusted unique identifier of the request with invites. It will be returned only if some invites were successfully scheduled (successfulInvites>0).",
            "example": "ibr-12261ad3-d36b-4a3a-a4ab-850920d7b11f"
          },
          "successfulInvites": {
            "type": "integer",
            "description": "The number of successfully scheduled invites.",
            "example": 25
          },
          "failedInvites": {
            "type": "array",
            "description": "The invites that were not scheduled.",
            "items": {
              "$ref": "#/components/schemas/FailedInvite"
            }
          }
        }
      },
      "FailedInvite": {
        "type": "object",
        "description": "The invite that was not scheduled.",
        "required": [
          "initialInvite",
          "status",
          "reasons"
        ],
        "properties": {
          "initialInvite": {
            "$ref": "#/components/schemas/Invite"
          },
          "status": {
            "type": "integer",
            "description": "The HTTP status code of the error.",
            "example": 400
          },
          "reasons": {
            "type": "array",
            "description": "The reasons, why the invite was not scheduled.",
            "items": {
              "type": "string",
              "example": "invalid_email"
            }
          }
        }
      },
      "Invite": {
        "type": "object",
        "description": "The invite to be scheduled for later sendout.",
        "required": [
          "customer",
          "questionnaireTemplate",
          "template",
          "transaction"
        ],
        "properties": {
          "questionnaireTemplate": {
            "type": "object",
            "description": "The questionnaire template which will be used to render the actual questionnaire for this invite.",
            "required": [
              "id"
            ],
            "properties": {
              "id": {
                "type": "string",
                "description": "The eTrusted unique identifier of the questionnaire template.",
                "example": "tpl-qst-12261ad3-d36b-4a3a-a4ab-850920d7b11f"
              }
            }
          },
          "template": {
            "type": "object",
            "description": "The invite template which will be used for sending the invite.",
            "required": [
              "id"
            ],
            "properties": {
              "id": {
                "type": "string",
                "description": "The eTrusted unique identifier of the invite template.",
                "example": "tpl-inv-12261ad3-d36b-4a3a-a4ab-850920d7b11f"
              }
            }
          },
          "customer": {
            "type": "object",
            "description": "The customer invited to leave a review.",
            "required": [
              "email"
            ],
            "properties": {
              "firstName": {
                "type": "string",
                "description": "The customer's first name.",
                "example": "John"
              },
              "lastName": {
                "type": "string",
                "description": "The customer's last name.",
                "example": "Doe"
              },
              "email": {
                "type": "string",
                "description": "The customer's email address.",
                "example": "user@example.com"
              }
            }
          },
          "locale": {
            "type": "string",
            "description": "The locale in which the customer will get the invite and questionnaire.",
            "example": "de_DE"
          },
          "transaction": {
            "type": "object",
            "description": "The transaction to be reviewed.",
            "required": [
              "reference"
            ],
            "properties": {
              "reference": {
                "type": "string",
                "description": "An external reference to the transaction.",
                "example": "ORDER-121416990"
              },
              "date": {
                "type": "string",
                "description": "The date when the transaction occurred, given in the ISO8601 & RFC3339 valid format yyyy-MM-dd'T'HH:mm:ss.SSSZ.",
                "format": "date-time",
                "example": "2017-11-01T13:30:15Z"
              }
            }
          },
          "products": {
            "type": "array",
            "description": "This is a list of products.\nIt contains the products that are associated with the event.\nIt includes all data needed for product reviews for these products.\n",
            "items": {
              "required": [
                "name",
                "sku",
                "url"
              ],
              "type": "object",
              "properties": {
                "gtin": {
                  "type": "string",
                  "description": "The GTIN identifies the product globally.\nA GTIN can be an ISBN, an EAN, and much more.\nRefer to [gtin.info](https://www.gtin.info/)\n",
                  "example": "1234567890123"
                },
                "imageUrl": {
                  "type": "string",
                  "description": "A link to a product image.\n*eTrusted* can display an image of the product to the customer who is writing a review.\nThis makes it easier for customers to remember and recognize the product.\n",
                  "example": "https://www.specialbrandshop.com/article123-TS-WH-M/image.jpg"
                },
                "name": {
                  "type": "string",
                  "description": "The product name contains information about a\nproduct that is associated with the event (e.g. `Specialbrand T-Shirt White M`).\n",
                  "example": "Specialbrand T-Shirt White M"
                },
                "mpn": {
                  "type": "string",
                  "description": "The Manufacturer Part Number is an identifier for a product by the manufacturer if applicable.\nIn some cases it can serve as a substitute for the GTIN.\n",
                  "example": "23687778"
                },
                "sku": {
                  "type": "string",
                  "description": "The Stock Keeping Unit is a specific article number of the product, most often assigned by a specific retail shop as a scannable bar code.\nIt lets the shops track movement of inventory.\nThe SKU must be unique and usually consists of about 8 characters (e.g. `1234-TS-WH-M`).\n",
                  "example": "1234-TS-WH-M"
                },
                "brand": {
                  "type": "string",
                  "description": "The brand of the product (e.g. `specialbrand`).\nA product can only have one brand.\n",
                  "example": "specialbrand"
                },
                "url": {
                  "type": "string",
                  "description": "A link to the product detail page in your online shop or public catalog (e.g. `http://www.specialbrandshop.com/article123-TS-WH-M/`).\n",
                  "example": "https://www.specialbrandshop.com/article123-TS-WH-M/"
                }
              }
            }
          },
          "preferredSendTime": {
            "type": "string",
            "description": "The date and time when the invite should be sent. It is in the ISO 8601 & RFC3339 valid format `yyyy-MM-dd'T'HH:mm:ss.SSSZ`. If it is not set or the date is in the past, the invite will be scheduled immediately.",
            "format": "date-time",
            "example": "2018-02-01T17:09:41.79Z"
          },
          "metadata": {
            "type": "object",
            "description": "Key-value pairs of metadata associated with the invite.",
            "properties": {},
            "example": {
              "carModel": "Touareg",
              "carColor": "silver"
            }
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "description": "The response, if the authorization or initial validation failed.",
        "properties": {
          "Message": {
            "type": "string",
            "description": "Error message details",
            "example": "Invalid request: 'channel' is missing"
          }
        }
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 100,
      "1": 108,
      "2": 96,
      "3": 204,
      "4": 143,
      "5": 43,
      "6": 215,
      "7": 4,
      "8": 203,
      "9": 15,
      "10": 80,
      "11": 215
    }
  }
}
```