Attio
Attio
Connect Attio so your agents can look up people, companies, deals and any custom object in your CRM. They can search and filter records, read lists and pipelines, and catch up on a customer's notes, tasks, comment threads, meetings, call recordings, email history and files, for example to prepare for a call, summarize an account or find stalled deals.
Access is read-only: agents cannot create, edit or delete anything in Attio. They see exactly what your Attio API key's scopes allow, and email message bodies are never available. API keys are available on every Attio plan.
Setup instructions
Setup instructions
Connect Attio
-
As a workspace admin, open Workspace settings → Developers → New access token.
-
Give the token Read scopes for the data agents need; leave write scopes off:
Data Scopes Records and objects record_permission,object_configurationLists list_entry,list_configurationNotes, tasks, comments note,task,comment; tasks also needuser_managementMembers user_managementMeetings and transcripts meeting,call_recordingFiles fileEmail metadata email(if enabled for your workspace) -
Save and copy the token, paste it into Houston's API key, and save.
Advanced
Edit the token's scopes from its menu on Developers; Houston uses the updated permissions immediately. Email access may require Attio support to enable it. If you delete the token, replace it in Houston. Keys are available on every plan.
Files
Files
connector.luau
-- Attio REST API v2, read-only. Arguments and results keep Attio's native field names. type Kind = string | number | {string} type Endpoint = {method: string, path: string, params: {string}, options: {[string]: Kind}, required: {string}?, defaults: {[string]: any}?, bare: boolean?, help: string} local API = "https://api.attio.com/v2" local NONE: {string} = table.freeze({}) local NO_DEFAULTS: {[string]: any} = table.freeze({}) local QUERY: {[string]: Kind} = {filter = "table", filter_view_id = "text", sorts = "array", limit = "count", offset = "offset"} local QUERY_HELP = "Optional filter (Attio filter object) or filter_view_id (a saved view's UUID), sorts (array), limit (Attio defaults to 500) and offset. Page with offset and stop as soon as you have enough. Records are `{id = {workspace_id, object_id, record_id}, created_at, web_url, values}`; each attribute in values is an array of historic values, newest active first." local endpoints: {[string]: Endpoint} = { identify = {method = "GET", path = "/self", params = {}, options = {}, bare = true, help = "Describe the API key: `{active, scope, client_id, token_type, token_level, exp, iat, workspace_id, workspace_name, workspace_slug, workspace_logo_url, authorized_by_workspace_member_id}`. A revoked key returns active = false."}, listObjects = {method = "GET", path = "/objects", params = {}, options = {}, help = "List every object: `{data = {{id = {object_id}, api_slug, singular_noun, plural_noun, created_at}}}`. Standard slugs include people, companies, deals, users and workspaces."}, listAttributes = {method = "GET", path = "/{target}/{identifier}/attributes", params = {"target", "identifier"}, options = {target = {"objects", "lists"}, limit = "count", offset = "offset", show_archived = "boolean"}, help = "List the attributes of an object or list: target is \"objects\" or \"lists\" and identifier is its slug or UUID. Each attribute has api_slug, title, type (text, number, select, status, record-reference, …), is_multiselect and config. Read them before filtering or sorting queries."}, queryRecords = {method = "POST", path = "/objects/{object}/records/query", params = {"object"}, options = QUERY, help = "Query an object's records (object is a slug or UUID). " .. QUERY_HELP}, getRecord = {method = "GET", path = "/objects/{object}/records/{record_id}", params = {"object", "record_id"}, options = {}, help = "Read one record with all its attribute values."}, searchRecords = {method = "POST", path = "/objects/records/search", params = {"query"}, required = {"objects"}, options = {query = "string", objects = "texts", limit = 25, request_as = "table"}, defaults = {request_as = {type = "workspace"}}, help = "Fuzzy-search record names, domains, emails, phone numbers and social handles. objects (required) lists object slugs or UUIDs; request_as defaults to `{type = \"workspace\"}`, or pass `{type = \"workspace-member\", workspace_member_id = …}` to see only what that member can. Attio defaults limit to 25. Results are eventually consistent: use queryRecords for up-to-date or exhaustive results."}, listNotes = {method = "GET", path = "/notes", params = {}, options = {limit = 50, offset = "offset", parent_object = "text", parent_record_id = "text"}, help = "List notes newest first: `{data = {{id = {note_id}, parent_object, parent_record_id, title, content_plaintext, content_markdown, tags, created_by_actor, created_at}}}`. Filter one record with parent_object and parent_record_id together. Attio defaults limit to 10 and allows 10 note requests per second; stop paging once created_at leaves the window you need. Notes synced from meeting tools often appear on both a company and its deal."}, getNote = {method = "GET", path = "/notes/{note_id}", params = {"note_id"}, options = {}, help = "Read one note, including content_plaintext and content_markdown."}, listEmails = {method = "GET", path = "/emails", params = {}, options = {limit = 50, cursor = "text", linked_object = "text", linked_record_ids = "texts", participants = "texts", domain = "text", sent_after = "text", sent_before = "text", exclude_automated_participants = "boolean"}, help = "List email metadata, never message bodies: `{data = {{id, subject_line, participants, sent_at, direction, linked_records}}, pagination = {next_cursor}}`. Attio requires one filter: linked_object (people or companies) with linked_record_ids (up to 10), participants (up to 10 addresses) or domain. Arrays are sent comma-separated. sent_after and sent_before are exclusive ISO 8601 timestamps. Attio enables this alpha endpoint per workspace and requires the key's email scope; otherwise it answers HTTP 403. Attio defaults limit to 25."}, listTasks = {method = "GET", path = "/tasks", params = {}, options = {limit = "count", offset = "offset", sort = {"created_at:asc", "created_at:desc", "completed_at:asc", "completed_at:desc"}, linked_object = "text", linked_record_id = "text", assignee = "string", is_completed = "boolean"}, help = "List tasks: `{data = {{id = {task_id}, content_plaintext, deadline_at, is_completed, completed_at, linked_records, assignees, created_at}}}`. Filter a record with linked_object and linked_record_id together; assignee is a member's email or UUID, or \"null\" for unassigned tasks. Attio defaults limit to 500 and sort to created_at:asc."}, getTask = {method = "GET", path = "/tasks/{task_id}", params = {"task_id"}, options = {}, help = "Read one task."}, listThreads = {method = "GET", path = "/threads", params = {}, options = {record_id = "text", object = "text", entry_id = "text", list = "text", limit = 50, offset = "offset"}, help = "List comment threads with their comments: `{data = {{id = {thread_id}, comments = {{id = {comment_id}, content_plaintext, author, created_at}}, created_at}}}`. Pass object with record_id for a record's threads, or list with entry_id for a list entry's. Attio defaults limit to 10. There is no endpoint listing every comment."}, getThread = {method = "GET", path = "/threads/{thread_id}", params = {"thread_id"}, options = {limit = 250, cursor = "text", created_after = "text"}, help = "Read one thread and up to 250 of its comments, with pagination.next_cursor for the rest. created_after keeps only newer comments."}, getComment = {method = "GET", path = "/comments/{comment_id}", params = {"comment_id"}, options = {}, help = "Read one comment: thread_id, content_plaintext, author, entry or record, resolved state and created_at."}, listMeetings = {method = "GET", path = "/meetings", params = {}, options = {limit = 200, cursor = "text", linked_object = "text", linked_record_id = "text", participants = "texts", sort = {"start_asc", "start_desc"}, ends_from = "text", starts_before = "text", timezone = "text"}, help = "List meetings: `{data = {{id = {meeting_id}, title, description, start, end, is_all_day, participants, linked_records, created_at}}, pagination = {next_cursor}}`. Filter a record with linked_object and linked_record_id together; participants (emails) and linked_record_id combine with OR. ends_from is inclusive and starts_before exclusive; timezone (default UTC) applies to all-day meetings. Attio defaults limit to 50 and sort to start_asc."}, getMeeting = {method = "GET", path = "/meetings/{meeting_id}", params = {"meeting_id"}, options = {}, help = "Read one meeting."}, listCallRecordings = {method = "GET", path = "/meetings/{meeting_id}/call_recordings", params = {"meeting_id"}, options = {limit = 200, cursor = "text"}, help = "List a meeting's call recordings: `{data = {{id = {call_recording_id}, status, web_url, created_at}}, pagination = {next_cursor}}`. Attio defaults limit to 50."}, getCallRecording = {method = "GET", path = "/meetings/{meeting_id}/call_recordings/{call_recording_id}", params = {"meeting_id", "call_recording_id"}, options = {}, help = "Read one call recording, including its transcript when Attio has one. video_url expires after an hour."}, listLists = {method = "GET", path = "/lists", params = {}, options = {}, help = "List every list the key can read: `{data = {{id = {list_id}, api_slug, name, parent_object, workspace_access, created_at}}}`."}, getList = {method = "GET", path = "/lists/{list}", params = {"list"}, options = {}, help = "Read one list by slug or UUID."}, queryListEntries = {method = "POST", path = "/lists/{list}/entries/query", params = {"list"}, options = QUERY, help = "Query a list's entries (list is a slug or UUID). Entries are `{id = {entry_id}, parent_record_id, parent_object, created_at, entry_values}`. " .. QUERY_HELP}, listWorkspaceMembers = {method = "GET", path = "/workspace_members", params = {}, options = {}, help = "List workspace members: `{data = {{id = {workspace_member_id}, first_name, last_name, email_address, access_level, created_at}}}`."}, getWorkspaceMember = {method = "GET", path = "/workspace_members/{workspace_member_id}", params = {"workspace_member_id"}, options = {}, help = "Read one workspace member."}, listFiles = {method = "GET", path = "/files", params = {}, required = {"object", "record_id"}, options = {object = "text", record_id = "text", storage_provider = {"attio", "dropbox", "box", "google-drive", "microsoft-onedrive"}, parent_folder_id = "text", limit = 200, cursor = "text"}, help = "List a record's files and folders (object and record_id are required): `{data = {{id = {file_id}, name, file_type, content_type, content_size, storage_provider, parent_folder_id, created_at}}, pagination = {next_cursor}}`. Without parent_folder_id every nesting level is returned. Attio defaults limit to 50. File contents cannot be downloaded through this connection."}, getFile = {method = "GET", path = "/files/{file_id}", params = {"file_id"}, options = {}, help = "Read one file's metadata."}, } local function text(value: any, field: string): string assert(type(value) == "string" and value ~= "", field .. " must be a nonempty string") return value end local function integer(value: any, field: string, minimum: number, maximum: number?): number assert(type(value) == "number" and value % 1 == 0 and value >= minimum and value <= (maximum or 2 ^ 53), field .. " must be an integer from " .. tostring(minimum) .. (if maximum then " to " .. tostring(maximum) else " or more")) return value end local function array(value: any, field: string): {any} local count = 0 if type(value) == "table" then for _ in value do count += 1 end end assert(type(value) == "table" and count == #value, field .. " must be an array") return value end local function texts(value: any, field: string): {string} if type(value) == "string" then return {text(value, field)} end assert(type(value) == "table" and #value > 0, field .. " must be a nonempty string or array of strings") array(value, field) for index, item in value do text(item, field .. "[" .. tostring(index) .. "]") end return value end -- Returns the checked value; Attio expects string arrays in query strings comma-separated. local function option(value: any, field: string, kind: Kind, query: boolean): any if type(kind) == "number" then return integer(value, field, 1, kind) elseif type(kind) == "table" then assert(table.find(kind, value), field .. " must be one of " .. table.concat(kind, ", ")) return value elseif kind == "count" then return integer(value, field, 1) elseif kind == "offset" then return integer(value, field, 0) elseif kind == "boolean" then assert(type(value) == "boolean", field .. " must be a boolean") return value elseif kind == "string" then assert(type(value) == "string", field .. " must be a string") return value elseif kind == "texts" then local items = texts(value, field) return if query then table.concat(items, ",") else items elseif kind == "array" then return if #array(value, field) > 0 then value else json.decode("[]") elseif kind == "table" then assert(type(value) == "table", field .. " must be a table") return value end return text(value, field) end local function failure(name: string, response: HttpResponse): never local status = response.statusCode local prefix = await(response.body:readPrefix(4096)) local ok, body = pcall(json.decode, prefix) if not ok or type(body) ~= "table" then body = {code = string.match(prefix, '^%s*{.-"code"%s*:%s*"([%w_]+)"')} end local message = "Attio HTTP " .. tostring(status) if type(body.code) == "string" then message ..= " " .. string.sub(body.code, 1, 64) end if type(body.message) == "string" then message ..= ": " .. string.sub(body.message, 1, 300) end if status == 401 then message ..= " (check the connection's API key)" elseif status == 403 then message ..= " (the API key lacks a scope this call needs; add it in Attio's developer settings)" end local retry = response.headers["retry-after"] if status == 429 and retry and retry[1] then message ..= "; retry after " .. string.sub(retry[1], 1, 40) end return houston.fail({operation = name, layer = "upstream", upstream_status = status, retryable = status == 429 or status >= 500, message = message}) end local function request(name: string, endpoint: Endpoint, args: {any}, input: any): any assert(input == nil or type(input) == "table", name .. " options must be a table") local path = endpoint.path local body: {[string]: any} = {} local query: {string} = {} for index, param in endpoint.params do local value = args[index] if string.find(path, "{" .. param .. "}", 1, true) then if type(value) == "table" then local id = if type(value.id) == "table" then value.id else {} value = value[param] or id[param] or value.api_slug end local segment = url.segment(option(value, param, endpoint.options[param] or "text", false), param) path = string.gsub(path, "{" .. param .. "}", function() return segment end) else body[param] = option(value, param, endpoint.options[param], false) end end for field, value in (input or {}) :: {[string]: any} do local kind = endpoint.options[field] assert(type(field) == "string" and kind and body[field] == nil and not table.find(endpoint.params, field), name .. " received an unknown option " .. tostring(field)) if endpoint.method == "POST" then body[field] = option(value, field, kind, false) else table.insert(query, field .. "=" .. url.encode(option(value, field, kind, true))) end end for _, field in endpoint.required or NONE do assert((input or {})[field] ~= nil, name .. " requires " .. field) end for field, value in endpoint.defaults or NO_DEFAULTS do if body[field] == nil then body[field] = value end end table.sort(query) local target = API .. path .. (if #query > 0 then "?" .. table.concat(query, "&") else "") local headers: HttpHeaders = {Accept = {"application/json"}} if endpoint.method == "POST" then headers["Content-Type"] = {"application/json"} end local response = await(http.request({method = endpoint.method, url = target, headers = headers, body = if endpoint.method == "POST" then json.encode(body) else nil})) if response.statusCode < 200 or response.statusCode >= 300 then failure(name, response) end local raw = await(response.body:readAll()) local ok, value = pcall(json.decode, raw) if not ok or type(value) ~= "table" or not string.match(raw, "^%s*{") or (not endpoint.bare and type(value.data) ~= "table") then houston.fail({operation = name, layer = "upstream", upstream_status = response.statusCode, retryable = false, message = "Attio returned an unexpected response"}) end return value end local functions: {[string]: any} = {} for name, endpoint in endpoints do local count = #endpoint.params functions[name] = function(...: any) local args = table.pack(...) assert(args.n <= count + 1, name .. " takes at most " .. tostring(count + 1) .. " arguments") return request(name, endpoint, args, args[count + 1]) end end local function signature(name: string, endpoint: Endpoint): string local params = table.clone(endpoint.params) if next(endpoint.options) then table.insert(params, if endpoint.required then "opts" else "opts?") end return name .. "(" .. table.concat(params, ", ") .. ")" end local function describe(field: string, kind: Kind): string if type(kind) == "number" then return field .. " (1–" .. tostring(kind) .. ")" end if type(kind) == "table" then return field .. " (" .. table.concat(kind, " | ") .. ")" end return field end function functions.help(): string local sections = {"Attio: read-only access to this workspace's CRM objects, records, lists, notes, tasks, comments, meetings, emails and files, limited by the API key's scopes. Credentials stay on Houston. Each call makes one request and returns Attio's JSON unchanged, with results under data. Calls return completed values; do not wrap them in await(). Unknown options are rejected.", "IDs are UUIDs; objects, lists and attributes also accept their api_slug. Attio returns composite ids such as `record.id.record_id`: pass the inner UUID, or the row or id table itself, as in `attio.getNote(row)` or `attio.getRecord(\"people\", row)`. Offset-paged calls take limit and offset; cursor-paged calls return pagination.next_cursor, which you pass back as cursor until it is null. Attio allows 100 reads per second and limits queries by complexity, so prefer filters to paging through everything. HTTP 429 and 5xx errors are retryable."} local names: {string} = {} for name in endpoints do table.insert(names, name) end table.sort(names) for _, name in names do local endpoint = endpoints[name] local section = "## " .. signature(name, endpoint) .. "\n\n" .. endpoint.method .. " /v2" .. endpoint.path .. ". " .. endpoint.help local fields: {string} = {} for field, kind in endpoint.options do if not table.find(endpoint.params, field) then table.insert(fields, describe(field, kind)) end end table.sort(fields) if #fields > 0 then section ..= " Options: " .. table.concat(fields, ", ") .. "." end table.insert(sections, section) end table.insert(sections, [[## Example Here attio is the configured Attio connection. ```lua local found = attio.searchRecords("Acme", {objects = {"companies"}, limit = 5}) local company = found.data[1] if company then local id = company.id.record_id local notes = attio.listNotes({parent_object = "companies", parent_record_id = id, limit = 20}) local tasks = attio.listTasks({linked_object = "companies", linked_record_id = id, is_completed = false}) local deals = attio.queryRecords("deals", {filter = {associated_company = {target_object = "companies", target_record_id = id}}, limit = 50}) end ``` Reference: https://docs.attio.com/rest-api/overview]]) return table.concat(sections, "\n\n") end return functionshouston.json
{ "schema_version": 2, "name": "Attio", "files": [ "connector.luau" ], "icon": "icon.svg", "auth": { "token": { "type": "manual", "label": "API key", "config": { "token": { "type": "secret", "label": "API key", "description": "An Attio workspace API key with read scopes.", "required": true } } } }, "proxy": [ { "match": { "protocol": "http", "host": [ "api.attio.com" ], "method": [ "GET" ], "path": [ "/v2/self", "/v2/objects", "/v2/objects/{object}/attributes", "/v2/objects/{object}/records/{record_id}", "/v2/notes", "/v2/notes/{note_id}", "/v2/emails", "/v2/tasks", "/v2/tasks/{task_id}", "/v2/threads", "/v2/threads/{thread_id}", "/v2/comments/{comment_id}", "/v2/meetings", "/v2/meetings/{meeting_id}", "/v2/meetings/{meeting_id}/call_recordings", "/v2/meetings/{meeting_id}/call_recordings/{call_recording_id}", "/v2/lists", "/v2/lists/{list}", "/v2/lists/{list}/attributes", "/v2/workspace_members", "/v2/workspace_members/{workspace_member_id}", "/v2/files", "/v2/files/{file_id}" ] }, "action": { "headers": { "set": { "Authorization": "Bearer {{auth.token.token}}" } } } }, { "match": { "protocol": "http", "host": [ "api.attio.com" ], "method": [ "POST" ], "path": [ "/v2/objects/{object}/records/query", "/v2/objects/records/search", "/v2/lists/{list}/entries/query" ] }, "action": { "headers": { "set": { "Authorization": "Bearer {{auth.token.token}}" } } } } ] }icon.svg
README.md
--- description: Search and read your Attio CRM records, lists, notes, tasks, comments, meetings and emails. --- # Attio Connect Attio so your agents can look up people, companies, deals and any custom object in your CRM. They can search and filter records, read lists and pipelines, and catch up on a customer's notes, tasks, comment threads, meetings, call recordings, email history and files, for example to prepare for a call, summarize an account or find stalled deals. Access is read-only: agents cannot create, edit or delete anything in Attio. They see exactly what your Attio API key's scopes allow, and email message bodies are never available. API keys are available on every Attio plan. [Connect your Attio workspace](SETUP.md).SETUP.md
# Connect Attio 1. As a workspace admin, open **Workspace settings → Developers → New access token**. 2. Give the token **Read** scopes for the data agents need; leave write scopes off: | Data | Scopes | | --- | --- | | Records and objects | `record_permission`, `object_configuration` | | Lists | `list_entry`, `list_configuration` | | Notes, tasks, comments | `note`, `task`, `comment`; tasks also need `user_management` | | Members | `user_management` | | Meetings and transcripts | `meeting`, `call_recording` | | Files | `file` | | Email metadata | `email` (if enabled for your workspace) | 3. Save and copy the token, paste it into Houston's **API key**, and save. [Official API key guide](https://attio.com/help/apps/other-apps/generating-an-api-key). ## Advanced Edit the token's scopes from its menu on **Developers**; Houston uses the updated permissions immediately. Email access may require Attio support to enable it. If you delete the token, replace it in Houston. Keys are available on every plan.tests
authentication.luau
return { contract = function(m) m.authentication({ { auth = { token = "synthetic-method-secret" }, config = {}, endpoint = { "GET", "https://api.attio.com/v2/self" }, expected = "Bearer synthetic-method-secret", header = "Authorization", method = "token", publisher = {}, }, }) end, }errors.luau
return { scenario = {publisher = {}, config = {}, auth_method = "token", auth_config = {token = "attio-fixture-private-key"}}, configure = function() calls = 0 status = 200 payload = "{}" responseHeaders = {} http = {request = function(req) calls += 1 return fixture.operation({statusCode = status, headers = responseHeaders, body = fixture.reader(payload)}) end} end, run = function(attio) local RECORD = "891dcbfc-9141-415d-9b2a-2238a6cc012d" local function upstream(code, body, headers, call, expected, absent) status, payload, responseHeaders = code, body, headers local before = calls local ok, err = pcall(call) for _, text in expected do assert(not ok and string.find(tostring(err), text, 1, true), "missing " .. text .. " in " .. tostring(err)) end if absent then assert(not string.find(tostring(err), absent, 1, true), "unbounded error: " .. #tostring(err)) end assert(calls == before + 1, "a failed request was repeated") end local function list() attio.listNotes() end local function query() attio.queryRecords("people", {limit = 10}) end local function record() attio.getRecord("people", RECORD) end upstream(401, '{"status_code":401,"type":"auth_error","code":"unauthorized","message":"Authentication failed."}', {}, list, {"Attio HTTP 401 unauthorized: Authentication failed.", "check the connection's API key", '"retryable":false', '"upstream_status":401'}) upstream(403, '{"status_code":403,"type":"auth_error","code":"missing_scopes","message":"Token is missing scope note:read"}', {}, list, {"HTTP 403 missing_scopes", "note:read", "lacks a scope", '"retryable":false'}) upstream(404, '{"status_code":404,"type":"invalid_request_error","code":"not_found","message":"Record not found."}', {}, record, {"HTTP 404 not_found: Record not found.", '"retryable":false'}, "API key") upstream(400, '{"status_code":400,"type":"invalid_request_error","code":"validation_type","message":"' .. string.rep("x", 1000) .. '"}', {}, query, {"HTTP 400 validation_type: " .. string.rep("x", 300)}, string.rep("x", 301)) upstream(400, '{"status_code":400,"code":"validation_type","message":"' .. string.rep("x", 5000) .. '"}', {}, query, {"Attio HTTP 400 validation_type"}, "xxx") upstream(400, '{"message":"' .. string.rep("x", 5000) .. '","code":"validation_type"}', {}, query, {"Attio HTTP 400"}, "xxx") upstream(429, '{"status_code":429,"type":"rate_limit_error","code":"rate_limit_exceeded","message":"Rate limit exceeded, please try again later"}', {["retry-after"] = {"Sun, 01 Nov 2026 12:00:05 GMT"}}, query, {"HTTP 429 rate_limit_exceeded", "retry after Sun, 01 Nov 2026 12:00:05 GMT", '"retryable":true'}) upstream(502, "<html>Bad gateway</html>", {}, list, {"Attio HTTP 502", '"retryable":true'}, "html") upstream(200, "<html>Maintenance</html>", {}, list, {"unexpected response", '"retryable":false'}) upstream(200, "[]", {}, record, {"unexpected response"}) upstream(200, '{"data":null}', {}, list, {"unexpected response"}) upstream(200, '{"active":false}', {}, list, {"unexpected response"}) status, payload = 200, '{"active":false}' assert(attio.identify().active == false, "identify returns the token state unchanged") end, }manifest.luau
return { contract = function(m) -- TestAttioReadOnlyRoutes do do local _, err = m.resolve(nil, nil, nil, "token") if err == nil then m.fail("accepted missing API key") end end local r, err = m.resolve(nil, nil, { token = "attio_fixture" }, "token") assert(not err, tostring(err)) local api = "https://api.attio.com/v2" local id = "891dcbfc-9141-415d-9b2a-2238a6cc012d" m.routes(r, "Bearer attio_fixture", true, { "GET " .. api .. "/self", "GET " .. api .. "/objects", "GET " .. api .. "/objects/people/attributes?limit=20", "GET " .. api .. "/objects/people/records/" .. id, "GET " .. api .. "/notes?parent_object=people", "GET " .. api .. "/notes/" .. id, "GET " .. api .. "/emails?domain=example.com", "GET " .. api .. "/tasks", "GET " .. api .. "/tasks/" .. id, "GET " .. api .. "/threads", "GET " .. api .. "/threads/" .. id .. "?cursor=c1", "GET " .. api .. "/comments/" .. id, "GET " .. api .. "/meetings", "GET " .. api .. "/meetings/" .. id, "GET " .. api .. "/meetings/" .. id .. "/call_recordings", "GET " .. api .. "/meetings/" .. id .. "/call_recordings/" .. id, "GET " .. api .. "/lists", "GET " .. api .. "/lists/sales", "GET " .. api .. "/lists/sales/attributes", "GET " .. api .. "/workspace_members", "GET " .. api .. "/workspace_members/" .. id, "GET " .. api .. "/files?object=people", "GET " .. api .. "/files/" .. id, "POST " .. api .. "/objects/people/records/query", "POST " .. api .. "/objects/records/search", "POST " .. api .. "/lists/sales/entries/query", }) m.routes(r, "Bearer attio_fixture", false, { "POST " .. api .. "/objects/people/records", "PUT " .. api .. "/objects/people/records", "PATCH " .. api .. "/objects/people/records/" .. id, "DELETE " .. api .. "/objects/people/records/" .. id, "POST " .. api .. "/notes", "DELETE " .. api .. "/notes/" .. id, "POST " .. api .. "/tasks", "POST " .. api .. "/comments", "POST " .. api .. "/lists/sales/entries", "HEAD " .. api .. "/self", "GET " .. api .. "/webhooks", "POST " .. api .. "/webhooks", "GET " .. api .. "/webhooks/" .. id, "GET " .. api .. "/files/" .. id .. "/download", "GET " .. api .. "/meetings/" .. id .. "/call_recordings/" .. id .. "/transcript", "POST " .. api .. "/sql", "GET " .. api .. "/activities/calls/attributes", "GET " .. api .. "/objects/%2e%2e/records/" .. id, "GET " .. api .. "/objects/people/records/a%2Fb", "GET https://app.attio.com/oauth/token", "GET https://api.attio.com.example.com/v2/self", "GET http://api.attio.com:8080/v2/self", }) end end, }reads.luau
return { scenario = {publisher = {}, config = {}, auth_method = "token", auth_config = {token = "attio-fixture-private-key"}}, configure = function() requests = {} payload = '{"data":[]}' http = {request = function(req) table.insert(requests, req) assert(req.headers.Authorization == nil, "credentials must remain in the proxy") assert(req.headers.Accept[1] == "application/json") if req.method == "POST" then assert(req.headers["Content-Type"][1] == "application/json") else assert(req.method == "GET" and req.body == nil and req.headers["Content-Type"] == nil, "reads must be bodiless GETs") end return fixture.operation({statusCode = 200, headers = {}, body = fixture.reader(payload)}) end} end, run = function(attio) local API = "https://api.attio.com/v2" local RECORD, MEETING, RECORDING = "891dcbfc-9141-415d-9b2a-2238a6cc012d", "2e6e29ea-c4e0-4f44-842d-78a891f8c156", "a649e4d9-435c-43fb-83ba-847b4876f27a" local function last() return requests[#requests] end local function get(call, url) call() assert(last().method == "GET" and last().url == url, last().url) end local function same(a, b) if type(a) ~= "table" or type(b) ~= "table" then return a == b end for k, v in a do if not same(v, b[k]) then return false end end for k in b do if a[k] == nil then return false end end return true end local function post(call, url, body) call() assert(last().method == "POST" and last().url == url, last().url) assert(same(json.decode(last().body), json.decode(body)), last().body) end local function rejected(call, expected) local before = #requests local ok, err = pcall(call) local message = if type(err) == "table" then json.encode(err) else tostring(err) assert(not ok and string.find(message, expected, 1, true), "wrong validation error: " .. message) assert(#requests == before, "invalid input reached Attio") end local names = {} for name, fn in attio do assert(type(fn) == "function") table.insert(names, name) end table.sort(names) assert(table.concat(names, ",") == "getCallRecording,getComment,getFile,getList,getMeeting,getNote,getRecord,getTask,getThread,getWorkspaceMember," .. "identify,listAttributes,listCallRecordings,listEmails,listFiles,listLists,listMeetings,listNotes,listObjects,listTasks,listThreads," .. "listWorkspaceMembers,queryListEntries,queryRecords,searchRecords", table.concat(names, ",")) assert(#requests == 0, "initialization reached Attio") payload = '{"active":true,"workspace_name":"Acme","scope":"record_permission:read"}' local me = attio.identify() assert(last().url == API .. "/self" and me.active == true and me.workspace_name == "Acme") payload = '{"data":[{"id":{"workspace_id":"w","object_id":"o"},"api_slug":"people","singular_noun":"Person"}]}' get(attio.listObjects, API .. "/objects") assert(attio.listObjects().data[1].api_slug == "people") payload = '{"data":[]}' local empty = attio.listObjects() assert(json.encode(empty.data) == "[]") get(attio.listLists, API .. "/lists") get(attio.listWorkspaceMembers, API .. "/workspace_members") get(function() attio.listAttributes("objects", "people", {limit = 20, offset = 40, show_archived = true}) end, API .. "/objects/people/attributes?limit=20&offset=40&show_archived=true") get(function() attio.listAttributes("lists", RECORD) end, API .. "/lists/" .. RECORD .. "/attributes") payload = '{"data":{"id":{"record_id":"' .. RECORD .. '"},"values":{"name":[{"value":"Ada"}],"email_addresses":[]}}}' get(function() attio.getRecord("people", RECORD) end, API .. "/objects/people/records/" .. RECORD) local record = attio.getRecord("people", RECORD) assert(record.data.values.name[1].value == "Ada" and json.encode(record.data.values.email_addresses) == "[]") payload = '{"data":[]}' post(function() attio.queryRecords("companies") end, API .. "/objects/companies/records/query", "{}") local query = {filter = {name = {["$contains"] = "Acme"}}, sorts = {{attribute = "created_at", direction = "desc"}}, limit = 50, offset = 100} post(function() attio.queryRecords("companies", query) end, API .. "/objects/companies/records/query", '{"filter":{"name":{"$contains":"Acme"}},"sorts":[{"attribute":"created_at","direction":"desc"}],"limit":50,"offset":100}') assert(query.limit == 50 and query.sorts[1].direction == "desc", "caller options were modified") post(function() attio.queryListEntries("sales", {filter_view_id = RECORD, sorts = {}}) end, API .. "/lists/sales/entries/query", '{"filter_view_id":"' .. RECORD .. '","sorts":[]}') assert(string.find(last().body, '"sorts":[]', 1, true), "empty sorts must stay a JSON array") post(function() attio.searchRecords("Acme", {objects = {"companies", "people"}, limit = 25}) end, API .. "/objects/records/search", '{"query":"Acme","objects":["companies","people"],"limit":25,"request_as":{"type":"workspace"}}') post(function() attio.searchRecords("", {objects = "deals", request_as = {type = "workspace-member", email_address = "[email protected]"}}) end, API .. "/objects/records/search", '{"query":"","objects":["deals"],"request_as":{"type":"workspace-member","email_address":"[email protected]"}}') get(function() attio.listNotes({parent_object = "companies", parent_record_id = RECORD, limit = 50, offset = 0}) end, API .. "/notes?limit=50&offset=0&parent_object=companies&parent_record_id=" .. RECORD) get(function() attio.getNote(RECORD) end, API .. "/notes/" .. RECORD) get(function() attio.listEmails({participants = {"[email protected]", "[email protected]"}, exclude_automated_participants = true, cursor = "c+/="}) end, API .. "/emails?cursor=c%2B%2F%3D&exclude_automated_participants=true&participants=ada%40example.com%2Cbo%40example.com") get(function() attio.listEmails({linked_object = "people", linked_record_ids = RECORD, sent_after = "2026-10-01T00:00:00Z"}) end, API .. "/emails?linked_object=people&linked_record_ids=" .. RECORD .. "&sent_after=2026-10-01T00%3A00%3A00Z") get(function() attio.listTasks({sort = "created_at:desc", assignee = "null", is_completed = false, limit = 1000}) end, API .. "/tasks?assignee=null&is_completed=false&limit=1000&sort=created_at%3Adesc") get(function() attio.getTask(RECORD) end, API .. "/tasks/" .. RECORD) get(function() attio.listThreads({object = "people", record_id = RECORD}) end, API .. "/threads?object=people&record_id=" .. RECORD) get(function() attio.getThread(RECORD, {limit = 250, cursor = "next"}) end, API .. "/threads/" .. RECORD .. "?cursor=next&limit=250") get(function() attio.getComment(RECORD) end, API .. "/comments/" .. RECORD) get(function() attio.listMeetings({sort = "start_desc", participants = "[email protected]", limit = 200}) end, API .. "/meetings?limit=200&participants=ada%40example.com&sort=start_desc") get(function() attio.getMeeting(MEETING) end, API .. "/meetings/" .. MEETING) get(function() attio.listCallRecordings(MEETING, {limit = 10, cursor = "c1"}) end, API .. "/meetings/" .. MEETING .. "/call_recordings?cursor=c1&limit=10") get(function() attio.getCallRecording(MEETING, RECORDING) end, API .. "/meetings/" .. MEETING .. "/call_recordings/" .. RECORDING) get(function() attio.getList("sales") end, API .. "/lists/sales") get(function() attio.getWorkspaceMember(RECORD) end, API .. "/workspace_members/" .. RECORD) get(function() attio.listFiles({object = "companies", record_id = RECORD, storage_provider = "google-drive"}) end, API .. "/files?object=companies&record_id=" .. RECORD .. "&storage_provider=google-drive") get(function() attio.getFile(RECORD) end, API .. "/files/" .. RECORD) get(function() attio.getRecord("people", "r:2 ü@") end, API .. "/objects/people/records/r%3A2%20%C3%BC%40") get(function() attio.getList("Sales Pipeline") end, API .. "/lists/Sales%20Pipeline") get(function() attio.getNote({id = {workspace_id = "w", note_id = RECORD}, title = "Call"}) end, API .. "/notes/" .. RECORD) get(function() attio.getRecord("people", {id = {object_id = "o", record_id = RECORD}, values = {}}) end, API .. "/objects/people/records/" .. RECORD) get(function() attio.getCallRecording({meeting_id = MEETING}, {call_recording_id = RECORDING}) end, API .. "/meetings/" .. MEETING .. "/call_recordings/" .. RECORDING) post(function() attio.queryListEntries({id = {list_id = "l"}, api_slug = "sales"}) end, API .. "/lists/sales/entries/query", "{}") rejected(function() attio.getRecord("people") end, "record_id must be a nonempty string") rejected(function() attio.getNote({id = {record_id = RECORD}}) end, "note_id must be a nonempty string") rejected(function() attio.listAttributes("objects", "people", {target = "lists"}) end, "unknown option target") rejected(function() attio.queryRecords("people", {sorts = {{attribute = "name"}, direction = "asc"}}) end, "sorts must be an array") rejected(function() attio.getRecord("people", "r/2") end, "record_id") rejected(function() attio.getRecord("..", RECORD) end, "object") rejected(function() attio.getNote(42) end, "note_id must be a nonempty string") rejected(function() attio.listAttributes("webhooks", "people") end, "target must be") rejected(function() attio.listNotes({limit = 51}) end, "limit must be an integer from 1 to 50") rejected(function() attio.listNotes({offset = -1}) end, "offset must be an integer from 0") rejected(function() attio.listNotes({page = 2}) end, "unknown option page") rejected(function() attio.listNotes("people") end, "options must be a table") rejected(function() attio.listTasks({sort = "due"}) end, "sort must be one of") rejected(function() attio.listTasks({is_completed = "true"}) end, "is_completed must be a boolean") rejected(function() attio.listEmails({participants = {}}) end, "participants must be a nonempty string or array") rejected(function() attio.listEmails({participants = {a = "x"}}) end, "participants must be") rejected(function() attio.listCallRecordings(MEETING, {offset = 10}) end, "unknown option offset") rejected(function() attio.listFiles({object = "companies"}) end, "listFiles requires record_id") rejected(function() attio.listFiles() end, "listFiles requires object") rejected(function() attio.searchRecords("Acme") end, "searchRecords requires objects") rejected(function() attio.searchRecords(nil, {objects = {"people"}}) end, "query must be a string") rejected(function() attio.searchRecords("Acme", {objects = {"people"}, query = "Other"}) end, "unknown option query") rejected(function() attio.searchRecords("Acme", {objects = {"people"}, limit = 26}) end, "limit must be an integer from 1 to 25") rejected(function() attio.queryRecords("people", {sorts = {attribute = "name"}}) end, "sorts must be") rejected(function() attio.queryRecords("people", {limit = 0.5}) end, "limit must be an integer") rejected(function() attio.getTask(RECORD, {}, {}) end, "getTask takes at most 2 arguments") end, }