Create an upload slot in the account library. contentType must be image/png, image/jpeg, image/gif, or image/webp. PUT the file to the returned uploadUrl with that Content-Type, then use the returned url in emails and the editor.
const url = 'https://api.pingram.io/library/example';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"filename":"example","contentType":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.pingram.io/library/example \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "filename": "example", "contentType": "example" }'Authorizations
Parameters
Path Parameters
Library use-case
Request Bodyrequired
object
Original filename, including extension (e.g. hero.png).
Image MIME type. One of image/png, image/jpeg, image/gif, or image/webp.
Examplegenerated
{ "filename": "example", "contentType": "example"}Responses
200
Successful response
object
Public URL to use in emails after the file is uploaded to uploadUrl.
Time-limited upload URL. PUT the file bytes with the same Content-Type.
Example
{ "useCase": "media"}400
Bad Request - validation errors, invalid input
Standard error response for API errors.
object
Unique tracking ID for the request.
Structured error details for API error responses.
object
Machine-readable error code.
Human-readable error message.
Actionable hint for fixing the error.
Examplegenerated
{ "trackingId": "example", "error": { "code": "example", "message": "example", "fix": "example" }}401
Unauthorized
402
Payment Required - usage limits exceeded
Standard error response for API errors.
object
Unique tracking ID for the request.
Structured error details for API error responses.
object
Machine-readable error code.
Human-readable error message.
Actionable hint for fixing the error.
Examplegenerated
{ "trackingId": "example", "error": { "code": "example", "message": "example", "fix": "example" }}500
Internal Server Error
502
Bad Gateway - provider error
Standard error response for API errors.
object
Unique tracking ID for the request.
Structured error details for API error responses.
object
Machine-readable error code.
Human-readable error message.
Actionable hint for fixing the error.
Examplegenerated
{ "trackingId": "example", "error": { "code": "example", "message": "example", "fix": "example" }}