Skip to content
Get started

Retrieves the current account for the token accessing the API

client.Account.Get(ctx) (*Account, error)
GET/v1/account

Retrieves the current account for the token accessing the API. Useful to check if the credentials are valid.

ReturnsExpand Collapse
type Account struct{…}

An account, the top-level organizational unit. Contains workspaces and account-wide settings such as the webhook signing secret.

Server-populated information about the account.

GlobalAPIKey APIKeyOptional

An API key for the account. Use workspace-association RPCs to grant the key access to specific workspaces; a key with zero workspaces is valid but cannot access workspace-scoped resources.

AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace.

ID string

Unique identifier for the resource (prefixed ULID, e.g., “apikey_01HXK…”)

AccountID string

Account this resource belongs to for multi-tenant isolation (prefixed ULID)

Name string

Human-readable name for the resource (e.g., “Customer Support Agent”, “Email Tool”) Required for resources that users interact with directly

ProfileID string
ExternalID stringOptional

External ID for the resource (e.g., a workflow ID from an external system)

Labels map[string, string]Optional

Arbitrary key-value pairs for categorization and filtering Examples: {“environment”: “production”, “team”: “platform”, “version”: “v2”}

Configuration for an API key.

Token stringOptional

The bearer token used to authenticate as this API key. Returned only on creation and rotation; subsequent reads omit this field.

Description stringOptional

Free-form description of what this API key is used for.

Permissions []stringOptional

Permissions granted to this key. Each entry is a colon-separated verb:resource string (e.g. “manage:agents”). Currently has no enforced effect; reserved for future fine-grained authorization.

System boolOptional

True when this key is managed by the system (e.g. the auto-provisioned global account key). System keys cannot be deleted but can be rotated.

Info APIKeyInfoOptional
CreatedBy ProfileOptional

A profile identifies a user or non-human principal (such as an API key) at the account level. Profiles are account-scoped and can be granted access to multiple workspaces.

AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace.

ID string

Unique identifier for the resource (prefixed ULID, e.g., “apikey_01HXK…”)

AccountID string

Account this resource belongs to for multi-tenant isolation (prefixed ULID)

Name string

Human-readable name for the resource (e.g., “Customer Support Agent”, “Email Tool”) Required for resources that users interact with directly

ProfileID string
ExternalID stringOptional

External ID for the resource (e.g., a workflow ID from an external system)

Labels map[string, string]Optional

Arbitrary key-value pairs for categorization and filtering Examples: {“environment”: “production”, “team”: “platform”, “version”: “v2”}

Configuration for a profile.

Type ProfileSpecType

Whether this profile represents a human user, an API key, or a system principal.

formatenum
One of the following:
const ProfileSpecTypeProfileTypeUnspecified ProfileSpecType = "PROFILE_TYPE_UNSPECIFIED"
const ProfileSpecTypeProfileTypeUser ProfileSpecType = "PROFILE_TYPE_USER"
const ProfileSpecTypeProfileTypeAPIKey ProfileSpecType = "PROFILE_TYPE_API_KEY"
const ProfileSpecTypeProfileTypeSystem ProfileSpecType = "PROFILE_TYPE_SYSTEM"
Email stringOptional

Email address of the profile. Required and unique within an account for user profiles.

Name stringOptional

Display name (e.g., “Bobby Tables”).

WorkspacesPreview []BareMetadataOptional

Up to a small number of workspaces this key has access to, intended for display (“Workspace 1, Workspace 2, and 4 more”). Use ListAPIKeyWorkspaces for the full paginated list.

ID stringOptional
Name stringOptional

Human-readable name of the referenced resource, populated by the server on reads for convenience. Absent on references to resources that do not have a name (e.g., objective tasks).

WorkspacesTotal int64Optional

Total number of workspaces this key has access to.

formatint32
WebhookEventsHmacSecret stringOptional

The generated secret that will sign all webhooks that are sent to your configured Webhook URL. Formatted as “wh_asdf1234” per the https://www.standardwebhooks.com/ format.

AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace.

ID string

Unique identifier for the resource (prefixed ULID, e.g., “apikey_01HXK…”)

AccountID string

Account this resource belongs to for multi-tenant isolation (prefixed ULID)

Name string

Human-readable name for the resource (e.g., “Customer Support Agent”, “Email Tool”) Required for resources that users interact with directly

ProfileID string
ExternalID stringOptional

External ID for the resource (e.g., a workflow ID from an external system)

Labels map[string, string]Optional

Arbitrary key-value pairs for categorization and filtering Examples: {“environment”: “production”, “team”: “platform”, “version”: “v2”}

Configuration for an account.

BillingEmail stringOptional
Description stringOptional
Domain stringOptional
Workspaces []WorkspaceOptional

AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace.

ID string

Unique identifier for the resource (prefixed ULID, e.g., “apikey_01HXK…”)

AccountID string

Account this resource belongs to for multi-tenant isolation (prefixed ULID)

Name string

Human-readable name for the resource (e.g., “Customer Support Agent”, “Email Tool”) Required for resources that users interact with directly

ProfileID string
ExternalID stringOptional

External ID for the resource (e.g., a workflow ID from an external system)

Labels map[string, string]Optional

Arbitrary key-value pairs for categorization and filtering Examples: {“environment”: “production”, “team”: “platform”, “version”: “v2”}

Description stringOptional
Status WorkspaceStatusOptional

Lifecycle status of the workspace. Archived workspaces reject all requests scoped to them. Server-populated.

formatenum
One of the following:
const WorkspaceStatusStatusEnabled WorkspaceStatus = "STATUS_ENABLED"
const WorkspaceStatusStatusDisabled WorkspaceStatus = "STATUS_DISABLED"
const WorkspaceStatusStatusArchived WorkspaceStatus = "STATUS_ARCHIVED"

Retrieves the current account for the token accessing the API

package main

import (
  "context"
  "fmt"

  "github.com/cadenya/cadenya-go"
  "github.com/cadenya/cadenya-go/option"
)

func main() {
  client := cadenya.NewClient(
    option.WithAPIKey("My API Key"),
  )
  account, err := client.Account.Get(context.TODO())
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", account.Info)
}
{
  "info": {
    "globalApiKey": {
      "metadata": {
        "id": "id",
        "accountId": "accountId",
        "name": "name",
        "profileId": "profileId",
        "externalId": "externalId",
        "labels": {
          "foo": "string"
        }
      },
      "spec": {
        "token": "token",
        "description": "description",
        "permissions": [
          "string"
        ],
        "system": true
      },
      "info": {
        "createdBy": {
          "metadata": {
            "id": "id",
            "accountId": "accountId",
            "name": "name",
            "profileId": "profileId",
            "externalId": "externalId",
            "labels": {
              "foo": "string"
            }
          },
          "spec": {
            "type": "PROFILE_TYPE_UNSPECIFIED",
            "email": "email",
            "name": "name"
          }
        },
        "workspacesPreview": [
          {
            "id": "id",
            "name": "name"
          }
        ],
        "workspacesTotal": 0
      }
    },
    "webhookEventsHmacSecret": "webhookEventsHmacSecret"
  },
  "metadata": {
    "id": "id",
    "accountId": "accountId",
    "name": "name",
    "profileId": "profileId",
    "externalId": "externalId",
    "labels": {
      "foo": "string"
    }
  },
  "spec": {
    "billingEmail": "billingEmail",
    "description": "description",
    "domain": "domain",
    "workspaces": [
      {
        "metadata": {
          "id": "id",
          "accountId": "accountId",
          "name": "name",
          "profileId": "profileId",
          "externalId": "externalId",
          "labels": {
            "foo": "string"
          }
        },
        "spec": {
          "description": "description"
        },
        "status": "STATUS_ENABLED"
      }
    ]
  }
}
Returns Examples
{
  "info": {
    "globalApiKey": {
      "metadata": {
        "id": "id",
        "accountId": "accountId",
        "name": "name",
        "profileId": "profileId",
        "externalId": "externalId",
        "labels": {
          "foo": "string"
        }
      },
      "spec": {
        "token": "token",
        "description": "description",
        "permissions": [
          "string"
        ],
        "system": true
      },
      "info": {
        "createdBy": {
          "metadata": {
            "id": "id",
            "accountId": "accountId",
            "name": "name",
            "profileId": "profileId",
            "externalId": "externalId",
            "labels": {
              "foo": "string"
            }
          },
          "spec": {
            "type": "PROFILE_TYPE_UNSPECIFIED",
            "email": "email",
            "name": "name"
          }
        },
        "workspacesPreview": [
          {
            "id": "id",
            "name": "name"
          }
        ],
        "workspacesTotal": 0
      }
    },
    "webhookEventsHmacSecret": "webhookEventsHmacSecret"
  },
  "metadata": {
    "id": "id",
    "accountId": "accountId",
    "name": "name",
    "profileId": "profileId",
    "externalId": "externalId",
    "labels": {
      "foo": "string"
    }
  },
  "spec": {
    "billingEmail": "billingEmail",
    "description": "description",
    "domain": "domain",
    "workspaces": [
      {
        "metadata": {
          "id": "id",
          "accountId": "accountId",
          "name": "name",
          "profileId": "profileId",
          "externalId": "externalId",
          "labels": {
            "foo": "string"
          }
        },
        "spec": {
          "description": "description"
        },
        "status": "STATUS_ENABLED"
      }
    ]
  }
}