Biklo for developersTESTsandbox-api.biklo.comchange

Reorder images

PUT/v1/products/{id}/images/order

scope products.write

Ids you do not name keep their relative order after the ones you do. The first is the primary image.

Request body#

FieldTypeRequiredDescription
image_idsinteger[]requiredImage ids in the order you want them, first one being the listing's main photo. Ids come from GET /v1/products/{id}. An id that does not belong to this product is skipped rather than failing the call, and any image you leave out keeps its place after the ones you listed — so you can move a single photo to the front without sending the whole set.

Example

{
    "image_ids": [
        108876841,
        108876840,
        108876839
    ]
}

Response#

FieldTypeDescription
imagesarrayThe listing's images AFTER the change, already in display order — so you never need a follow-up read to see the result.
images[].idintegerThe image id, for reordering and deletion.
images[].positionintegerIts place, 0 being the main photo.
images[].pathstring|nullWhere the file sits in our storage, when we host it.
images[].source_urlstring|nullThe URL we serve it FROM, when you attached it by link. Exactly one of these two is set.

Example

{
    "images": [
        {
            "id": 108876841,
            "position": 0,
            "path": "files/237224/mtb-front.jpg",
            "source_url": null
        },
        {
            "id": 108876840,
            "position": 1,
            "path": null,
            "source_url": "https://cdn.example.com/erp/mtb-side.jpg"
        }
    ]
}

Failures use the shared error envelope — a machine-readable code and a request_id to quote to support. Error handling.

curl -X PUT "https://sandbox-api.biklo.com/v1/products/711/images/order" \
  -H "Authorization: Bearer bk_test_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "image_ids": [
        108876841,
        108876840,
        108876839
    ]
}'
<?php

$ch = curl_init('https://sandbox-api.biklo.com/v1/products/711/images/order');

curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST  => 'PUT',
    CURLOPT_HTTPHEADER     => [
        'Authorization: Bearer bk_test_YOUR_KEY',
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS     => json_encode([
      'image_ids' => [
        0 => 108876841,
        1 => 108876840,
        2 => 108876839,
      ],
    ]),
]);

$response = json_decode(curl_exec($ch), true);
curl_close($ch);
using System.Net.Http;
using System.Net.Http.Headers;

var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
    new AuthenticationHeaderValue("Bearer", "bk_test_YOUR_KEY");

var request = new HttpRequestMessage(
    new HttpMethod("PUT"),
    "https://sandbox-api.biklo.com/v1/products/711/images/order");

request.Content = new StringContent(
    @"{ ""image_ids"": [ 108876841, 108876840, 108876839 ] }",
    System.Text.Encoding.UTF8,
    "application/json");

var response = await client.SendAsync(request);
var json = await response.Content.ReadAsStringAsync();
import requests

response = requests.put(
    "https://sandbox-api.biklo.com/v1/products/711/images/order",
    headers={"Authorization": "Bearer bk_test_YOUR_KEY"},
    json={
        "image_ids": [
            108876841,
            108876840,
            108876839
        ]
    },
)

data = response.json()
const response = await fetch("https://sandbox-api.biklo.com/v1/products/711/images/order", {
  method: "PUT",
  headers: {
    Authorization: "Bearer bk_test_YOUR_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
      "image_ids": [
          108876841,
          108876840,
          108876839
      ]
  })
});

const data = await response.json();
import java.net.http.*;
import java.net.URI;

var client = HttpClient.newHttpClient();

var request = HttpRequest.newBuilder()
    .uri(URI.create("https://sandbox-api.biklo.com/v1/products/711/images/order"))
    .header("Authorization", "Bearer bk_test_YOUR_KEY")
    .header("Content-Type", "application/json")
    .method("PUT", HttpRequest.BodyPublishers.ofString(
        "{ \"image_ids\": [ 108876841, 108876840, 108876839 ] }"))
    .build();

var response = client.send(request, HttpResponse.BodyHandlers.ofString());