POST
/
api
/
v1
/
collections
Create a collection
curl --request POST \
  --url https://api.pexafy.com/api/v1/collections \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "name": "<string>",
  "description": "<string>",
  "is_public": false
}
'
import requests

url = "https://api.pexafy.com/api/v1/collections"

payload = {
"name": "<string>",
"description": "<string>",
"is_public": False
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', description: '<string>', is_public: false})
};

fetch('https://api.pexafy.com/api/v1/collections', 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://api.pexafy.com/api/v1/collections",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'is_public' => false
]),
CURLOPT_HTTPHEADER => [
"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://api.pexafy.com/api/v1/collections"

payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"is_public\": false\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("x-api-key", "<api-key>")
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.post("https://api.pexafy.com/api/v1/collections")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"is_public\": false\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.pexafy.com/api/v1/collections")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"is_public\": false\n}"

response = http.request(request)
puts response.read_body
{
  "success": true,
  "data": {
    "id": 42,
    "name": "Winter wildlife",
    "description": "Foxes and snowy landscapes for the January newsletter",
    "is_public": false,
    "cover_photo_id": "",
    "created_at": "2026-10-14T09:12:33.481920+00:00",
    "updated_at": "2026-10-14T09:12:33.481920+00:00",
    "photos_count": 0
  },
  "meta": {
    "request_id": "9197c51a-6c06-4ce4-8193-892d437bc8f5",
    "took_ms": 9.47
  },
  "error": null
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

Authorizations

x-api-key
string
header
required

Pass your Pexafy API key in this header.

Get your API key at pexafy.com/dashboard/api-keys/create.

Body

application/json
name
string
required
Required string length: 1 - 255
description
string | null
Maximum string length: 1000
is_public
boolean
default:false

Response

Successful Response

success
boolean
data
object
meta
object
error
object | null