REST v2 - Email - Create An Email Record - Internal Server Error / Missing Email

@OmarAlmonte, I am trying to use the Email - Create an Email Record endpoint, but it keeps reporting an Internal Error, although it does not indicate what the issue is.

https://developer.infusionsoft.com/docs/restv2/#tag/Email/operation/createEmail

Internal Server Error: {"code":500,"message":"An unexpected error occurred","status":"Internal Server Error","details":[{"domain":"email","resource":"POST /rest/v2/emails"}]} 

I am trying to post the following body.

[
        'contact_id' => 968196,
        'subject' => 'Test Subject Line',
        'sent_to_address' => 'test260606@example.com',
        'plain_content' => 'This is a test.'
]

I have tried setting the “sent_time” and “html_content” fields, but same issue is being reported.

Can you please check on your end to see what is going on. If it is working, then what parameters need to be set?

Thanks.

Your team needs to improve the error handling and indicate what the problems are when it processes the request.

In the original post the “plain_content” was not Base 64 Encoded, which caused the problem. After running the test, I could not see the Email due to no date being present.

On upon updating the example with the “sent_time”, it was able to come back with the response.

    [
        'contact_id' => 968196,
        'subject' => 'Test Subject Line',
        'sent_to_address' => 'test260606@example.com',
        'sent_time' => date('c'),
        'plain_content' => base64_encode('This is a test.')
    ]

Result.

stdClass Object
(
    [id] => 195935866
    [subject] => Test Subject Line
    [headers] => 
    [contact_id] => 968196
    [sent_to_address] => test260606@example.com
    [sent_to_cc_address_list] => Array
        (
        )

    [sent_to_bcc_address_list] => Array
        (
        )

    [sent_from_address] => 
    [sent_from_reply_address] => 
    [sent_time] => 2026-06-09T09:56:31Z
    [received_time] => 
    [opened_time] => 
    [clicked_time] => 
    [original_provider_id] => 5dbd1ca5f75f492d9fb32d0e3e427c78
    [original_provider] => UNKNOWN
    [provider_source_id] => 
    [plain_content] => VGhpcyBpcyBhIHRlc3Qu
    [html_content] => 
    [sent_date] => 2026-06-09T09:56:31Z
    [sent_to_cc_addresses] => 
    [sent_to_bcc_addresses] => 
    [received_date] => 
    [opened_date] => 
    [click_date] => 
)

When viewing the Email History for the Contact it shows nothing.

What are the rules in getting it to appear in the history?

Hi Pav, we will look into this internally and I will get back to you.