Built-in Types

Polar's built-in types

Unlike many logic programming languages, Polar uses explicitly typed data.

When you first open a Polar policy, there are two classes of types available to you.

PrimitiveRepresents literal values, such as numbers.
AbstractRepresents a type that you want to represent in your authorization policy, such as users and organizations.

Note that this page only discusses built-in types. Most of the authorization policy you write will be in terms of your own types, modeled as resource blocks.

Primitive types

Polar supports the following primitive types.

StringString of text"a"
Integer64-bit signed integer-3
Booleantrue or false valuestrue

You can use these values in rule parameters or facts, e.g.

is_string_a(x: String) if x = "a";

Common uses of String

Polar resource blocks documentation contains more details but, by convention, Polar represents the names of permissions, roles, and relation using String values.

Object literal representation

In addition to the typical literal representation, you can also express primitive values as object literals by using their type name (e.g. Boolean) followed by a literal value of the appropriate type (e.g. true) surrounded by curly brackets ({}), e.g.


This notation has no semantic effect on the policy.

Abstract types

Polar provides the following abstract types to help you express the two primary types of objects involved in an authorization policy.

ResourceAn object to which you want to authorize types of access. Identify subtypes with the resource keyword.
ActorAn entity to whom you want to grant types of access. Identify subtypes with the actor keyword.

To create your own types, you will extend these abstracts using resource blocks.


Abstract types' purpose is to support polymorphism for your policy's resources. To better understand polymorphism in Polar, see the documentation for extends.

Among Polar's built-in types, the following polymorphic relationships exist:


Object literal representation

You should never represent abstract types as object literals, e.g. never use Resource{"foo"}.

Up next

Talk to an Oso Engineer

If you want to learn more about Polar, schedule a 1x1 with an Oso engineer. We're happy to help.

Get started with Oso Cloud →