Browse documentation

Save a uDrew planning image

Use the uDrewWidget callback to save a generated image on a Neptune customer.

On this page

2. uDrewWidget

Use this endpoint when the uDrew planning widget built into Neptune sends a generated image back to Neptune for a specific customer.

Request

  • Method: POST
  • Headers:
    • Content-Type: application/json

Authentication

This endpoint does not use an API key.

Instead, Neptune validates the provided customerId by checking that the customer exists and has an organisationId.

Request body

FieldTypeRequiredNotes
customerIdstringYesNeptune customer ID that should receive the uploaded image
featureIdstringYesuDrew feature identifier
imageDatastringYesBase64 image string, with or without a data:image/...;base64, prefix
featureNamestringNoUsed as the upload label and filename when present
featureTypestringNoUsed if featureName is not provided

Example body

{
  "customerId": "customer_123",
  "featureId": "feature_456",
  "featureName": "Rectangle Pool",
  "featureType": "pool",
  "imageData": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."
}

Example request

curl -X POST "https://us-central1-netpune-220210.cloudfunctions.net/uDrewWidget" \
  -H "Content-Type: application/json" \
  -d '{
    "customerId": "customer_123",
    "featureId": "feature_456",
    "featureName": "Rectangle Pool",
    "featureType": "pool",
    "imageData": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."
  }'

What Neptune does

  1. Confirms customerId, featureId, and imageData are present.
  2. Loads the Neptune customer record.
  3. Uses the customer’s organisationId to determine where to store the image.
  4. Uploads the image to storage.
  5. Creates a new record in customers/{customerId}/uploads.

The saved upload uses:

  • featureName as the label if present
  • otherwise featureType
  • otherwise uDrew Generated

Success response

{
  "ok": true,
  "imageBucket": "org123/customerUploads/customer_123/udrew-1710000000000_Rectangle-Pool.png",
  "customerId": "customer_123",
  "featureId": "feature_456"
}
FieldTypeNotes
okbooleantrue when the request succeeded
imageBucketstringStorage path of the uploaded image
customerIdstringEchoes the target Neptune customer ID
featureIdstring | undefinedEchoes the provided feature ID when present

Error responses

StatusErrorWhen it happens
400missing_required_fieldscustomerId, featureId, or imageData is missing
404customer_not_foundcustomerId does not match a Neptune customer
405method_not_allowedRequest method is not POST
500missing_organisation_idCustomer exists but is missing an organisation association
500internal_errorUnexpected server-side failure

Image format notes

Both endpoints accept imageData as either:

  • a full data URL, for example data:image/png;base64,...
  • a raw base64 string

Neptune currently recognises:

  • image/jpeg
  • image/jpg
  • image/webp

If the image type cannot be recognised from the provided string, Neptune defaults to png.