Skip to content

Set a deal's field values

PUT
/deals/{id}/fields
Code sample: Shell / cURL
curl --request PUT \
--url https://example.com/api/v1/deals/example/fields \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "values": [ { "definitionId": "example", "items": [ { "done": true, "id": "example", "text": "example" } ], "value": "example" } ] }'

Sets the deal’s value for one or more of the fields listed by GET /deal-field-definitions, and answers with every field shown on the deal as it now stands. A field left out keeps its value; null, an empty text or an empty list clears it. A CHECKLIST field takes items, the whole list in order, and an item sent without an id is new. Works on an open or a won deal; a lost deal answers 409 until it is reopened. A value that does not fit its field, an unknown field or a new value for a hidden field answers 422. Each save is one entry in the deal’s history. Requires deals.manage.

id
required

Deal identifier (CUID2).

string
>= 1 characters

Deal identifier (CUID2).

Media typeapplication/json
object
values
required

One entry per field to set, each field once; a field left out keeps its value. A CHECKLIST field takes items, the whole list in order, where an item without an id is new. Every other kind takes value: a text, an address, a day as YYYY-MM-DD, an option of the field, or “true” or “false”. Null, an empty text or an empty list clears the field.

Array<object>
>= 1 items
object
definitionId
required
string
>= 1 characters
items
Any of:
Array<object>
<= 50 items
object
done
required
boolean
id
string
>= 1 characters <= 64 characters
text
required
string
>= 1 characters <= 300 characters
value
Any of:
string
<= 10000 characters

Example generated

{
"values": [
{
"definitionId": "example",
"items": [
{
"done": true,
"id": "example",
"text": "example"
}
],
"value": "example"
}
]
}

The deal’s field values after the save.

Media typeapplication/json
object
data
required
Array<object>

One deal field with a deal’s value for it.

object
definitionId
required

The deal field this value belongs to.

string
hasValue
required

True when the deal holds a value, or at least one checklist item, for the field.

boolean
items
required

The items of a CHECKLIST field, in order; null while it has none and on every other kind.

Any of:
Array<object>
object
done
required
boolean
id
required
string
text
required
string
kind
required

What a deal field holds: a short text, a long text, a link, a day, one option of a list, a yes or no, or a checklist.

string
Allowed values: TEXT MULTILINE URL DATE DROPDOWN CHECKBOX CHECKLIST
name
required
string
options
required

The options of a DROPDOWN field; empty for every other kind.

Array<string>
value
required

The value of every kind but CHECKLIST, null while the field is empty: the text (TEXT, MULTILINE), the address (URL), the day as YYYY-MM-DD (DATE), the chosen option (DROPDOWN), or “true” or “false” (CHECKBOX). Always null on a CHECKLIST field.

string | null

Example

{
"data": [
{
"kind": "TEXT"
}
]
}

Validation error. Parse failures include field paths and expectations.

Media typeapplication/json

Validation error with safe field paths and expected values; submitted values are never returned.

object
error
required
object
code
required

Stable machine-readable error code.

string
issues
Array<object>
object
expected
required
string
message
required
string
path
required
Array<string | number>
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Unauthorized.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Forbidden.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Not found.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Conflict.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Invalid input.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Rate limit exceeded. Wait for Retry-After before retrying.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}
RateLimit-Limit
string
/^\d+$/

Maximum requests in the current quota window.

RateLimit-Policy
string

Quota policy in requests and window seconds, for example 60;w=60.

RateLimit-Remaining
string
/^\d+$/

Requests left in this quota window (zero when blocked).

RateLimit-Reset
string
/^\d+$/

Seconds until the current quota window resets, when available from the rate-limit store.

Retry-After
string
/^\d+$/

Seconds until another request may be attempted.