Stripo Plugin Backend API endpoint allows inline CSS styles into HTML code and prepare HTML for sending to clients.

In this case your back-end should send the post request to our back-end with such information:

POST: /api/v1/cleaner/v1/compress
Host: https:
Content-Type: application/json
Header: ES-PLUGIN-AUTH: Bearer YOUR_AUTH_TOKEN
Accept: application/json
Body: {html:YOUR_HTML_CODE, css:YOUR_CSS_CODE, minimize:true}
Response: {html:HTML_READY_TO_BE_SENT}

As a response our server will send you the HTML+CSS embedded.

This method called as Compress and it's not affected on the web-application because communication is Server-Server.

Please notice that you should call the initialization function every time a new email needs to be sent. Our back-end expects to get the needed parameter after initialization so it can establish a new session with a new getAuth token. 

To get YOUR_AUTH_TOKEN please take a look at this section.

Please be advised, in case if your email template contains AMP elements or components then in response you will see the ampHtml parameter, that contains the html code of AMP HTML Mime type.

In case if AMP HTML is invalid then you will get also the ampErrors parameter that contains the error descriptions (array of strings).

The example of it you can find below:

Request:
curl -X POST https://plugins.stripo.email/api/v1/auth -k -H "Content-Type: application/json" -H "Accept: application/json" --data "{\"pluginId\":\"YOUR_PLUGIN_ID\",\"secretKey\":\"YOUR_SECRET_KEY\"}" -i

Response:
{"token":"YOUR_AUTH_TOKEN"}

Request:
curl -X POST https://plugins.stripo.email/api/v1/cleaner/v1/compress -k -H "Content-Type: application/json" -H "Accept: application/json" -H "ES-PLUGIN-AUTH: Bearer YOUR_AUTH_TOKEN" --data "{\"html\":\"Some html\",\"css\":\"body {color: green}\",\"minimize\":true}" -i

Response:
{"html":"Some html"}

Did this answer your question?