Organizations

Organizations are the top level resource in Cake Slice - all libraries and attachments roll up under an organization. On this page, we'll dive into the different organization endpoints you can use to manage organizations programmatically. We'll look at how to query and update organizations.

The organization model

Properties

  • Name
    id
    Type
    uuid
    Description

    Unique identifier for the organization.

  • Name
    name
    Type
    string
    Description

    Name of the organization.

  • Name
    subdomain
    Type
    string
    Description

    Subdomain the organization resides under.

  • Name
    created_at
    Type
    timestamp
    Description

    Timestamp of when the organization was created.

  • Name
    updated_at
    Type
    timestamp
    Description

    Timestamp of when the organization was last updated.


GET/v1/organizations/:id

Retrieve an organization

This endpoint allows you to retrieve an organization by providing the organization id. Refer to the list at the top of this page to see which properties are included with message objects.

Optional params

  • Name
    include
    Type
    string
    Description

    A comma separated list of related resources to return in the response. The only valid resource to include for organizations is libraries.

    See the API Overview guide for more details on usage.

  • Name
    fields
    Type
    array
    Description

    Not applicable for organizations.

    See the API Overview guide for more details on usage.

GET
/v1/organizations/:id
const headers  = { "Authorization": `Bearer ${token}` }
const response = await fetch("https://api.cakeslice.com/v1/organizations/:id", { headers })

await response.json()

Response

{
  "data": {
    "id": "abc-def-123",
    "type": "organization",
    "attributes": {
      "name": "ACME, Inc.",
      "subdomain": "acme",
      "created_at": "2025-01-02T21:59:53.433Z",
      "updated_at": "2025-01-02T21:59:53.433Z"
    },
    "relationships": {}
  }
}

PUT/v1/organizations/:id

Update an organization

This endpoint allows you to perform an update on a organization. Examples of updates are editing the name or subdomain.

Optional attributes

  • Name
    name
    Type
    string
    Description

    Name of the organization.

  • Name
    subdomain
    Type
    string
    Description

    Subdomain the organization resides under.

    Warning! Changing this may break any existing hardcoded links to your libraries!

Optional params

  • Name
    include
    Type
    string
    Description

    A comma separated list of related resources to return in the response. The only valid resource to include for organizations is libraries.

    See the API Overview guide for more details on usage.

  • Name
    fields
    Type
    array
    Description

    Not applicable for organizations.

    See the API Overview guide for more details on usage.

PUT
/v1/organizations/:id
const response = await fetch(
  "https://api.cakeslice.com/v1/organizations/:id",
  {
    method: "PUT",
    headers: {
      "Authorization": `Bearer ${token}`
    },
    body: JSON.stringify({
      data: {
        attributes: {
          name: "Updated ACME, Inc."
        }
      }
    })
  }
)

await response.json()

Response

{
  "data": {
    "id": "abc-def-123",
    "type": "organization",
    "attributes": {
      "name": "Updated ACME, Inc.",
      "subdomain": "acme",
      "created_at": "2025-01-02T21:59:53.433Z",
      "updated_at": "2025-01-02T21:59:53.433Z"
    },
    "relationships": {}
  }
}