kintone developer network

Upload File

Follow

Upload File POST /file.json

Uploads a file to kintone.
URI
https://{subdomain}.kintone.com/k/v1/file.json

When a file is uploaded, it produces a file key.
Note that although this API uploads a file to kintone, it does not upload the file to an attachment file of an app.
To upload the file to an attachment file, the file key is used with the Add Record or Update Record API.

Request format

The request is sent in a multipart/form-data format. Please look through RFC1867 and RFC2388 for more details.
For the file name, specify the filename within the Content-Disposition.

Sample Request

When uploading a file named "test.txt" with the contents "test":

POST /k/v1/file.json HTTP/1.1
Host: example.kintone.com:443
X-Cybozu-Authorization: a2ludG9uZTpkZXZlbG9wZXI=
Content-Type: multipart/form-data; boundary=---------------------------bee48a285354
Content-Length: 188
 
-----------------------------bee48a285354
Content-Disposition: form-data; name="file"; filename="test.txt"
Content-Type: text/plain

test

-----------------------------bee48a285354--

Sample Response

The file key of the uploaded file will be returned.
Use this file key with the Add Record or Update Record API to attach it to an attachment field of an app.

{
    "fileKey": "c15b3870-7505-4ab6-9d8d-b9bdbc74f5d6"
}

Attaching the file to an attachment field

Use the Add Record or Update Record API, and set the file key as the attachment field's key, as below.

Sample request using the Update Record API

PUT /k/v1/record.json HTTP/1.1
Host: example.kintone.com:443
X-Cybozu-Authorization: a2ludG9uZTpkZXZlbG9wZXI=
Content-Type: application/json

Body

{
    "app": 3,
    "id": 6,
    "record": {
        "attached_file": {
            "value": [
                {
                    "fileKey": " c15b3870-7505-4ab6-9d8d-b9bdbc74f5d6"
                }
            ]
        }
    }
}

Limitations

Only 1 file can be uploaded at a time.
After the file is uploaded onto kintone, the file will be deleted after 3 days if the Add Record or Update Record API is not used.
For other limitations, please check the Limitations on this page.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request
Comments