API: Mail

Send one mail

JWT Authorisation

POST /api/v3/mail

Request parameter:

No Request parameter

JSON data:

ParameterMandatoryIn TypeExampleDescription
ref_idfalsestringk123km12d12dk1If provided return value will contain it along with send-result for easy identification
totruestring

contact@wmc.ch 
OR multiple divided by ";"
contact@wmc.ch;service@wmc.ch

List of to addresses or a single email address 
ccfalsestring - as above -List of carbon copy target email addresses
bccfalsestring- as above -List of blind carbon copy target email addresses
subjecttruestringInvoice for [HK_Name]Email subject - it can contain tokens from the BrokerStar writer module (You need to provide contactpolicyclaim or premium_invoice parameter to use tokens)
bodytrue if not using template parameterstring

Hello [HK_Name] <br/>
<b>New invoice</b> was generated for You.

<hr/>

Best regards,
Dev.

Email body - as above -
templatefalseint2If was want to use API: Mail Templates instead of the `body` parameter.
contactfalseint1Used to replace tokens in email body/subject based on the provided API: Contact
policyfalseint12Used to replace tokens in email body/subject based on provided API: Policy
claimfalseint123Used to replace tokens in email body/subject based on a provided API: Claim
premium_invoicefalseint1234Used to replace tokens in email body/subject based on provided API: Premium Invoice
savefalsebooleanfalseDefault=true, If true mail will be stored in BrokerStar Mail system (as system email)

API: _ Default behavior #List defaults

Response data:

Metadata: object.

ParameterTypeDescription
statusintResponse status (same as in http code)

Data:  object.data[array]

ParameterTypeDescription
codeintResponse code (for single email send)
subjectstringFilled subject field
bodystringFilled body field

Response (Error):

ParameterTypeDescription
codeintegerAn error code
errorstringA message containing some information about the error 
errorsarrayList of errors devided by field in associative array {field_name:error message}

API: _ Default behavior#Authentication defaults 

Request
curl -X POST https://public.brokerstar.biz/api/v3/mail 
--data-raw '{
    "subject":"Invoice for [HK_Name]",
    "to":"contact@wmc.ch;service@wmc.ch",
    "template":3,
    "contact": 1,
    "ref_id": "1aa1241das12"
}
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE2NTg[...]cm5hbWUiOiJkZW1vLWRlIn0.VTVp[...]cqIg'


Response (Success)
200 OK 
{
    "status": 200,
    "data": {
        "code": 200,
        "subject": "Invoice for WMC IT Solutions AG",
        "body": "<div>asdas </div>",
        "ref_id": "1aa1241das12"
    }
}
Response (Error)
200 OK
{
    "status": 200,
    "data": {
        "error": "Missing argument (subject)XXX:\n    This value is not a valid email address. \nMissing argument (body)",
        "errors": {
            "subject": "This argument is required",
            "to": "XXX:\n    This value is not a valid email address. \n",
            "body": "This argument is required (if not template provided)"
        },
        "error_count": 3,
        "ref_id": "1aa1241das12"
    }
}

Or one of 

Send multiple mails

JWT Authorisation

POST /api/v3/mail

Request parameter:

No Request parameter

JSON data:

ParameterMandatoryIn TypeExampleDescription
Same as in single email bug in array [{obejct},{object}]

API: _ Default behavior #List defaults

Response data:

Metadata: object.

ParameterTypeDescription
statusintResponse status (same as in http code)
sendintNumber of send emails
errorintNumber of not send emails

Data:  object.data[array]

ParameterTypeDescription
Same as in single email bug in array [{obejct},{object}]

Response (Error):

ParameterTypeDescription
Same as in single email bug in array [{obejct},{object}]

API: _ Default behavior #Authentication defaults 

Request
curl -X POST https://public.brokerstar.biz/api/v3/mail 
--data-raw '[
    {
        "subject":"Invoice for [HK_Name]",
        "template": 1,
        "ref_id": "asdasdas1312",
        "to" : "asd@asd.pl;kkk@wp.pla",
        "contact" : 123
       
    },
     {
        "subject":"123123",
        "body": "hello: [HK_Adressblock]",
        "ref_id": "asdasdas1313",
        "to" : "sss@asd.pl",
        "contact" : 123
    },
    {

        "to":"dsaxa@gmail.com",
        "save": false
    }
]'
--header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpYXQiOjE2NTg[...]cm5hbWUiOiJkZW1vLWRlIn0.VTVp[...]cqIg'


Response (Mixed)
200 OK 
{
    "send": 2,
    "error": 1,
    "data": [
        {
            "code": 200,
            "subject": "Invoice for Hypoteq AG",
            "body": "<div>asdasdas asd as Hypoteq AG<br/>Industriestrasse 47<br/>6300 Zug</div>",
            "ref_id": "asdasdas1312"
        },
        {
            "code": 200,
            "subject": "123123",
            "body": "hello: Hypoteq AG<br/>Industriestrasse 47<br/>6300 Zug",
            "ref_id": "asdasdas1313"
        },
        {
            "error": "Missing argument (subject)Missing argument (body)",
            "errors": {
                "subject": "This argument is required",
                "body": "This argument is required (if not template provided)"
            },
            "error_count": 2
        }
    ]
}
Response (Error)
 

Or one of