{"openapi":"3.1.0","info":{"title":"XPI CRM REST API","version":"1.0.0","description":"Read and write your workspace's records. Authenticate with an API key from Setup → API & Webhooks: Authorization: Bearer <key>."},"servers":[{"url":"https://xpicrm.com"}],"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"API key (shown once when created)"}},"schemas":{"Record":{"type":"object","description":"Field keys of the object, plus id, createdAt and updatedAt. Links and users are { id, name } (name left out when the key can't see the linked object); files are [{ id, name, size }]; calculated values are included.","required":["id","createdAt","updatedAt"],"properties":{"id":{"type":"string","format":"uuid"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"additionalProperties":true},"List":{"type":"object","required":["data","total","limit","offset"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Record"}},"total":{"type":"integer"},"limit":{"type":"integer"},"offset":{"type":"integer"}}},"One":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Record"}}},"SaveResult":{"type":"object","required":["created","updated","errors","ids"],"properties":{"created":{"type":"integer"},"updated":{"type":"integer"},"errors":{"type":"array","items":{"type":"object","required":["index","message"],"properties":{"index":{"type":"integer","description":"Position in the request (0-based)"},"message":{"type":"string"}}}},"ids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Ids of the saved records, in request order (failed rows left out)"}}},"Deleted":{"type":"object","required":["deleted"],"properties":{"deleted":{"type":"string","format":"uuid"}}},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["status","message"],"properties":{"status":{"type":"integer"},"message":{"type":"string"}}}}},"Input":{"oneOf":[{"type":"object","additionalProperties":true,"description":"One record: field keys → values; optional id to update that record"},{"type":"array","items":{"type":"object","additionalProperties":true},"maxItems":1000},{"type":"object","required":["records"],"properties":{"records":{"type":"array","items":{"type":"object","additionalProperties":true},"maxItems":1000}}}]}}},"paths":{"/api/v1/{object}":{"get":{"operationId":"listRecords","summary":"List records","parameters":[{"name":"object","in":"path","required":true,"description":"Object key, e.g. clients, contacts, billing, usage","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"1–1000, default 100","schema":{"type":"integer","minimum":1,"maximum":1000,"default":100}},{"name":"offset","in":"query","required":false,"description":"Records to skip, default 0","schema":{"type":"integer","minimum":0,"default":0}},{"name":"updated_since","in":"query","required":false,"description":"Only records changed after this ISO 8601 date-time","schema":{"type":"string","format":"date-time"}}],"x-field-filters":"Any other query parameter is an exact-match filter on that field key","responses":{"200":{"description":"A page of records","content":{"application/json":{"schema":{"$ref":"#/components/schemas/List"}}}},"401":{"description":"Missing, wrong or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key has no access to this object, or it is read-only and the request writes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown object or record","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}]},"post":{"operationId":"upsertRecords","summary":"Create or update records (upsert)","parameters":[{"name":"object","in":"path","required":true,"description":"Object key, e.g. clients, contacts, billing, usage","schema":{"type":"string"}},{"name":"match","in":"query","required":false,"description":"Comma-separated field keys used to find an existing record to update (default: unique fields, else the record name)","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Input"}}}},"responses":{"200":{"description":"All records saved, some or all updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveResult"}}}},"201":{"description":"All records created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveResult"}}}},"207":{"description":"Some records failed; the others were saved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveResult"}}}},"401":{"description":"Missing, wrong or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key has no access to this object, or it is read-only and the request writes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown object or record","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}]},"put":{"summary":"Not allowed","responses":{"405":{"description":"Method not allowed on this path","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"summary":"Not allowed","responses":{"405":{"description":"Method not allowed on this path","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"summary":"Not allowed","responses":{"405":{"description":"Method not allowed on this path","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/{object}/{id}":{"get":{"operationId":"getRecord","summary":"Get one record","parameters":[{"name":"object","in":"path","required":true,"description":"Object key, e.g. clients, contacts, billing, usage","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"The record","content":{"application/json":{"schema":{"$ref":"#/components/schemas/One"}}}},"401":{"description":"Missing, wrong or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key has no access to this object, or it is read-only and the request writes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown object or record","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}]},"patch":{"operationId":"updateRecord","summary":"Update fields of one record","parameters":[{"name":"object","in":"path","required":true,"description":"Object key, e.g. clients, contacts, billing, usage","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"responses":{"200":{"description":"The updated record","content":{"application/json":{"schema":{"$ref":"#/components/schemas/One"}}}},"401":{"description":"Missing, wrong or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key has no access to this object, or it is read-only and the request writes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown object or record","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}]},"delete":{"operationId":"deleteRecord","summary":"Delete one record","parameters":[{"name":"object","in":"path","required":true,"description":"Object key, e.g. clients, contacts, billing, usage","schema":{"type":"string"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Deleted"}}}},"401":{"description":"Missing, wrong or revoked API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The key has no access to this object, or it is read-only and the request writes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown object or record","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"apiKey":[]}]},"put":{"summary":"Not allowed","responses":{"405":{"description":"Method not allowed on this path","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"summary":"Not allowed","responses":{"405":{"description":"Method not allowed on this path","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}