POST
/
v1
/
custom-fields
package main

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

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

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

    res, err := s.CustomFields.Create(ctx, components.CreateCustomFieldCreateSelect(
        components.CustomFieldCreateSelect{
            Slug: "<value>",
            Name: "<value>",
            OrganizationID: polargo.String("1dbfc517-0bbf-4301-9ba8-555ca42b9737"),
            Properties: components.CustomFieldSelectProperties{
                Options: []components.CustomFieldSelectOption{},
            },
        },
    ))
    if err != nil {
        log.Fatal(err)
    }
    if res.CustomField != nil {
        // handle response
    }
}
{
  "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": "1dbfc517-0bbf-4301-9ba8-555ca42b9737",
  "properties": {
    "form_label": "<string>",
    "form_help_text": "<string>",
    "form_placeholder": "<string>",
    "textarea": true,
    "min_length": 1,
    "max_length": 1
  }
}

Authorizations

Authorization
string
header
required

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

Body

application/json

Schema to create a custom field of type text.

Response

201
application/json

Custom field created.

Schema for a custom field of type text.