0

List record attribute values

by
Published Oct 17, 2025

Gets all values for a given attribute on a record. If the attribute is historic, this endpoint has the ability to return all historic values using the `show_historic` query param. Required scopes: `record_permission:read`, `object_configuration:read`.

Script attio Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Attio = {
3
  token: string;
4
};
5
/**
6
 * List record attribute values
7
 * Gets all values for a given attribute on a record. If the attribute is historic, this endpoint has the ability to return all historic values using the `show_historic` query param.
8

9
Required scopes: `record_permission:read`, `object_configuration:read`.
10
 */
11
export async function main(
12
  auth: Attio,
13
  object: string,
14
  record_id: string,
15
  attribute: string,
16
  show_historic: string | undefined,
17
  limit: string | undefined,
18
  offset: string | undefined,
19
) {
20
  const url = new URL(
21
    `https://api.attio.com/v2/objects/${object}/records/${record_id}/attributes/${attribute}/values`,
22
  );
23
  for (const [k, v] of [
24
    ["show_historic", show_historic],
25
    ["limit", limit],
26
    ["offset", offset],
27
  ]) {
28
    if (v !== undefined && v !== "" && k !== undefined) {
29
      url.searchParams.append(k, v);
30
    }
31
  }
32
  const response = await fetch(url, {
33
    method: "GET",
34
    headers: {
35
      Authorization: "Bearer " + auth.token,
36
    },
37
    body: undefined,
38
  });
39
  if (!response.ok) {
40
    const text = await response.text();
41
    throw new Error(`${response.status} ${text}`);
42
  }
43
  return await response.json();
44
}
45