Skip to main content
GET
/
v1
/
custom-fields
/
{id}
Go (SDK)
package main

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

func main() {
    ctx := context.Background()

    s := polargo.New(
        polargo.WithSecurity(os.Getenv("POLAR_ACCESS_TOKEN")),
    )

    res, err := s.CustomFields.Get(ctx, "<value>")
    if err != nil {
        log.Fatal(err)
    }
    if res.CustomField != nil {
        switch res.CustomField.Type {
            case components.CustomFieldUnionTypeCheckbox:
                // res.CustomField.CustomFieldCheckbox is populated
            case components.CustomFieldUnionTypeDate:
                // res.CustomField.CustomFieldDate is populated
            case components.CustomFieldUnionTypeNumber:
                // res.CustomField.CustomFieldNumber is populated
            case components.CustomFieldUnionTypeSelect:
                // res.CustomField.CustomFieldSelect is populated
            case components.CustomFieldUnionTypeText:
                // res.CustomField.CustomFieldText is populated
        }

    }
}
{
  "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": 1073741823,
    "max_length": 1073741823
  }
}

Documentation Index

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

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

Authorizations

Authorization
string
header
required

You can generate an Organization Access Token from your organization's settings.

Path Parameters

id
string<uuid4>
required

The custom field ID.

Response

Successful Response

Schema for a custom field of type text.

created_at
string<date-time>
required

Creation timestamp of the object.

modified_at
string<date-time> | null
required

Last modification timestamp of the object.

id
string<uuid4>
required

The ID of the object.

metadata
object
required
type
string
required
Allowed value: "text"
slug
string
required

Identifier of the custom field. It'll be used as key when storing the value.

name
string
required

Name of the custom field.

organization_id
string<uuid4>
required

The ID of the organization owning the custom field.

Example:

"1dbfc517-0bbf-4301-9ba8-555ca42b9737"

properties
CustomFieldTextProperties · object
required