Images in your values
An image field’s value names a picture. It can be one of the template’s own images, which a designer put in the package, or one of your organisation’s named resources: pictures you upload once, under a name of your choosing, and name in values as resource:<name>.
Upload a picture
Section titled “Upload a picture”Upload it under a name: letters, digits and . _ - /, up to 200 characters, such as speakers/grace.jpg. PNG, JPEG, SVG and TIFF are taken.
curl -X PUT -H "Authorization: Bearer $PAPRIKA_KEY" --data-binary @photo.jpg "$PAPRIKA_URL/v1/resources/speakers/grace.jpg"{ "name": "speakers/grace.jpg", "format": "jpeg", "width": 1200, "height": 1200 }Uploading under the same name again replaces the picture. A resource stays until you delete it.
Use it in a render
Section titled “Use it in a render”Name it in the image field’s value:
curl -H "Authorization: Bearer $PAPRIKA_KEY" -H "Content-Type: application/json" -H "Accept: application/pdf" -d '{"values": {"name": "Grace Hopper", "role": "Keynote speaker", "photo": "resource:speakers/grace.jpg"}}' -o grace.pdf "$PAPRIKA_URL/v1/templates/tpl_9fK2mQ7rLx4VbN1s/versions/latest/render"The badge now shows Grace’s photo instead of the default. A resource that isn’t there refuses the render, 409 resources-unknown, naming it:
curl -H "Authorization: Bearer $PAPRIKA_KEY" -H "Content-Type: application/json" -d '{"values": {"name": "Ada Lovelace", "role": "Speaker", "photo": "resource:speakers/ada.jpg"}}' "$PAPRIKA_URL/v1/templates/tpl_9fK2mQ7rLx4VbN1s/versions/latest/render"{ "code": "resources-unknown", "message": "Unknown resources: speakers/ada.jpg", "missing": ["speakers/ada.jpg"], "requestId": "5d0c2a91"}List and delete
Section titled “List and delete”curl -H "Authorization: Bearer $PAPRIKA_KEY" "$PAPRIKA_URL/v1/resources"curl -X DELETE -H "Authorization: Bearer $PAPRIKA_KEY" "$PAPRIKA_URL/v1/resources/speakers/grace.jpg"Outputs already made keep the picture they were made with; renders after the deletion that name it are refused.