View-Based POST

To create a new record in Knack, send a POST request to the route for a form view, using its scene and view keys.

Note that you should only include fields in your payload that exist in the form itself, as no others will be used in creating the new record.

Also keep in mind that all relevant record rules on the form in question will be triggered by a POST request to that form.

URL
POST https://api.knack.com/v1/pages/scene_xx/views/view_yy/records

Parameters

ParameterExplanationExample
scene_xxscene keyscene_3
view_yyview keyview_5

Headers

KeyValue
X-Knack-Application-IdYour application ID
X-Knack-REST-API-Keyknack
AuthorizationA user token valid for the view (if view is nested under a login)
content-typeapplication/json

Example Request

curl -X POST "https://api.knack.com/v1/pages/scene_13/views/view_12/records" \
  -H "X-Knack-Application-Id: YOUR-APP-ID" \
  -H "X-Knack-REST-API-Key: knack" \
  -H "Content-Type: application/json" \
  --data '{
        "field_1": "Name of new company",
        "field_16": {
          "street": "123 Fake St.",
          "city": "Amonate",
          "state": "VA",
          "zip": "24601"
        },
        "field_17": {
          "url": "https://example.com"
        },
        "field_18": "Other",
        "field_31": "555-555-5555"
      }'

Example Response (200 OK)

{
  "record": {
    "id": "5865077510a48064455804a7",
    "field_1": "Name of new company",
    "field_1_raw": "Name of new company",
    "field_16": "123 Fake St.<br />Amonate, VA 24601",
    "field_16_raw": {
      "zip": "24601",
      "state": "VA",
      "city": "Amonate",
      "street": "123 Fake St."
    },
    "field_17": "<a href=\"https://example.com\" target=\"_blank\">https://example.com</a>",
    "field_17_raw": {
      "url": "https://example.com"
    },
    "field_18": "Other",
    "field_18_raw": "Other",
    "field_31": "555-555-5555",
    "field_31_raw": "555-555-5555"
  },
  "submit_key": "submit_1"
}