GET
/
v1
/
products
package main

import(
	"context"
	"os"
	polargo "github.com/polarsource/polar-go"
	"github.com/polarsource/polar-go/models/operations"
	"log"
)

func main() {
    ctx := context.Background()
    
    s := polargo.New(
        polargo.WithSecurity(os.Getenv("POLAR_ACCESS_TOKEN")),
    )

    res, err := s.Products.List(ctx, operations.ProductsListRequest{})
    if err != nil {
        log.Fatal(err)
    }
    if res.ListResourceProduct != nil {
        for {
            // handle items

            res, err = res.Next()

            if err != nil {
                // handle error
            }

            if res == nil {
                break
            }
        }
    }
}
{
  "items": [
    {
      "created_at": "2023-11-07T05:31:56Z",
      "modified_at": "2023-11-07T05:31:56Z",
      "id": "<string>",
      "name": "<string>",
      "description": "<string>",
      "recurring_interval": "month",
      "is_recurring": true,
      "is_archived": true,
      "organization_id": "<string>",
      "metadata": {},
      "prices": [
        {
          "created_at": "2023-11-07T05:31:56Z",
          "modified_at": "2023-11-07T05:31:56Z",
          "id": "<string>",
          "amount_type": "<string>",
          "is_archived": true,
          "product_id": "<string>",
          "type": "<string>",
          "recurring_interval": "month",
          "price_currency": "<string>",
          "price_amount": 123,
          "legacy": true
        }
      ],
      "benefits": [
        {
          "created_at": "2023-11-07T05:31:56Z",
          "modified_at": "2023-11-07T05:31:56Z",
          "id": "<string>",
          "type": "<string>",
          "description": "<string>",
          "selectable": true,
          "deletable": true,
          "organization_id": "<string>",
          "properties": {
            "image_height": 400,
            "image_width": 400
          }
        }
      ],
      "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": "2023-11-07T05:31:56Z",
          "version": "<string>",
          "service": "<string>",
          "is_uploaded": true,
          "created_at": "2023-11-07T05:31:56Z",
          "size_readable": "<string>",
          "public_url": "<string>"
        }
      ],
      "attached_custom_fields": [
        {
          "custom_field_id": "<string>",
          "custom_field": {
            "created_at": "2023-11-07T05:31:56Z",
            "modified_at": "2023-11-07T05:31:56Z",
            "id": "<string>",
            "metadata": {},
            "type": "<string>",
            "slug": "<string>",
            "name": "<string>",
            "organization_id": "<string>",
            "properties": {
              "form_label": "<string>",
              "form_help_text": "<string>",
              "form_placeholder": "<string>",
              "textarea": true,
              "min_length": 1,
              "max_length": 1
            }
          },
          "order": 123,
          "required": true
        }
      ]
    }
  ],
  "pagination": {
    "total_count": 123,
    "max_page": 123
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

id

Filter by product ID.

organization_id

Filter by organization ID.

query
string | null

Filter by product name.

is_archived
boolean | null

Filter on archived products.

is_recurring
boolean | null

Filter on recurring products. If true, only subscriptions tiers are returned. If false, only one-time purchase products are returned.

benefit_id

Filter products granting specific benefit.

page
integer
default:
1

Page number, defaults to 1.

Required range: x > 0
limit
integer
default:
10

Size of a page, defaults to 10. Maximum is 100.

Required range: x > 0
sorting
enum<string>[] | null

Sorting criterion. Several criteria can be used simultaneously and will be applied in order. Add a minus sign - before the criteria name to sort by descending order.

Available options:
created_at,
-created_at,
name,
-name,
price_amount_type,
-price_amount_type,
price_amount,
-price_amount

Response

200
application/json
Successful Response
items
object[]
required
pagination
object
required

Was this page helpful?