Upload An Image To A Page
POST
/pages/{pageId}/images
const url = 'https://app.metakip.com/api/v1/pages/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/images';const form = new FormData();form.append('file', 'file');form.append('alt', 'example');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
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://app.metakip.com/api/v1/pages/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/images \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: multipart/form-data' \ --form file=@file \ --form alt=exampleUploads a JPEG, PNG, GIF, or WebP image, attaches it to the page, and returns stable Markdown for insertion. The maximum image size is 10 MB.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”pageId
required
string format: uuid
The UUID of the page.
Header Parameters
Section titled “Header Parameters”Idempotency-Key
string
Use the same key to retry the same request. Completed responses are replayed for 24 hours; incomplete reservations expire after 5 minutes.
Request Bodyrequired
Section titled “Request Bodyrequired”Media typemultipart/form-data
object
file
required
string format: binary
alt
string
Responses
Section titled “Responses”The managed image and Markdown reference.
Media typeapplication/json
object
id
required
string format: uuid
url
required
string
markdown
required
string
filename
required
string
originalName
required
string
mimeType
required
string
size
required
integer
Example
{ "mimeType": "image/jpeg"}The API token is missing a required scope: pages:write.
Media typeapplication/json
Structured error returned when the request cannot be completed.
object
error
required
Error details for programmatic handling.
object
code
required
Stable error code.
string
message
required
Human-readable explanation.
string
Examplegenerated
{ "error": { "code": "example", "message": "example" }}