Welcome to the OpenCities help centre. Search for what you're after, or browse the categories.
Can't find what you're looking for? Submit a support ticket and we'll be in touch.

Follow

Embeds API

avatar of Kira Hartley

Kira Hartley

Last updated

In this article:

List Embeds

Endpoint: GET /embeds/list 

Authentication: Required 

Description: Returns a list of embeds under the current website with pagination.

Parameters

Parameter Type Required Description
offset integer No Offset for pagination. Default: 0
limit integer No Number of items to return. Default: 20

Sample Request

curl -u "your_app_id:your_api_key" \
  -H "Content-Type: application/json" \
  "https://your-domain.com/api/v1/embeds/list?offset=0&limit=10"

Get Embed by ID

Endpoint: GET /embeds/{embedId} 

Authentication: Required 

Description: Get a specific embed by ID.

Parameters

Parameter Type Required Description
embedId string (uuid) Yes ID of embed to retrieve (path parameter)

Sample Request

curl -u "your_app_id:your_api_key" \
  -H "Content-Type: application/json" \
  "https://your-domain.com/api/v1/embeds/123e4567-e89b-12d3-a456-426614174000"

Get Embed by Name

Endpoint: GET /embeds/get 

Authentication: Required 

Description: Get a specific embed by name.

Parameters

Parameter Type Required Description
name string Yes Name of embed to retrieve (query parameter)

Sample Request

curl -u "your_app_id:your_api_key" \
  -H "Content-Type: application/json" \
  "https://your-domain.com/api/v1/embeds/get?name=YouTube%20Video"

Sample Response

{
  "Id": "123e4567-e89b-12d3-a456-426614174000",
  "Name": "YouTube Video",
  "Embed": "<iframe src=\"https://www.youtube.com/embed/dQw4w9WgXcQ\"></iframe>",
  "BodyTag": "[youtube-embed]"
}

Create Embed

Endpoint: POST /embeds/create 

Authentication: Required 

Description: Creates a new embed with the provided data.

Parameters

Parameter Type Required Description
model object Yes Embed object (request body)

Sample Request

curl -u "your_app_id:your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "Name": "YouTube Video",
    "Embed": "<iframe src=\"https://www.youtube.com/embed/dQw4w9WgXcQ\"></iframe>",
    "BodyTag": "[youtube-embed]"
  }' \
  "https://your-domain.com/api/v1/embeds/create"

Update Embed

Endpoint: POST /embeds/{embedId}/update 

Authentication: Required 

Description: Update an existing embed with the provided data.

Parameters

Parameter Type Required Description
embedId string (uuid) Yes ID of embed to update (path parameter)
model object Yes Embed object (request body)

Sample Request

curl -u "your_app_id:your_api_key" \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "Name": "Updated YouTube Video",
    "Embed": "<iframe src=\"https://www.youtube.com/embed/updated_video\"></iframe>",
    "BodyTag": "[updated-youtube-embed]"
  }' \
  "https://your-domain.com/api/v1/embeds/123e4567-e89b-12d3-a456-426614174000/update"

Sample Response

{
  "message": "Embed updated successfully"
}

Delete Embed

Endpoint: DELETE /embeds/{embedId}/delete 

Authentication: Required 

Description: Delete a specific embed by ID.

Parameters

Parameter Type Required Description
embedId string (uuid) Yes ID of embed to delete (path parameter)

Sample Request

curl -u "your_app_id:your_api_key" \
  -X DELETE \
  "https://your-domain.com/api/v1/embeds/123e4567-e89b-12d3-a456-426614174000/delete"
Was this article helpful?
0 out of 0 found this helpful