Images
Keep a photo of a piece your customer likes, so their designs can follow it. Your server sends the photo, or a link to it, and gets the image's id. Name the image by that id in reference_images when you create a design. The call takes your API key and the customer's access token from Auth. Each image belongs to that customer, in your store.
Create an image
Send the photo as a file in a multipart/form-data body, or a link to it in a JSON body. The image is ready for a design as soon as the call answers.
https://api.diamra.com/v1/imagescurl https://api.diamra.com/v1/images \ -H "Authorization: Bearer $DIAMRA_API_KEY" \ -H "Diamra-Customer-Token: $ACCESS_TOKEN" \ -F file=@ring.jpgcurl https://api.diamra.com/v1/images \ -H "Authorization: Bearer $DIAMRA_API_KEY" \ -H "Diamra-Customer-Token: $ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "url": "https://example.com/photos/ring.jpg" }'HTTP/2 201content-type: application/jsonrequest-id: req_6d2a9f40b1c87e53{ "id": "7c2e9a41-5d3b-4f8e-a1c6-0b9d4e2f8a73", "url": "https://assets.diamra.com/store-images/5b8e1f3a-2c47-4d9e-b061-7a3f9c2e4d18/user-uploads/7c2e9a41-5d3b-4f8e-a1c6-0b9d4e2f8a73.webp"}The image
Links
Diamra downloads a link once, when you send it, and keeps its own copy, so the image stays the same if the page it came from changes. The link must open without signing in. Diamra follows up to three redirects. It never fetches a link to an IP address or a local network name.
Use it in a design
Send up to three images in reference_images, each as an object with its id, with or without a prompt. The design stays close to the piece in the photos and changes what the prompt asks for. Only the customer who sent an image can use it, and only in your store.
curl https://api.diamra.com/v1/designs \ -H "Authorization: Bearer $DIAMRA_API_KEY" \ -H "Diamra-Customer-Token: $ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "prompt": "The same ring in yellow gold", "reference_images": [ { "id": "7c2e9a41-5d3b-4f8e-a1c6-0b9d4e2f8a73" } ] }'Limits
Over it, the call answers a 429 rate_limit, with Retry-After: 60.
Errors
HTTP/2 400content-type: application/jsonrequest-id: req_4f7b0e2d93a16c58{ "error": { "type": "invalid_request_error", "code": "image_unreachable", "message": "We couldn't download an image from this url. Check that it opens without signing in.", "param": "url" }}