Attio

Test StatusCoverage StatusHex VersionHex Docs

An Elixir client for the Attio REST API.

Installation

Add attio to your dependencies in mix.exs:

def deps do
[
{:attio, "~> 0.3.1"}
]
end

Usage

client = Attio.Client.new(api_key: System.fetch_env!("ATTIO_API_KEY"))
# List people
{:ok, response} = Attio.Records.list(client, "people")
# Stream all companies across pages
companies =
client
|> Attio.Records.stream("companies")
|> Enum.to_list()
# Create a person record
{:ok, record} =
Attio.Records.create(client, "people", %{
"name" => [%{"first_name" => "Alice", "last_name" => "Smith"}],
"email_addresses" => [%{"email_address" => "alice@example.com"}]
})
# Upsert (assert) a record
{:ok, %{"action" => action}} =
Attio.Records.assert(client, "people", %{
"email_addresses" => [%{"email_address" => "alice@example.com"}]
})

All functions return {:ok, response} or {:error, %Attio.Error{}}. See the Attio module for a full resource reference and the Attio API docs for attribute value formats.

Development

Prerequisites

This project targets Elixir ~> 1.17 and OTP 25–28. The exact versions used for development are pinned in .tool-versions:

If you use asdf or mise, the correct versions will be selected automatically.

Getting started

mix deps.get # fetch dependencies
mix test # run the test suite

Code quality

mix format # auto-format source files
mix format --check-formatted # check formatting (run by CI)
mix credo --strict # static analysis
mix dialyzer # type analysis (run by CI; first run builds the PLT)

Generating documentation

mix docs

Open doc/index.html in a browser to preview the generated site.

License

Attio is released under the BSD 2-Clause license.