API reference
Modules and fields
Read the structure of the CRM: which modules exist and which fields each one has. Use it to build forms and mappings that keep working when an administrator adds a field.
Request
curl "https://api.spartivo.com/api/v1/metadata/modules" \
-H "Authorization: Bearer wk_your_key"Response
[
{
"id": "b9fa0f66-a5bf-4c48-8637-2da3406419eb",
"apiName": "leads",
"label": "Lead",
"pluralLabel": "Leads",
"icon": "user-plus",
"system": true,
"features": {
"pipeline": false,
"documents": true,
"activities": true,
"conversations": true
},
"fields": [
{
"apiName": "email",
"label": "Email",
"type": "email",
"required": false,
"unique": false,
"options": null,
"lookupModule": null
},
{
"apiName": "status",
"label": "Status",
"type": "picklist",
"required": false,
"unique": false,
"options": [
{
"value": "new",
"label": "New"
},
{
"value": "contacted",
"label": "Contacted"
}
],
"lookupModule": null
}
]
}
]Get a module
GET
/metadata/modules/{module}One module with its fields.
Path parameters
modulestringrequiredThe module's API name, for example
leads, contacts, accounts, deals or one of your custom modules.Request
curl "https://api.spartivo.com/api/v1/metadata/modules/deals" \
-H "Authorization: Bearer wk_your_key"Response
{
"apiName": "deals",
"label": "Deal",
"pluralLabel": "Deals",
"features": {
"pipeline": true,
"documents": true,
"activities": true,
"conversations": true
},
"fields": [
{
"apiName": "amount",
"label": "Amount",
"type": "currency",
"required": false
},
{
"apiName": "account",
"label": "Account",
"type": "lookup",
"lookupModule": "accounts",
"required": false
}
]
}Field types
| Type | Value in data |
|---|---|
text, long_text, rich_text, email, phone, url | string |
number, decimal, currency, percent | number |
checkbox | true or false |
date | string, YYYY-MM-DD |
datetime | string, ISO 8601 in UTC |
picklist | string: one of the field's option values |
multi_picklist | string[]: option values |
lookup | string: the id of a record in lookupModule |
user | string: a user id |
file | string: a file id from Upload a file |
formula, auto_number | set by Spartivo; values you send are ignored |
Add a field
POST
/metadata/modules/{module}/fieldsAdds a custom field to a module. The key's user needs the Customization permission in their profile.
Path parameters
modulestringrequiredThe module's API name, for example
leads, contacts, accounts, deals or one of your custom modules.Body
apiNamestringrequiredLowercase letters, numbers and underscores, starting with a letter.
labelstringrequiredThe name people see.
typestringrequiredOne of the field types above.
requiredbooleanRefuse records without a value.
uniquebooleanRefuse a value another record already has.
optionsobject[]For picklists:
[{"value":"gold","label":"Gold"}].lookupModulestringFor lookups: the module the field points to.
Request
curl -X POST "https://api.spartivo.com/api/v1/metadata/modules/accounts/fields" \
-H "Authorization: Bearer wk_your_key" \
-H "Content-Type: application/json" \
-d '{"apiName":"tier","label":"Tier","type":"picklist","options":[{"value":"gold","label":"Gold"},{"value":"silver","label":"Silver"}]}'Response
{
"apiName": "tier",
"label": "Tier",
"type": "picklist",
"required": false,
"unique": false,
"options": [
{
"value": "gold",
"label": "Gold"
},
{
"value": "silver",
"label": "Silver"
}
]
}Request
curl "https://api.spartivo.com/api/v1/users" \
-H "Authorization: Bearer wk_your_key"Response
[
{
"id": "035607f1-9fd1-44bc-ac7f-d5128d5afc22",
"email": "sara@example.com",
"fullName": "Sara Khalifa",
"role": "admin",
"active": true,
"profile": {
"id": "e827a63b-ff46-4580-b613-67742bf0c8e3",
"name": "Administrator"
},
"orgRole": {
"id": "d0a31443-908b-4493-9d6c-5a057e119cf2",
"name": "CEO"
}
}
]