Create or update a field rule

put/v1/field-rules/{root}/{field_key}

Upserts a field rule for a root + field key. fieldKey must be lowercase alphanumeric with dots/underscores.

Requires a bearer token: Authorization: Bearer <token>.

Path parameters

NameTypeRequiredDescription
rootstringYesRoot.
field_keystringYesFieldKey.e.g. FieldKey

Request

cURL
curl -X PUT https://api.wellapp.ai/v1/field-rules/{root}/{field_key} \
  -H "Authorization: Bearer $WELL_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "data": {
    "type": "field_rule",
    "attributes": {
      "column_name": "Vendor",
      "column_type": "amount",
      "format_config": "{\"currency\":\"EUR\",\"decimals\":2}"
    }
  }
}'
Request body
{
  "data": {
    "type": "field_rule",
    "attributes": {
      "column_name": "Vendor",
      "column_type": "amount",
      "format_config": "{\"currency\":\"EUR\",\"decimals\":2}"
    }
  }
}

Responses

200Upserted field rule.

{
  "data": {
    "type": "field_rule",
    "id": "fr_1",
    "attributes": {
      "field_key": "issuer.name",
      "root": "invoices",
      "column_name": "Vendor",
      "column_type": "amount"
    }
  }
}

400Validation error (incl. invalid fieldKey).

{
  "code": "BAD_REQUEST",
  "status": 400,
  "title": "Bad Request",
  "message": "See title.",
  "meta": {
    "trace_id": "a1b2c3",
    "log_id": "a1b2c3"
  }
}

401Unauthorized.

{
  "code": "UNAUTHORIZED",
  "status": 401,
  "title": "Unauthorized",
  "message": "See title.",
  "meta": {
    "trace_id": "a1b2c3",
    "log_id": "a1b2c3"
  }
}