Attio (Attio v0.2.0)

Copy Markdown View Source

Elixir client for the Attio REST API.

Getting started

Build a client with Attio.Client.new/1 and pass it to the resource module that matches what you want to do:

client = Attio.Client.new(api_key: System.fetch_env!("ATTIO_API_KEY"))

# Fetch a page of people records
{:ok, response} = Attio.Records.list(client, "people")

# Lazily stream all companies across pages
client
|> Attio.Records.stream("companies")
|> Stream.map(& &1["values"]["name"])
|> Enum.to_list()

Resources

ModuleAttio resourceRequired scope
Attio.ObjectsObject schemasobject_configuration:read
Attio.AttributesAttributes on objects/listsobject_configuration:read
Attio.RecordsRecords within objectsrecord_permission:read
Attio.ListsProcess listslist_configuration:read
Attio.EntriesEntries within listslist_entry:read
Attio.NotesNotes on recordsnote:read
Attio.TasksTasks with linked recordstask:read
Attio.MeetingsCalendar meetingsmeeting:read
Attio.WebhooksEvent subscriptionswebhook:read
Attio.WorkspaceMembersWorkspace usersuser_management:read
Attio.ThreadsComment threadscomment:read
Attio.CommentsIndividual commentscomment:read
Attio.MetaAPI token metadata(any)

Error handling

All resource functions return {:ok, response} or {:error, reason}:

  • {:ok, map()} – decoded JSON body of the successful response.
  • {:error, %Attio.Error{}} – an API-level error (4xx/5xx) with :status, :type, :code, and :message fields.
  • {:error, exception} – a transport-level error from the HTTP client.

Pagination

Resources that return lists support cursor-based pagination. All paginated modules expose a stream function that lazily consumes all pages without loading everything into memory at once:

ModuleLazy streamEager list
Attio.Recordsstream/3stream_all/3
Attio.Entriesstream/3stream_all/3
Attio.Notesstream/2stream_all/2
Attio.Tasksstream/2stream_all/2
Attio.Meetingsstream/2stream_all/2
Attio.Threadsstream/2stream_all/2

Use stream when composing with Stream functions or when you only need part of the result set. Use stream_all when you want all pages as a plain {:ok, list}:

{:ok, records} = Attio.Records.stream_all(client, "people")

Attio.Records.stream(client, "people", limit: 100)
|> Stream.take(50)
|> Enum.to_list()

Attribute values

Attribute values in create/update requests and API responses are plain maps keyed by attribute slug. The structure of each value depends on the attribute type. Responses include an "attribute_type" discriminator field on each value.

See the Attio attribute type reference for the full list of value shapes.