Built-in tool
Upload Image to WordPress
Add an image to a connected WordPress website's media library from a public address, for a featured image or inside a post or page.
Endpoint
Parameters
| Name | Type | Required | Note |
|---|---|---|---|
| urlstring · required | string | required | The public https address of the image: JPEG, PNG, GIF, WebP or AVIF, 15 MB at most. |
| altstring · optional | string | optional | Alt text: what the image shows, for screen readers and search. |
| sitestring · optional | string | optional | Which connected WordPress site, when several are connected: its address (example.com), its name or its account id. Leave out when only one is connected. |
| titlestring · optional | string | optional | The image's title in the media library. |
| captionstring · optional | string | optional | A caption shown under the image where the theme shows captions. |
| filenamestring · optional | string | optional | A short descriptive file name without its extension, for example "pricing-table". Taken from the address when left out. |
Response schema
{
"type": "object",
"$schema": "http://json-schema.org/draft-07/schema#",
"required": [
"site",
"media"
],
"properties": {
"site": {
"type": "object",
"required": [
"name",
"url"
],
"properties": {
"url": {
"type": "string"
},
"name": {
"type": "string"
}
},
"additionalProperties": false
},
"media": {
"type": "object",
"required": [
"id",
"url",
"mimeType",
"width",
"height",
"alt"
],
"properties": {
"id": {
"type": "number"
},
"alt": {
"type": "string"
},
"url": {
"type": "string"
},
"width": {
"type": [
"number",
"null"
]
},
"height": {
"type": [
"number",
"null"
]
},
"mimeType": {
"type": "string"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}