Upload a document to a candidate profile

Request Headers:
Content-Type: multipart/form-data;
Authorization: {Token}

Request Body Example:
-----------------------------{...boundary}
Content-Disposition: form-data; name="aCv"; filename="cv.pdf"
Content-Type: application/pdf

...contents of cv.pdf file

-----------------------------{...boundary}

Parameters:
id: Id of Candidate. Required.
type: See Value under Document Types. Optional (default set to CV).
extractCV: Boolean value. Type must be CV. Extracts content of CV and populates empty fields of the Candidate. Optional (default set to true). Extraction takes a few seconds.

Allowed files types

  • pdf
  • docx
  • doc

Document Types

Document TypeValue
CV1
Transcript2
Drivers License3
Identity Document4
Passport5
Other7

Result Codes

403 Forbidden
200 OK
202 Accepted
400 Bad request
500 Internal server error

Code Example

private static async Task<Stream> Upload(HttpPostedFileBase file, int candidateId, int fileType, bool cvUpload)
{
    var actionUrl = $"https://api.simplify.hr/v1/candidates/document?id={candidateId}&type={fileType}&extractCV={cvUpload}";

    HttpContent fileStreamContent = new StreamContent(file.InputStream);

    fileStreamContent.Headers.ContentType = new MediaTypeHeaderValue(file.ContentType);

    using (var client = new HttpClient())
    {
        client.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", "Your Oauth token");

        using (var formData = new MultipartFormDataContent())
        {
            formData.Add(fileStreamContent, "file", file.FileName);
            var response = await client.PostAsync(actionUrl, formData);
            if (!response.IsSuccessStatusCode)
            {
                return null;
            }
            return await response.Content.ReadAsStreamAsync();
        }
    }
}