Response Format

Records stored in your app are indexed by the field key (e.g. field_1) and include a unique record ID which you can use to specify that record in subsequent requests. See below for a examples responses you might see for a GET request for multiple records as well as for any GET, POST, or PUT request which returns a single record.

Single Record

When retrieving a single record via a GET request, inserting a record via a POST request, or updating a record via a PUT request, the JSON body of a successful response will be the record in question as a JSON object.

Example Response (200 OK)

{
  "id": "58643557d1ea9432222f3cbb",
  "field_1": "Pearl Architectural Design",
  "field_1_raw": "Pearl Architectural Design",
  "field_17": "<a href=\"http://www.pearlinc.com\" target=\"_blank\">http://www.pearlinc.com</a>",
  "field_17_raw": {
    "url": "http://www.pearlinc.com"
  },
  "field_18": "Services",
  "field_18_raw": "Services",
  "field_31": "516-334-3077",
  "field_31_raw": "516-334-3077"
}

Multiple Records

When retrieving multiple records via a GET request, the body of your response will be a JSON object containing the following information:

{
  "total_pages": 1,
  "current_page": 1,
  "total_records": 2,
  "records": [
    {
      "id": "58643557d1ea9432222f3cbb",
      "field_1": "Pearl Architectural Design",
      "field_1_raw": "Pearl Architectural Design",
      "field_17": "<a href=\"http://www.pearlinc.com\" target=\"_blank\">http://www.pearlinc.com</a>",
      "field_17_raw": {
        "url": "http://www.pearlinc.com"
      },
      "field_18": "Services",
      "field_18_raw": "Services",
      "field_31": "516-334-3077",
      "field_31_raw": "516-334-3077"
    },
    {
      "id": "58643556d1ea9432222f3ca6",
      "field_1": "Kelly and Cohen",
      "field_1_raw": "Kelly and Cohen",
      "field_17": "<a href=\"http://www.kellycohen.com\" target=\"_blank\">http://www.kellycohen.com</a>",
      "field_17_raw": {
        "url": "http://www.kellycohen.com"
      },
      "field_18": "Services",
      "field_18_raw": "Services",
      "field_31": "315-296-4146",
      "field_31_raw": "315-296-4146"
    }
  ]
}

Multiple Records: Response Data

KeyValue
total_pagesTotal number of pages of results which match your filters (if any)
current_pageThe current page of the records returned by your request
total_recordsThe total number of records which match your filters (if any)
recordsAn array of JSON objects, where each object represents a record

The Knack API uses status codes in the 200 range to indicate success and status codes in the 400 range to indicate an error. Codes in the 500 range indicate a server-side error. Most errors can be fixed by checking the JSON formatting of your request’s body (there are plenty of great online JSON validators), your application ID, and (for object-based calls) your API key.

CodeRequest TypeMessageNotes
200 OKPOST/PUT<Created/updated record (JSON), including ID>
200 OKGET<Record(s) queried>
200 OKDELETE{ “delete”: true }
400 Bad RequestAnyMalformed App ID
401 UnauthorizedAnyInvalid API key
401 UnauthorizedAnyInvalid API requestResults from no application ID included among request headers.
403 ForbiddenAnyInvalid or Expired TokenResults from trying to authenticate a view-based request with an expired user token.
429 Too Many RequestsAnyEither "Rate limit exceeded" or "Plan Limit Exceeded"Read more here

What’s Next