PATCH
/
v1
/
custom-fields
/
{id}
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.Update(ctx, "<value>", components.CreateCustomFieldUpdateNumber(
        components.CustomFieldUpdateNumber{},
    ))
    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": "<string>",
  "properties": {
    "form_label": "<string>",
    "form_help_text": "<string>",
    "form_placeholder": "<string>",
    "textarea": true,
    "min_length": 1,
    "max_length": 1
  }
}

Authorizations

Authorization
string
header
required

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

Path Parameters

id
string
required

The custom field ID.

Body

application/json

Schema to update a custom field of type text.

type
string
required
Allowed value: "text"
metadata
object | null

Key-value object allowing you to store additional information.

The key must be a string with a maximum length of 40 characters. The value must be either:

  • A string with a maximum length of 500 characters
  • An integer
  • A boolean

You can store up to 50 key-value pairs.

name
string | null

Name of the custom field.

Minimum length: 1
slug
string | null

Identifier of the custom field. It'll be used as key when storing the value. Must be unique across the organization.It can only contain ASCII letters, numbers and hyphens.

Minimum length: 1
properties
object | null

Response

200
application/json
Custom field updated.

Schema for a custom field of type text.

created_at
string
required

Creation timestamp of the object.

modified_at
string | null
required

Last modification timestamp of the object.

id
string
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
required

The ID of the organization owning the custom field.

properties
object
required