curl --request PUT \
--url https://apiv2.gomarketbox.com/v1/projects/{projectId}/suppliers/me/avatar \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"uploadId": "upl_01k2example",
"variantId": "var_01k2example"
}
'import requests
url = "https://apiv2.gomarketbox.com/v1/projects/{projectId}/suppliers/me/avatar"
payload = {
"uploadId": "upl_01k2example",
"variantId": "var_01k2example"
}
headers = {
"x-api-key": "<api-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'x-api-key': '<api-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({uploadId: 'upl_01k2example', variantId: 'var_01k2example'})
};
fetch('https://apiv2.gomarketbox.com/v1/projects/{projectId}/suppliers/me/avatar', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apiv2.gomarketbox.com/v1/projects/{projectId}/suppliers/me/avatar",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'uploadId' => 'upl_01k2example',
'variantId' => 'var_01k2example'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apiv2.gomarketbox.com/v1/projects/{projectId}/suppliers/me/avatar"
payload := strings.NewReader("{\n \"uploadId\": \"upl_01k2example\",\n \"variantId\": \"var_01k2example\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://apiv2.gomarketbox.com/v1/projects/{projectId}/suppliers/me/avatar")
.header("x-api-key", "<api-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"uploadId\": \"upl_01k2example\",\n \"variantId\": \"var_01k2example\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiv2.gomarketbox.com/v1/projects/{projectId}/suppliers/me/avatar")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-api-key"] = '<api-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"uploadId\": \"upl_01k2example\",\n \"variantId\": \"var_01k2example\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"supplierId": "<string>",
"projectId": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"fullName": "<string>",
"email": "<string>",
"languages": [
"<string>"
],
"locales": [
"<string>"
],
"active": true,
"deleted": true,
"createdAt": "<string>",
"updatedAt": "<string>",
"serviceIds": [
"<string>"
],
"skillIds": [
"<string>"
],
"phone": "<string>",
"addressoneline": "<string>",
"street": "<string>",
"city": "<string>",
"state": "<string>",
"country": "<string>",
"postalcode": "<string>",
"longitude": 123,
"latitude": 123,
"timezone": "<string>",
"bio": "<string>",
"maxTravelTime": 123,
"externalId": "<string>",
"externalData": {},
"defaultLocale": "<string>",
"userId": "<string>",
"invitationStatus": "NONE",
"avatar": {
"variantId": "<string>",
"updatedAt": "2023-11-07T05:31:56Z"
},
"avatarUrl": "<string>"
}
}{
"code": "NOT_FOUND",
"message": "Booking not found",
"statusCode": 404,
"requestId": "a3f1c2de-9b64-4a2f-8f0e-5c9d1b7a2e10"
}{
"code": "NOT_FOUND",
"message": "Booking not found",
"statusCode": 404,
"requestId": "a3f1c2de-9b64-4a2f-8f0e-5c9d1b7a2e10"
}{
"code": "NOT_FOUND",
"message": "Booking not found",
"statusCode": 404,
"requestId": "a3f1c2de-9b64-4a2f-8f0e-5c9d1b7a2e10"
}{
"code": "NOT_FOUND",
"message": "Booking not found",
"statusCode": 404,
"requestId": "a3f1c2de-9b64-4a2f-8f0e-5c9d1b7a2e10"
}{
"code": "NOT_FOUND",
"message": "Booking not found",
"statusCode": 404,
"requestId": "a3f1c2de-9b64-4a2f-8f0e-5c9d1b7a2e10"
}Attach the uploaded photo to the signed-in supplier
Step 2 of 2: attaches the uploaded image to the supplier the user token resolves to and returns their profile, in the shape GET /suppliers/me answers, with the new avatarUrl. Pass the variantId from the upload-url call.
Resizing happens after your upload lands, so calling this straight away often returns 400 “Avatar variant not ready yet. Retry shortly.” That is a retry signal: wait a second or two and call again. Confirming a different variantId replaces the current photo and deletes the old images for good; re-confirming the same one is harmless. Requires the API key and the supplier’s user token.
curl --request PUT \
--url https://apiv2.gomarketbox.com/v1/projects/{projectId}/suppliers/me/avatar \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"uploadId": "upl_01k2example",
"variantId": "var_01k2example"
}
'import requests
url = "https://apiv2.gomarketbox.com/v1/projects/{projectId}/suppliers/me/avatar"
payload = {
"uploadId": "upl_01k2example",
"variantId": "var_01k2example"
}
headers = {
"x-api-key": "<api-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'x-api-key': '<api-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({uploadId: 'upl_01k2example', variantId: 'var_01k2example'})
};
fetch('https://apiv2.gomarketbox.com/v1/projects/{projectId}/suppliers/me/avatar', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apiv2.gomarketbox.com/v1/projects/{projectId}/suppliers/me/avatar",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'uploadId' => 'upl_01k2example',
'variantId' => 'var_01k2example'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apiv2.gomarketbox.com/v1/projects/{projectId}/suppliers/me/avatar"
payload := strings.NewReader("{\n \"uploadId\": \"upl_01k2example\",\n \"variantId\": \"var_01k2example\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://apiv2.gomarketbox.com/v1/projects/{projectId}/suppliers/me/avatar")
.header("x-api-key", "<api-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"uploadId\": \"upl_01k2example\",\n \"variantId\": \"var_01k2example\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiv2.gomarketbox.com/v1/projects/{projectId}/suppliers/me/avatar")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-api-key"] = '<api-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"uploadId\": \"upl_01k2example\",\n \"variantId\": \"var_01k2example\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"supplierId": "<string>",
"projectId": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"fullName": "<string>",
"email": "<string>",
"languages": [
"<string>"
],
"locales": [
"<string>"
],
"active": true,
"deleted": true,
"createdAt": "<string>",
"updatedAt": "<string>",
"serviceIds": [
"<string>"
],
"skillIds": [
"<string>"
],
"phone": "<string>",
"addressoneline": "<string>",
"street": "<string>",
"city": "<string>",
"state": "<string>",
"country": "<string>",
"postalcode": "<string>",
"longitude": 123,
"latitude": 123,
"timezone": "<string>",
"bio": "<string>",
"maxTravelTime": 123,
"externalId": "<string>",
"externalData": {},
"defaultLocale": "<string>",
"userId": "<string>",
"invitationStatus": "NONE",
"avatar": {
"variantId": "<string>",
"updatedAt": "2023-11-07T05:31:56Z"
},
"avatarUrl": "<string>"
}
}{
"code": "NOT_FOUND",
"message": "Booking not found",
"statusCode": 404,
"requestId": "a3f1c2de-9b64-4a2f-8f0e-5c9d1b7a2e10"
}{
"code": "NOT_FOUND",
"message": "Booking not found",
"statusCode": 404,
"requestId": "a3f1c2de-9b64-4a2f-8f0e-5c9d1b7a2e10"
}{
"code": "NOT_FOUND",
"message": "Booking not found",
"statusCode": 404,
"requestId": "a3f1c2de-9b64-4a2f-8f0e-5c9d1b7a2e10"
}{
"code": "NOT_FOUND",
"message": "Booking not found",
"statusCode": 404,
"requestId": "a3f1c2de-9b64-4a2f-8f0e-5c9d1b7a2e10"
}{
"code": "NOT_FOUND",
"message": "Booking not found",
"statusCode": 404,
"requestId": "a3f1c2de-9b64-4a2f-8f0e-5c9d1b7a2e10"
}Authorizations
API key minted in the MarketBox dashboard. Scope is restricted to the projects you select at creation time. Every route needs the key's standard API access (*) except POST /v1/projects/{projectId}/events, which needs events:write; a key without * is refused with 403 CAPABILITY_NOT_GRANTED.
Path Parameters
Body
The uploaded image