# Post Processing Scripts > Build your own post processing endpoint: what Breeze Booth sends after each photo, and the response it expects back. ## About post processing scripts Breeze Booth can send each captured photo, with its session data, to your own script or API endpoint straight after the photo is taken. Your endpoint can send back a modified image and data for Breeze Booth to use, such as caption values for layouts or an email address to share to. This lets you connect Breeze Booth to other systems without changing the app. To turn it on and set the URL, password, image size and timeout, see [Post Processing](https://www.breezesoftware.com/help/breeze-booth/post-processing). ## Common uses - Fetching attendee registration data from an event platform - Custom image processing - Applying your own AI effects - Logging session data to an external database or CRM ## How it works When a photo is taken, Breeze Booth sends an HTTP POST to your URL as `multipart/form-data`, with the image and the session fields. Your endpoint must: 1. Process the request. 2. Return a multipart response containing a JSON metadata part **and** the image (original or modified). > **Warning** > > Both parts are required. Returning JSON without an image may stop the session completing correctly. ## Request format Breeze Booth sends a standard HTTP POST with `Content-Type: multipart/form-data`. ### Standard POST fields | Field | Type | Description | |---|---|---| | `fileToUpload` | file | Captured JPEG image | | `eventkitesessionid` | string | Unique session ID | | `eventkitegalleryid` | string | Gallery ID | | `status` | string | Session status | | `model` | string | Camera model | | `name` | string | Profile display name | | `username` | string | Profile username | | `user_id` | string | Internal user ID | | `profile` | string | Active profile name | | `time` | string | Capture timestamp | | `hash` | string | Session integrity hash | | `version` | string | Breeze Booth version | | `id` | string | Session record ID | ### Survey and QR code fields If surveys or QR codes are set up, their values are sent as extra POST fields. For example: ``` surveyN_type_id = "user-entered-value" {qr1} = "scanned-qr-value" {qr2} = "second-qr-field" ``` > **Info** > > Field names are case-sensitive. Match them exactly, including the braces where used (e.g. `{qr1}`). ## Response format Your endpoint must return a `multipart/form-data` response with exactly two parts: the JSON metadata, then the image file. ``` Content-Type: multipart/form-data; boundary=your_boundary --your_boundary Content-Type: application/json {"status":"success","captions":{"field1":"value1"},"autoemail":"user@example.com"} --your_boundary Content-Type: image/jpeg Content-Disposition: file; name="image"; filename="photo.jpg" [binary image data] --your_boundary-- ``` ### JSON metadata fields | Field | Type | Description | |---|---|---| | `status` | string | Required. Must be `"success"` | | `captions` | object | Optional key/value pairs to use in the session | | `autoemail` | string | Optional email address to send the photo to | ### Captions Captions pass values back into the Breeze Booth session. Use them in layouts, overlays, filenames and sharing as tokens. ```json "captions": { "first_name": "Jane", "last_name": "Smith", "membership_tier": "Gold", "reg_email": "jane@example.com" } ``` > **Tip** > > To use a value in Breeze, put its ID in curly brackets, e.g. `{membership_tier}`. ### Auto email `autoemail` sends the photo to that address automatically. For it to work, email must be set up, and the sharing screen must be enabled with an **Email** share touch screen action (it can be hidden). ```json { "status": "success", "captions": { "member_name": "Jane Smith" }, "autoemail": "jane@example.com" } ``` > **Info** > > If `autoemail` is missing or empty, no email is sent. ### Complete response example ``` HTTP/1.1 200 OK Content-Type: multipart/form-data; boundary=breeze_boundary_1234567890 --breeze_boundary_1234567890 Content-Type: application/json { "status": "success", "captions": { "first_name": "Jane", "event_tier": "VIP", "reg_email": "jane@example.com" }, "autoemail": "jane@example.com" } --breeze_boundary_1234567890 Content-Type: image/jpeg Content-Disposition: file; name="image"; filename="jane_1234567890.jpg" [binary JPEG data] --breeze_boundary_1234567890-- ``` ## Image handling The image arrives in `fileToUpload`. You can return it unchanged or modify it (overlays, crops, AI effects and so on). The image you return replaces the original. ## Error handling Return a JSON body with a non-200 HTTP status: ``` HTTP/1.1 400 Bad Request Content-Type: application/json {"status":"error","message":"Missing required field: qr1"} ``` | Code | Meaning | When to use | |---|---|---| | 200 | Success | Valid multipart response | | 400 | Bad Request | Missing or invalid input | | 401 | Unauthorised | Authentication failed | | 500 | Server Error | Unexpected failure | > **Warning** > > If your script calls other APIs, don't send `Content-Type: application/json` on GET requests. Some gateways reject them with 403 Forbidden. ## Example script This PHP example receives the photo, saves it, adds a simple text watermark, and returns the image with two captions, `{mood}` and `{hair_color}`, that you can use in layouts, overlays, filenames or sharing. ```php 'error', 'message' => 'No image received']); exit; } // Save the original (optional) $dir = __DIR__ . '/uploads'; if (!is_dir($dir)) mkdir($dir, 0755, true); $session = preg_replace('/[^A-Za-z0-9_-]/', '', $_POST['eventkitesessionid'] ?? uniqid()); $path = "$dir/$session.jpg"; move_uploaded_file($_FILES['fileToUpload']['tmp_name'], $path); // Add a simple watermark with GD $img = imagecreatefromjpeg($path); $white = imagecolorallocatealpha($img, 255, 255, 255, 40); imagestring($img, 5, 20, imagesy($img) - 40, 'Processed by Breeze', $white); ob_start(); imagejpeg($img, null, 92); $jpeg = ob_get_clean(); imagedestroy($img); // Data to send back to Breeze Booth $meta = [ 'status' => 'success', 'captions' => ['mood' => 'Happy', 'hair_color' => 'Brown'], ]; // Multipart response: JSON first, then the image $b = 'breeze_' . bin2hex(random_bytes(8)); header("Content-Type: multipart/form-data; boundary=$b"); echo "--$b\r\nContent-Type: application/json\r\n\r\n" . json_encode($meta) . "\r\n"; echo "--$b\r\nContent-Type: image/jpeg\r\nContent-Disposition: file; name=\"image\"; filename=\"$session.jpg\"\r\n\r\n"; echo $jpeg . "\r\n--$b--\r\n"; ``` > **Tip** > > This is a starting point for testing. Swap the watermark and captions for your own logic, such as looking up data from an external API or generating AI content. --- Source: https://www.breezesoftware.com/help/breeze-booth/post-processing-scripts