# Preview ## Get email preview `client.emailSecurity.investigate.preview.get(stringinvestigateId, PreviewGetParamsparams, RequestOptionsoptions?): PreviewGetResponse` **get** `/accounts/{account_id}/email-security/investigate/{investigate_id}/preview` Returns a preview of the message body as a base64 encoded PNG image for non-benign messages. ### Parameters - `investigateId: string` Unique identifier for a message retrieved from investigation - `params: PreviewGetParams` - `account_id: string` Identifier. ### Returns - `PreviewGetResponse` - `screenshot: string` A base64 encoded PNG image of the email. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const preview = await client.emailSecurity.investigate.preview.get( '4Njp3P0STMz2c02Q-2024-01-05T10:00:00-12345678', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(preview.screenshot); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "screenshot": "screenshot" }, "success": true } ``` ## Preview for non-detection messages `client.emailSecurity.investigate.preview.create(PreviewCreateParamsparams, RequestOptionsoptions?): PreviewCreateResponse` **post** `/accounts/{account_id}/email-security/investigate/preview` Generates a preview image for a message that was not flagged as a detection. Useful for investigating benign messages. Returns a base64-encoded PNG screenshot of the email body. ### Parameters - `params: PreviewCreateParams` - `account_id: string` Path param: Identifier. - `postfix_id: string` Body param: The identifier of the message ### Returns - `PreviewCreateResponse` - `screenshot: string` A base64 encoded PNG image of the email. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const preview = await client.emailSecurity.investigate.preview.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', postfix_id: '4Njp3P0STMz2c02Q', }); console.log(preview.screenshot); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "screenshot": "screenshot" }, "success": true } ``` ## Domain Types ### Preview Get Response - `PreviewGetResponse` - `screenshot: string` A base64 encoded PNG image of the email. ### Preview Create Response - `PreviewCreateResponse` - `screenshot: string` A base64 encoded PNG image of the email.