{"id":18088,"date":"2018-12-04T13:59:13","date_gmt":"2018-12-04T13:59:13","guid":{"rendered":"https:\/\/developer.kore.ai\/v10-1\/?post_type=docs&#038;p=15678"},"modified":"2023-08-30T12:03:54","modified_gmt":"2023-08-30T11:03:54","slug":"upload-file-api","status":"publish","type":"post","link":"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/api-guide\/upload-file-api\/","title":{"rendered":"Upload File API"},"content":{"rendered":"<section class=\"l-section wpb_row height_auto\"><div class=\"l-section-h i-cf\"><div class=\"g-cols vc_row type_default valign_top\"><\/div><\/div><\/section><div class=\"vc_col-sm-12 wpb_column vc_column_container\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\"><\/div><\/div><\/div>\r\n\t<div class=\"wpb_text_column \">\r\n\t\t<div class=\"wpb_wrapper\">\r\n\t\t\t\r\n\t\t<\/div>\r\n\t<\/div>\r\nTo upload the <i>botdefinition<\/i>, <i>botconfig<\/i>, and <i>botfunction<\/i> files (if any) and the <b>bot<\/b> icon to the local server. Additionally, the API fetches the <i>file ID<\/i> to be used in <a href=\"\/docs\/bots\/api-guide\/import-bot-as-a-new-bot-api\/\" target=\"_blank\" rel=\"noopener noreferrer\">Import Bot API<\/a>.<\/p>\n<div><\/div>\n<p>\n<div><b>Note<\/b>: You need to upload the files separately. You can upload a file by signing with any app which is created by the account administrator.<\/div>\n<p>&nbsp;<\/p>\n<table>\n<tbody>\n<tr>\n<td><b>Method<\/b><\/td>\n<td>POST<\/td>\n<\/tr>\n<tr>\n<td><b>Endpoint<\/b><\/td>\n<td><span style=\"font-weight: 400;\"><code>https:\/\/{{host}}\/api\/public\/uploadfile<\/code><\/span><\/td>\n<\/tr>\n<tr>\n<td><b>Content Type<\/b><\/td>\n<td><code>application\/json<\/code><\/td>\n<\/tr>\n<tr>\n<td><b>Authorization<\/b><\/td>\n<td><code>auth: {{JWT}}<\/code><\/p>\n<p>See <a href=\"https:\/\/developer.kore.ai\/v10-1\/docs\/bots\/api-guide\/apis\/#Generating_the_JWT_Token\" target=\"_blank\" rel=\"noopener noreferrer\">How to generate the JWT Token<\/a>.<\/td>\n<\/tr>\n<tr>\n<td><b>API Scope<\/b><\/td>\n<td>\n<ul>\n<li>Bot Builder: Not Applicable<\/li>\n<li>Admin Console: Not Applicable<\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Query_Parameters\">Query Parameters<\/span><\/h2>\n<table style=\"height: 41px;\" width=\"391\">\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Description<\/th>\n<th>Mandate<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400;\">host<\/span><\/td>\n<td>The environment URL. For example, <code>https:\/\/bots.kore.ai<\/code><\/td>\n<td>Required<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Sample_Request\">Sample Request<\/span><\/h2>\n<pre>curl -X POST \\\r\n  https:\/\/{{host}}\/api\/public\/uploadfile \\\r\n  -H 'auth: YOUR_JWT_ACCESS_TOKEN' \\\r\n  -H 'content-type: multipart\/form-data' \\\r\n  -F file=@botDefinition.json \\\r\n  -F fileContext=bulkImport \\\r\n  -F fileExtension=json\r\n<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Body_Parameters\">Body Parameters<\/span><\/h2>\n<p>The following parameters are <b>Required<\/b> and passed based on the <i>file id<\/i>.<\/p>\n<p><b><span style=\"font-weight: 400;\">For Bot Definition File ID<\/span><\/b><\/p>\n<table>\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400;\"><b>file<\/b><\/span><\/td>\n<td>Upload the Botdefinition.json file.<\/td>\n<\/tr>\n<tr>\n<td><b>fileContext<\/b><\/td>\n<td>bulkImport<\/td>\n<\/tr>\n<tr>\n<td><b>fileExtension<\/b><\/td>\n<td>.json<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><b><span style=\"font-weight: 400;\">For Bot Config File ID<\/span><\/b><\/p>\n<table>\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400;\"><b>file<\/b><\/span><\/td>\n<td><span style=\"font-weight: 400;\">Upload the Botconfig.json file.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>fileContext<\/b><\/td>\n<td>bulkImport<\/td>\n<\/tr>\n<tr>\n<td><b>fileExtension<\/b><\/td>\n<td>.json<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><b><span style=\"font-weight: 400;\">For Bot Function File ID<\/span><\/b><\/p>\n<table>\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400;\"><b>file<\/b><\/span><\/td>\n<td><span style=\"font-weight: 400;\">Upload the Bot function file.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>fileContext<\/b><\/td>\n<td>bulkImport<\/td>\n<\/tr>\n<tr>\n<td><b>fileExtension<\/b><\/td>\n<td>.js<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><b><span style=\"font-weight: 400;\">For Bot icon File ID<\/span><\/b><\/p>\n<table>\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400;\"><b>file<\/b><\/span><\/td>\n<td><span style=\"font-weight: 400;\">Upload the Bot icon file.<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>fileContext<\/b><\/td>\n<td>bulkImport<\/td>\n<\/tr>\n<tr>\n<td><b>fileExtension<\/b><\/td>\n<td>.json<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><b><span style=\"font-weight: 400;\">For ML Utterances File ID<\/span><\/b><\/p>\n<table>\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400;\"><b>file<\/b><\/span><\/td>\n<td><span style=\"font-weight: 400;\">Upload the ML Utterance file (.json or .csv)<\/span><\/td>\n<\/tr>\n<tr>\n<td><b>fileContext<\/b><\/td>\n<td>bulkImport<\/td>\n<\/tr>\n<tr>\n<td><b>fileExtension<\/b><\/td>\n<td><span style=\"font-weight: 400;\">.json or .csv<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Sample_Response\">Sample Response<\/span><\/h2>\n<pre>{\r\n    \"fileId\": \"5c077d28d28e06c112681656\",\r\n    \"hash\": \"c275df72765efb7de332e7d54300cb12de66b78e\",\r\n    \"fileName\": \"f-57a5c8e14erd-21nd-g432-w927cc65r372\"\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>To upload the botdefinition, botconfig, and botfunction files (if any) and the bot icon to the local server. Additionally, the API fetches the file ID to be used in Import Bot API. Note: You need to upload the files separately. You can upload a file by signing with any app which is created by the&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-18088","post","type-post","status-publish","format-standard","hentry","category-api-guide"],"_links":{"self":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/18088","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/comments?post=18088"}],"version-history":[{"count":41,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/18088\/revisions"}],"predecessor-version":[{"id":58929,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/posts\/18088\/revisions\/58929"}],"wp:attachment":[{"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/media?parent=18088"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/categories?post=18088"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developer.kore.ai\/v10-1\/wp-json\/wp\/v2\/tags?post=18088"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}