Get CSRF Token

Get CSRF Token - kintone.getRequestToken()

Retrieves a CSRF token to be used for file downloads/uploads.
This can be used for all APIs that have an HTTP method of POST, PUT and DELETE. APIs with an HTTP method of GET do not need a CSRF token.

Function

kintone.getRequestToken()

Request Parameters

None

Returns

A string containing the CSRF Token.

Available Period

86400 seconds (1 day) from the last access.

Sample Request

1
2
3
4
5
var token = kintone.getRequestToken();
console.log(token);

// returns
// 19324485-251e-2f6h-9332-824c9933g53e

Sample for APIs using Query Strings

1
https://{subdomain}.kintone.com/k/v1/records.json?__REQUEST_TOKEN__=19324485-251e-2f6h-9332-824c9933g53e

Sample for APIs using JSON

1
2
3
{
  "__REQUEST_TOKEN__": "19324485-251e-2f6h-9332-824c9933g53e"
}

Request headers needed with the APIs

Header Content
X-Requested-With XMLHttpRequest
Content-Type application/json