Skip to main content
POST
/
api2
/
v2
/
connectors
/
{connectorId}
/
folders
/
{folder}
/
files
/
{fileName}
/
upload
Upload file (async)
curl --request POST \
  --url https://cloud.memsource.com/web/api2/v2/connectors/{connectorId}/folders/{folder}/files/{fileName}/upload \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: multipart/form-data' \
  --header 'Memsource: <memsource>' \
  --form file='@example-file'
import requests

url = "https://cloud.memsource.com/web/api2/v2/connectors/{connectorId}/folders/{folder}/files/{fileName}/upload"

files = { "file": ("example-file", open("example-file", "rb")) }
headers = {
"Memsource": "<memsource>",
"Authorization": "<api-key>"
}

response = requests.post(url, files=files, headers=headers)

print(response.text)
const form = new FormData();
form.append('file', '<string>');

const options = {
method: 'POST',
headers: {Memsource: '<memsource>', Authorization: '<api-key>'}
};

options.body = form;

fetch('https://cloud.memsource.com/web/api2/v2/connectors/{connectorId}/folders/{folder}/files/{fileName}/upload', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://cloud.memsource.com/web/api2/v2/connectors/{connectorId}/folders/{folder}/files/{fileName}/upload",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: multipart/form-data",
"Memsource: <memsource>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://cloud.memsource.com/web/api2/v2/connectors/{connectorId}/folders/{folder}/files/{fileName}/upload"

payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Memsource", "<memsource>")
req.Header.Add("Authorization", "<api-key>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://cloud.memsource.com/web/api2/v2/connectors/{connectorId}/folders/{folder}/files/{fileName}/upload")
.header("Memsource", "<memsource>")
.header("Authorization", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();
require 'uri'
require 'net/http'

url = URI("https://cloud.memsource.com/web/api2/v2/connectors/{connectorId}/folders/{folder}/files/{fileName}/upload")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Memsource"] = '<memsource>'
request["Authorization"] = '<api-key>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001--"

response = http.request(request)
puts response.read_body
{
  "createdBy": {
    "email": "<string>",
    "firstName": "<string>",
    "id": "<string>",
    "lastName": "<string>",
    "uid": "<string>",
    "userName": "<string>"
  },
  "dateCreated": "2023-11-07T05:31:56Z",
  "fileName": "<string>",
  "id": "<string>"
}

Authorizations

Authorization
string
header
required

Get a token from auth/login endpoint and then pass it in the Authorization HTTP header in every subsequent API call. For more information visit our help center.

Headers

Memsource
string<application/json>
required
Content-Type
enum<string>
required
Available options:
multipart/form-data

Path Parameters

connectorId
string
required

Internal numeric ID of the connector

folder
string
required

Hex-encoded remote folder path

fileName
string
required

Hex-encoded remote file name

Query Parameters

mimeType
string

Mime type of the file to upload

Body

multipart/form-data
file
file
required

Translated file to upload

Response

OK

action
enum<string>

Type of the async file operation, e.g. API_DOWNLOAD or API_UPLOAD

Available options:
GUI_UPLOAD,
GUI_DOWNLOAD,
GUI_REIMPORT,
GUI_REIMPORT_TARGET,
CJ_UPLOAD,
CJ_DOWNLOAD,
APC_UPLOAD,
APC_DOWNLOAD,
API_UPLOAD,
API_DOWNLOAD,
SUBMITTER_PORTAL_DOWNLOAD
createdBy
object
dateCreated
string<date-time>

Timestamp when the async task was created

fileName
string

Name of the file

id
string

Internal numeric ID of the async task, encoded as a string