Skip to main content
POST
/
posts
Publish a post
curl --request POST \
  --url https://api.budgetpixel.com/v1/posts \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "media": [
    {
      "file": "<string>",
      "model": "<string>",
      "prompt": "<string>"
    }
  ],
  "content": "<string>",
  "genre": "<string>",
  "lyrics": "<string>",
  "song_name": "<string>"
}
'
import requests

url = "https://api.budgetpixel.com/v1/posts"

payload = {
    "media": [
        {
            "file": "<string>",
            "model": "<string>",
            "prompt": "<string>"
        }
    ],
    "content": "<string>",
    "genre": "<string>",
    "lyrics": "<string>",
    "song_name": "<string>"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.text)
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    media: [{file: '<string>', model: '<string>', prompt: '<string>'}],
    content: '<string>',
    genre: '<string>',
    lyrics: '<string>',
    song_name: '<string>'
  })
};

fetch('https://api.budgetpixel.com/v1/posts', 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.budgetpixel.com/v1/posts",
  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([
    'media' => [
        [
                'file' => '<string>',
                'model' => '<string>',
                'prompt' => '<string>'
        ]
    ],
    'content' => '<string>',
    'genre' => '<string>',
    'lyrics' => '<string>',
    'song_name' => '<string>'
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json"
  ],
]);

$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.budgetpixel.com/v1/posts"

	payload := strings.NewReader("{\n  \"media\": [\n    {\n      \"file\": \"<string>\",\n      \"model\": \"<string>\",\n      \"prompt\": \"<string>\"\n    }\n  ],\n  \"content\": \"<string>\",\n  \"genre\": \"<string>\",\n  \"lyrics\": \"<string>\",\n  \"song_name\": \"<string>\"\n}")

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

	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.post("https://api.budgetpixel.com/v1/posts")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"media\": [\n    {\n      \"file\": \"<string>\",\n      \"model\": \"<string>\",\n      \"prompt\": \"<string>\"\n    }\n  ],\n  \"content\": \"<string>\",\n  \"genre\": \"<string>\",\n  \"lyrics\": \"<string>\",\n  \"song_name\": \"<string>\"\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.budgetpixel.com/v1/posts")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"media\": [\n    {\n      \"file\": \"<string>\",\n      \"model\": \"<string>\",\n      \"prompt\": \"<string>\"\n    }\n  ],\n  \"content\": \"<string>\",\n  \"genre\": \"<string>\",\n  \"lyrics\": \"<string>\",\n  \"song_name\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "credits_charged": 10,
  "id": 123,
  "moderation": "pending",
  "url": "https://budgetpixel.com/p/12345"
}
{
  "error": {
    "code": "model_not_available",
    "message": "<string>",
    "type": "invalid_request_error"
  }
}
{
  "error": {
    "code": "model_not_available",
    "message": "<string>",
    "type": "invalid_request_error"
  }
}
{
  "error": {
    "code": "model_not_available",
    "message": "<string>",
    "type": "invalid_request_error"
  }
}
{
  "error": {
    "code": "model_not_available",
    "message": "<string>",
    "type": "invalid_request_error"
  }
}
{
  "error": {
    "code": "model_not_available",
    "message": "<string>",
    "type": "invalid_request_error"
  }
}
{
  "error": {
    "code": "model_not_available",
    "message": "<string>",
    "type": "invalid_request_error"
  }
}

Authorizations

Authorization
string
header
required

API key as a bearer token: Authorization: Bearer bpx_live_xxx

Body

application/json
media
object[]
required

The post's media items, in display order. One of: 1-6 images; OR exactly 1 video plus up to 3 images; OR exactly 1 audio file (audio can't mix with other media).

Required array length: 1 - 6 elements
content
string

Optional caption (max 2000 characters).

genre
string

Audio posts only — must be one of the site's music genres.

lyrics
string

Audio posts only.

song_name
string

Audio posts only — track title.

Response

Post published.

A published post.

credits_charged
integer
Example:

10

id
integer

The post id.

media_type
enum<string>
Available options:
image,
video,
audio
moderation
string

Image/video posts are rated after publish; feed visibility follows the review.

Example:

"pending"

url
string<uri>

Public URL of the post.

Example:

"https://budgetpixel.com/p/12345"