Databasebeta
A table of what you know about each contact. Ody adds and fills columns from conversations; you define your own, read and write values, find a row by phone number, and query everything with read-only SQL.
The Database is a table with one row per contact. Its columns hold what the business knows about each contact: plan, budget, renewal date, "asked about pricing". You add columns, and Ody adds them too: when a contact says something in a call, a voicemail or a text that no column holds yet, Ody creates the column, fills it, and listens for the same thing in every later conversation. Each cell is filled by someone on the team, by this API, or by Ody.
Use this API to load what you already know about your customers, to read what Ody learned from conversations, and to answer questions about all of it with SQL.
The Database is in beta and Ody turns it on for one workspace at a time. Until it is on for yours, every endpoint on this page returns 409 failed_precondition. Write to [email protected] to ask for it.
ody.data (TypeScript) and client.data (Python) are in v0.10.0 of the SDKs, which is not on npm or PyPI yet. With the published v0.9.0, use the cURL examples or any HTTP client.
#How the table works
| Rows | One per contact. Every contact has a row, including contacts with no values yet. A row is identified by the contact's id. |
| Columns | Added by your team, by this API, or by Ody. There is no maximum number of columns. Each has a key (renewal_date) that this API and SQL use. The key is made from the name the column was created with and never changes, so renaming a column in the app does not break your integration. |
| Values | Typed by the column: text, number, date, true / false, one choice, several choices. |
| Who filled a cell | Every filled cell records its source: user, import, api, automation or ai. |
A value you write is yours. A cell written through this API gets source: "api" and is locked: Ody does not replace it with something it hears in a later conversation. This is true when you clear a cell, too. Cells that nobody has written stay open for Ody to fill.
#Columns that Ody adds
Unless the workspace has turned it off, Ody adds a column when a contact says a kind of fact that no column holds. A remodeling company whose callers mention the type of project gets a Project type column without anyone creating it. These columns have auto: true.
What this means for an integration:
- The column list changes on its own. Read the columns with
GET /data/columnsorGET /data/schemawhen you need them. Do not keep a fixed list in your code. - Keys are still stable. A column Ody added keeps its
keyfor as long as it exists, like any other. - A column you create is never duplicated. Ody compares names without regard to case, word order or small words: if you have Project type, Ody fills it and does not add "Type of project".
- Deleting an
autocolumn is remembered. Ody does not add a column with that meaning again. - Some things are never added. Ody does not create columns for card numbers, government IDs, passwords or health details, or for what the contact card already holds (name, phone number, e-mail, company, tags).
The workspace's owners and admins turn this on and off in the app, under Database → AI → Add columns automatically. There is no API for that switch.
#Scopes
| To | Scope |
|---|---|
| Read columns, rows, summaries, and run SQL | contacts:read |
| Write values, create a contact through upsert | contacts:write |
| Add, change or delete columns | data:manage |
Values are data about contacts, so they follow the contact scopes. Changing the shape of the table is a separate permission because deleting a column deletes every value in it.
#Test keys
ody_test_… keys read and write the same table as live keys. Nothing on this page sends a message or spends money, so there is nothing to simulate.
#The column object
iduuid — Unique identifier. Accepted anywhere akeyis.keystring — The column's name in this API and in SQL. Lower case with underscores. Never changes.namestring — The name people see in the app. Up to 60 characters.descriptionstring — What the column holds. When Ody fills the column, this is the instruction it follows. Up to 200 characters.kindstring —attribute: a fact about the contact.signal: something the contact said or asked, counted per conversation.typestring —text,number,date,boolean,select(one choice) ormulti_select(several choices). A signal is alwaysboolean.optionsarray of strings — The choices of aselectormulti_selectcolumn.allowNewOptionsboolean — Whether Ody may add a choice it hears that is not in the list.aiEnabledboolean — Whether Ody fills this column from calls and texts.fillRulestring — How Ody fills it.latest: a newer conversation replaces the value.once: the first value stays.collect: choices add up (multi_selectonly).autoboolean —truewhen Ody added the column itself, from something a contact said. See Columns that Ody adds.positioninteger — Order in the table.createdAt,updatedAttimestamp — ISO 8601.
#Values by type
type | Send | You get back |
|---|---|---|
text | A string, up to 500 characters | The string |
number | A number, or a string such as "1,200" | A number |
date | "YYYY-MM-DD" (a full ISO timestamp is cut to its day) | "YYYY-MM-DD" |
boolean | true / false (also "yes", "no") | true / false |
select | One of the column's choices. Matching ignores case. | The choice as it is spelled in the column |
multi_select | A list of choices | A list |
| signal | true / false | true / false |
null clears a value. An empty cell reads as null, except a signal column, which reads as false.
Writing "Platinum" to a select column whose choices are Free and Pro adds Platinum to the column, the same as when a person types a new choice in the app. Check the value against options first if you want to refuse unknown choices.
#The row object
contactIduuid — The contact this row belongs to.contactobject — The contact's own fields:firstName,lastName,company,phone(the first number),email(the first address),tags,createdAt,lastContactedAt. On workspaces where AI Contact is on, also the card fields. Read-only here; change them with the Contacts API.dataobject — Every column by key, with its value.cellsobject — Only on single-row responses. The filled cells by column key, each withvalue,source,locked,confidence,occurrences,lastObservedAtandupdatedAt.
{
"contactId": "8b1d6f3e-2c4a-4e1b-9f0d-7a5c3e2b1a90",
"contact": {
"firstName": "Dana",
"lastName": "Reyes",
"company": "Brightline",
"phone": "+15125550199",
"email": "[email protected]",
"tags": ["vip"],
"createdAt": "2026-10-14T18:02:11.000Z",
"lastContactedAt": "2026-11-27T16:40:02.000Z"
},
"data": {
"plan": "Pro",
"seats": 12,
"renewal_date": "2027-03-01",
"newsletter": true,
"interests": ["Voice", "AI"],
"asked_about_pricing": true
},
"cells": {
"plan": {
"value": "Pro",
"source": "api",
"locked": true,
"confidence": null,
"occurrences": 0,
"lastObservedAt": null,
"updatedAt": "2026-11-29T15:02:11.000Z"
},
"asked_about_pricing": {
"value": true,
"source": "ai",
"locked": false,
"confidence": 0.92,
"occurrences": 3,
"lastObservedAt": "2026-11-27T16:40:02.000Z",
"updatedAt": "2026-11-27T16:41:30.000Z"
}
}
}For a signal column, occurrences is the number of conversations it came up in.
#Contact card fields
When AI Contact is on for a workspace, a contact carries more details than a name and a company: a job title, a postal address, and what the phone network says about the number. The Database shows each of them as a column, and the contact object of a row carries them too. A workspace without AI Contact gets none of these fields: they are absent from contact, and a filter or sort on one is rejected with invalid_argument.
In contact | In a filter or sort | In SQL | What it holds |
|---|---|---|---|
jobTitle | contact.job_title | job_title | Job title |
headline | contact.headline | headline | A one-line professional headline |
website | contact.website | website | The contact's website, as a bare domain |
linkedinUrl | contact.linkedin_url | linkedin_url | LinkedIn profile URL |
companyDomain | contact.company_domain | company_domain | The company's website, as a bare domain |
companyLinkedinUrl | contact.company_linkedin_url | company_linkedin_url | The company's LinkedIn page |
secondaryPhone | contact.secondary_phone | secondary_phone | A second phone number, E.164 |
addressStreet | contact.address_street | address_street | Street address |
addressCity | contact.address_city | address_city | City |
addressState | contact.address_state | address_state | State or region |
addressPostalCode | contact.address_postal_code | address_postal_code | ZIP or postal code |
addressCountry | contact.address_country | address_country | Country, ISO 3166-1 alpha-2 when known (US) |
phoneLineType | contact.phone_line_type | phone_line_type | mobile, landline, voip, toll_free or unknown |
phoneCarrier | contact.phone_carrier | phone_carrier | Carrier of the contact's number |
callerIdName | contact.caller_id_name | caller_id_name | Caller ID name published by the carrier |
aiNotes | contact.ai_notes | ai_notes | Notes Ody took from conversations, one per line. Cannot be sorted on |
Each is text or null. They are the same fields the Contacts API returns, and that is where you change them: the Database API reads them and never writes them. Values are returned as stored. A state can be TX on one contact and Texas on another when a person typed one of them, so prefer contains or a list of spellings over an exact match on an address field.
curl -G https://api.ody.co/v1/api/data/rows \
-H "Authorization: Bearer $ODY_API_KEY" \
--data-urlencode 'filter=[{"column":"contact.address_state","op":"is","value":"TX"},{"column":"contact.phone_line_type","op":"is","value":"mobile"}]'#Describe the table
/v1/api/data/schemaReturns the workspace's columns and the two tables that POST /data/query can read, with the exact SQL name and type of every column. Call this first when you write SQL, or give it to an AI assistant so it uses real column names.
Scope: contacts:read
Returns { columns: Column[], tables: Table[], limits }. Each table column has name, sql (how to write it in a query), type and description.
curl https://api.ody.co/v1/api/data/schema \
-H "Authorization: Bearer $ODY_API_KEY"const { columns, tables } = await ody.data.schema();schema = client.data.schema(){
"columns": [
{ "id": "5c1e…", "key": "plan", "name": "Plan", "kind": "attribute", "type": "select", "options": ["Free", "Pro"], "aiEnabled": false, "fillRule": "latest", "auto": false },
{ "id": "9a40…", "key": "project_type", "name": "Project type", "kind": "attribute", "type": "select", "options": ["Kitchen", "Bathroom"], "aiEnabled": true, "fillRule": "latest", "auto": true }
],
"tables": [
{
"name": "contacts",
"description": "One row per contact: the contact's own fields and one column per data column.",
"columns": [
{ "name": "id", "sql": "id", "type": "id", "description": "The contact's id." },
{ "name": "name", "sql": "name", "type": "text", "description": "First and last name together." },
{ "name": "plan", "sql": "plan", "type": "text", "description": "Plan (one of: Free, Pro)", "columnKey": "plan" }
]
},
{ "name": "observations", "description": "One row per thing Ody heard a contact say, with when and where.", "columns": [] }
],
"limits": { "queryRows": 1000, "queryChars": 4000, "queryTimeoutMs": 5000, "pageSize": 100 }
}#List columns
/v1/api/data/columnsReturns the columns in table order.
Scope: contacts:read
Returns { columns: Column[] }.
curl https://api.ody.co/v1/api/data/columns \
-H "Authorization: Bearer $ODY_API_KEY"const columns = await ody.data.columns();columns = client.data.columns()#Add a column
/v1/api/data/columnsCreates a column. kind and type cannot be changed afterwards. There is no maximum number of columns. A column you create has auto: false.
With aiEnabled: true, Ody starts filling the column from new calls and texts, using description as its instruction. A signal column that Ody fills needs a description. Ody does not fill columns for card numbers, government IDs, passwords or health details.
Scope: data:manage
Body
namestring required — Up to 60 characters. Thekeyis made from it.kindstring —attribute(default) orsignal.typestring —text(default),number,date,boolean,select,multi_select. Ignored for a signal.descriptionstring — Up to 200 characters.optionsarray of strings — Up to 50 choices of up to 80 characters.allowNewOptionsboolean — Defaultfalse.aiEnabledboolean — Defaultfalse.fillRulestring —latest(default),onceorcollect.
Returns 201 with { column }.
curl https://api.ody.co/v1/api/data/columns \
-H "Authorization: Bearer $ODY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Plan",
"type": "select",
"options": ["Free", "Pro", "Enterprise"]
}'const column = await ody.data.createColumn({
name: "Plan",
type: "select",
options: ["Free", "Pro", "Enterprise"],
});
console.log(column.key); // "plan"column = client.data.create_column(
name="Plan",
type="select",
options=["Free", "Pro", "Enterprise"],
)
print(column["key"]) # "plan"#Change a column
/v1/api/data/columns/:columnChanges a column, addressed by key or id. Only the fields you send change. key, kind and type never change. Removing a choice from options does not remove it from rows that already hold it.
Scope: data:manage
Body — any of name, description, options, allowNewOptions, aiEnabled, fillRule.
Returns { column }.
curl -X PATCH https://api.ody.co/v1/api/data/columns/plan \
-H "Authorization: Bearer $ODY_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "name": "Tier", "options": ["Free", "Pro", "Enterprise", "Partner"] }'await ody.data.updateColumn("plan", { name: "Tier" });client.data.update_column("plan", name="Tier")#Delete a column
/v1/api/data/columns/:columnDeletes the column, every value in it, and the history behind those values. This cannot be undone.
Deleting a column that Ody added (auto: true) also tells Ody not to add a column with that meaning again.
Scope: data:manage
Returns { ok: true }.
curl -X DELETE https://api.ody.co/v1/api/data/columns/plan \
-H "Authorization: Bearer $ODY_API_KEY"await ody.data.deleteColumn("plan");client.data.delete_column("plan")#Summarise a column
/v1/api/data/columns/:column/summaryCounts one column across all contacts: how many contacts have a value, how many of those Ody filled, the most common values, and the range of a number or date column.
This is how you count a multi_select column by choice, which SQL cannot group.
Scope: contacts:read
Returns { summary }.
curl https://api.ody.co/v1/api/data/columns/plan/summary \
-H "Authorization: Bearer $ODY_API_KEY"const summary = await ody.data.summarizeColumn("plan");summary = client.data.summarize_column("plan"){
"summary": {
"column": "plan",
"name": "Plan",
"contacts": 1840,
"filled": 1212,
"filledByAi": 430,
"top": [
{ "value": "Pro", "count": 701 },
{ "value": "Free", "count": 455 },
{ "value": "Enterprise", "count": 56 }
],
"numbers": null,
"dates": null,
"occurrences": null
}
}#List rows
/v1/api/data/rowsReturns one page of rows, one per contact, newest contact first unless you sort. Use q, filter and sort to narrow and order the page. For totals and grouping, use SQL.
Scope: contacts:read
Query parameters
qstring — Search name, company, phone and e-mail.filterstring — A JSON list of up to 20 filters. All of them must match. See below.sortstring — A column key, orcontact.name,contact.company,contact.created_at. With AI Contact on, also a card field such ascontact.address_state(every card field exceptcontact.ai_notes).dirstring —asc(default) ordesc.limitinteger — 1–100, default 50.cursorstring —nextCursorfrom the previous page.
A filter is { "column", "op", "value" }. column is a column key, or one of contact.name, contact.phone, contact.email, contact.company, contact.tags, contact.created_at. With AI Contact on, it can also be a card field, written contact.address_state or contact.addressState. op is one of is, is_not, contains, not_contains, gt, gte, lt, lte, empty, not_empty. empty and not_empty take no value.
Returns { rows: Row[], total: number, nextCursor: string | null }. total counts every matching contact, not only this page. Rows in a list have no cells.
curl -G https://api.ody.co/v1/api/data/rows \
-H "Authorization: Bearer $ODY_API_KEY" \
--data-urlencode 'filter=[{"column":"plan","op":"is","value":"Pro"},{"column":"seats","op":"gte","value":10}]' \
--data-urlencode 'sort=renewal_date'const { rows, total, nextCursor } = await ody.data.rows({
filter: [
{ column: "plan", op: "is", value: "Pro" },
{ column: "seats", op: "gte", value: 10 },
],
sort: "renewal_date",
});
// Or every matching row, page after page:
for await (const row of ody.data.rowsAll({ q: "brightline" })) {
console.log(row.contactId, row.data.plan);
}page = client.data.rows(
filter=[
{"column": "plan", "op": "is", "value": "Pro"},
{"column": "seats", "op": "gte", "value": 10},
],
sort="renewal_date",
)
# Or every matching row, page after page:
for row in client.data.rows_all(q="brightline"):
print(row["contactId"], row["data"]["plan"])#Find a row by phone number or e-mail
/v1/api/data/rows/lookupReturns the row of the contact who has this phone number or e-mail address. Send exactly one of the two. This is the call to make when a conversation starts and your agent needs to know who it is talking to.
Phone numbers are matched in E.164. A number written another way, such as (512) 555-0199, is converted first.
Scope: contacts:read
Query parameters
phonestring — E.164. URL-encode the+as%2B.emailstring — Matching ignores case.
Returns { row }, or 404 not_found when no contact has it.
curl "https://api.ody.co/v1/api/data/rows/lookup?phone=%2B15125550199" \
-H "Authorization: Bearer $ODY_API_KEY"const row = await ody.data.lookup({ phone: "+15125550199" });
console.log(row.data.plan, row.cells.plan?.source);row = client.data.lookup(phone="+15125550199")
print(row["data"]["plan"])#Get a row
/v1/api/data/rows/:contactIdReturns one contact's row, with cells.
Scope: contacts:read
Returns { row }.
curl https://api.ody.co/v1/api/data/rows/8b1d6f3e-2c4a-4e1b-9f0d-7a5c3e2b1a90 \
-H "Authorization: Bearer $ODY_API_KEY"const row = await ody.data.get(contactId);row = client.data.get(contact_id)#Set values on a row
/v1/api/data/rows/:contactIdSets the columns you send on one contact's row and leaves the other columns alone. null clears a value.
The call is all or nothing: if one value does not fit its column, nothing is written and the error names the column.
Scope: contacts:write
Body
dataobject required — Column key → value.
Returns { row }.
curl -X PUT https://api.ody.co/v1/api/data/rows/8b1d6f3e-2c4a-4e1b-9f0d-7a5c3e2b1a90 \
-H "Authorization: Bearer $ODY_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "data": { "plan": "Enterprise", "seats": 40, "renewal_date": null } }'const row = await ody.data.set(contactId, {
plan: "Enterprise",
seats: 40,
renewal_date: null,
});row = client.data.set(contact_id, {"plan": "Enterprise", "seats": 40, "renewal_date": None})#Find or create a contact and set values
/v1/api/data/rows/upsertFinds the contact by id, phone number or e-mail and sets values on its row. When no contact has the phone number or e-mail, the contact is created first. Use it to load rows from a CRM, a spreadsheet, an order system or an enrichment tool without looking up contact ids.
- Values are checked first. If one value does not fit its column, the call fails and nothing is created or written.
- An existing contact's own fields are not changed.
contactis used only when a contact is created. UsePATCH /contacts/:idto change a name or company. - A number that already called or texted is matched. Ody creates a contact for every new number, so the upsert finds it rather than adding a second one.
One call writes one row. To load many rows, send one call per row and stay under the rate limit of 600 requests a minute.
Scope: contacts:write
Body
matchobject required — Exactly one ofcontactId,phone,email.contactobject — For a new contact:firstName,lastName,company,phone,email,tags.dataobject — Column key → value.
Returns 201 with { row, created: true } when the contact was created, 200 with { row, created: false } when it existed. A contactId that does not exist returns 404.
curl https://api.ody.co/v1/api/data/rows/upsert \
-H "Authorization: Bearer $ODY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"match": { "phone": "+15125550199" },
"contact": { "firstName": "Dana", "lastName": "Reyes", "company": "Brightline" },
"data": { "plan": "Pro", "seats": 12, "renewal_date": "2027-03-01" }
}'const { row, created } = await ody.data.upsert({
match: { phone: "+15125550199" },
contact: { firstName: "Dana", lastName: "Reyes", company: "Brightline" },
data: { plan: "Pro", seats: 12, renewal_date: "2027-03-01" },
});result = client.data.upsert(
phone="+15125550199",
contact={"firstName": "Dana", "lastName": "Reyes", "company": "Brightline"},
data={"plan": "Pro", "seats": 12, "renewal_date": "2027-03-01"},
)
row, created = result["row"], result["created"]#Query with SQL
/v1/api/data/queryRuns one read-only SELECT over two tables: contacts (one row per contact, with your columns) and observations (one row per thing Ody heard a contact say). The full dialect, with examples, is on Database: SQL reference.
Your statement is not sent to the database as written. Ody parses it, checks every name against your columns, and builds its own query with every value bound as a parameter. That is why only the listed keywords and functions work, and why an unsupported query fails with a message that says what to change.
Scope: contacts:read
Body
sqlstring required — OneSELECTstatement, up to 4,000 characters.
Returns { columns, rows, rowCount, truncated }. columns gives the name and type of each output column, and each row is an object keyed by those names. A call returns at most 1,000 rows; truncated: true means more rows matched, and you can page with LIMIT and OFFSET. A query that runs longer than 5 seconds is stopped and returns 400.
curl https://api.ody.co/v1/api/data/query \
-H "Authorization: Bearer $ODY_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "sql": "SELECT plan, count(*) AS contacts FROM contacts WHERE asked_about_pricing GROUP BY plan ORDER BY contacts DESC" }'const { rows } = await ody.data.query<{ plan: string; contacts: number }>(
"SELECT plan, count(*) AS contacts FROM contacts WHERE asked_about_pricing GROUP BY plan ORDER BY contacts DESC",
);result = client.data.query(
"SELECT plan, count(*) AS contacts FROM contacts WHERE asked_about_pricing GROUP BY plan ORDER BY contacts DESC"
)
for row in result["rows"]:
print(row["plan"], row["contacts"]){
"columns": [
{ "name": "plan", "type": "text" },
{ "name": "contacts", "type": "number" }
],
"rows": [
{ "plan": "Pro", "contacts": 212 },
{ "plan": "Free", "contacts": 87 }
],
"rowCount": 2,
"truncated": false
}#Errors
Errors use the standard envelope. The ones specific to the Database:
| Status | code | When |
|---|---|---|
400 | invalid_argument | A value does not fit its column, data names a column that does not exist, a filter is malformed, or the SQL is not supported. The message names the column or the position in the query. |
403 | permission_denied | The key lacks contacts:read, contacts:write or data:manage. |
404 | not_found | The contact or the column does not exist. A column 404 lists the keys that do. |
409 | failed_precondition | The Database is not switched on for this workspace. |
#Not available yet
- Webhooks. There is no event when a cell changes. Poll with
GET /data/rows, or queryobservationsbyobserved_at. - Bulk writes. One call writes one row.
- The contact's words.
observationsgives the value, date and channel of what Ody heard, not the quote. The quote is shown in the app.