Create Product - Polar

Documentation Index

Fetch the complete documentation index at: /docs/llms.txt

Use this file to discover all available pages before exploring further.

POST

https://api.polar.shhttps://sandbox-api.polar.sh

/v1/products

Try it

Python

from polar.v2026_04 import Polar

polar = Polar("polar_oat_xxx")

response = polar.products.create(
    name='string',
    prices=[{'amount_type': 'fixed', 'price_amount': 0}],
    recurring_interval='day',
    recurring_interval_count=1,
)
print(response)

JavaScript (ES6)

import { createPolar } from "@polar-sh/sdk/2026-04";

const polar = createPolar({
  accessToken: "polar_oat_xxx",
});

const response = await polar.products.create(
  {
    "name": "string",
    "prices": [
      {
        "amount_type": "fixed",
        "price_amount": 0
      }
    ],
    "recurring_interval": "day",
    "recurring_interval_count": 1
  },
);
console.log(response);

cURL

curl --request POST \
  --url https://api.polar.sh/v1/products/ \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "prices": [
    {
      "amount_type": "fixed",
      "price_amount": 1,
      "price_currency": "usd"
    }
  ],
  "metadata": {},
  "description": "<string>",
  "visibility": "public",
  "medias": [
    "<string>"
  ],
  "attached_custom_fields": [
    {
      "custom_field_id": "<string>",
      "required": true
    }
  ],
  "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737",
  "trial_interval_count": 500,
  "recurring_interval_count": 1,
  "meter_interval_count": 500
}
'

JavaScript Fetch

const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    name: '<string>',
    prices: [{amount_type: 'fixed', price_amount: 1, price_currency: 'usd'}],
    metadata: {},
    description: '<string>',
    visibility: 'public',
    medias: ['<string>'],
    attached_custom_fields: [{custom_field_id: '<string>', required: true}],
    organization_id: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',
    trial_interval_count: 500,
    recurring_interval_count: 1,
    meter_interval_count: 500
  })
};

fetch('https://api.polar.sh/v1/products/', 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.polar.sh/v1/products/",
  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>',
    'prices' => [
        [
                'amount_type' => 'fixed',
                'price_amount' => 1,
                'price_currency' => 'usd'
        ]
    ],
    'metadata' => [],
    'description' => '<string>',
    'visibility' => 'public',
    'medias' => ['<string>'],
    'attached_custom_fields' => [
        [
                'custom_field_id' => '<string>',
                'required' => true
        ]
    ],
    'organization_id' => '1dbfc517-0bbf-4301-9ba8-555ca42b9737',
    'trial_interval_count' => 500,
    'recurring_interval_count' => 1,
    'meter_interval_count' => 500
  ]),
  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;
}

Go

package main

import (
    "fmt"
    "strings"
    "net/http"
    "io"
)

func main() {

url := "https://api.polar.sh/v1/products/"

payload := strings.NewReader("{\n  \"name\": \"<string>\",\n  \"prices\": [\n    {\n      \"amount_type\": \"fixed\",\n      \"price_amount\": 1,\n      \"price_currency\": \"usd\"\n    }\n  ],\n  \"metadata\": {},\n  \"description\": \"<string>\",\n  \"visibility\": \"public\",\n  \"medias\": [\n    \"<string>\"\n  ],\n  \"attached_custom_fields\": [\n    {\n      \"custom_field_id\": \"<string>\",\n      \"required\": true\n    }\n  ],\n  \"organization_id\": \"1dbfc517-0bbf-4301-9ba8-555ca42b9737\",\n  \"trial_interval_count\": 500,\n  \"recurring_interval_count\": 1,\n  \"meter_interval_count\": 500\}")

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))
}

Example Response

{
  "id": "<string>",
  "created_at": "2026-01-01T00:00:00.000000Z",
  "modified_at": "2026-01-01T00:00:00.000000Z",
  "trial_interval": "day",
  "trial_interval_count": 123,
  "name": "<string>",
  "description": "<string>",
  "visibility": "draft",
  "recurring_interval": "day",
  "recurring_interval_count": 123,
  "meter_interval": "day",
  "meter_interval_count": 123,
  "is_recurring": true,
  "is_archived": true,
  "organization_id": "<string>",
  "metadata": {},
  "prices": [
    {
      "created_at": "2026-01-01T00:00:00.000000Z",
      "modified_at": "2026-01-01T00:00:00.000000Z",
      "id": "<string>",
      "source": "catalog",
      "amount_type": "fixed",
      "price_currency": "<string>",
      "tax_behavior": "location",
      "is_archived": true,
      "product_id": "<string>",
      "type": "recurring",
      "recurring_interval": "day",
      "price_amount": 123,
      "legacy": true
    }
  ],
  "benefits": [
    {
      "id": "<string>",
      "created_at": "2026-01-01T00:00:00.000000Z",
      "modified_at": "2026-01-01T00:00:00.000000Z",
      "type": "custom",
      "description": "<string>",
      "selectable": true,
      "deletable": true,
      "is_deleted": true,
      "organization_id": "<string>",
      "metadata": {},
      "visibility": "draft",
      "properties": {
        "note": "<string>"
      },
      "visibility_configurable": true
    }
  ],
  "medias": [
    {
      "id": "<string>",
      "organization_id": "<string>",
      "name": "<string>",
      "path": "<string>",
      "mime_type": "<string>",
      "size": 123,
      "storage_version": "<string>",
      "checksum_etag": "<string>",
      "checksum_sha256_base64": "<string>",
      "checksum_sha256_hex": "<string>",
      "last_modified_at": "2026-01-01T00:00:00.000000Z",
      "version": "<string>",
      "service": "product_media",
      "is_uploaded": true,
      "created_at": "2026-01-01T00:00:00.000000Z",
      "size_readable": "<string>",
      "public_url": "<string>"
    }
  ],
  "attached_custom_fields": [
    {
      "custom_field_id": "<string>",
      "custom_field": {
        "created_at": "2026-01-01T00:00:00.000000Z",
        "modified_at": "2026-01-01T00:00:00.000000Z",
        "id": "<string>",
        "metadata": {},
        "type": "text",
        "slug": "<string>",
        "name": "<string>",
        "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737",
        "properties": {
          "form_label": "<string>",
          "form_help_text": "<string>",
          "form_placeholder": "<string>",
          "textarea": true,
          "min_length": 1073741823,
          "max_length": 1073741823
        }
      },
      "order": 123,
      "required": true
    }
  ]
}

Error Response

{
  "detail": [
    {
      "loc": [
        "<string>"
      ],
      "msg": "<string>",
      "type": "<string>",
      "input": "<unknown>",
      "ctx": {}
    }
  ]
}