API Reference
Log In
API Reference
These docs are for v2.0. Click to read the latest docs for v2.1.

Link Applicant to Files in S3

Step 2 of 2 for adding files to an applicant profile.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

This is Part 2 to adding files to an applicant's profile. Please refer to File Upload to S3 for Part 1.

🚧

"Key" Clarification

Not to be confused by S3's Object 'Key', the key refers to Fountain's identifier for the file you're uploading. In the Product, this is known as "Data Key". The S3 Object Key is passed in as s3_key.

We recommend using the same key for similar files you're collecting from applicants to prevent the creation of duplicate data keys. Example, if all your applicants have a resume, upload all the resume files as resume_file.

import json
import xml.etree.ElementTree
import mimetypes
import os
import requests

HOST="api.fountain.com"
API_KEY="K-9NB9DkxU7NdrB9eRBHCA"
APPLICANT="6d0d9434-2817-4b96-9ad4-e33a7f2a0adb"
FILENAME="dog.jpg"
UPLOAD_FILE=(FILENAME, open(FILENAME, 'rb'), mimetypes.guess_type(FILENAME)[0])
UPLOAD_KEY="test"

UPLOAD_URL="https://%s/v2/applicants/%s/secure_documents/upload" % (HOST, APPLICANT)
LINK_UPLOAD_URL="https://%s/v2/applicants/%s/secure_documents/link_upload" % (HOST, APPLICANT)

HEADERS = { 'X-ACCESS-TOKEN': API_KEY }

upload_response = requests.post(UPLOAD_URL, headers=HEADERS)
upload_response_json = json.loads(upload_response.text)
form_data = upload_response_json['form_data']
form_data['Content-type'] = ""

s3_upload_response = requests.post(upload_response_json['url'], data=form_data, files={'file': UPLOAD_FILE})

s3_upload_response_xml = xml.etree.ElementTree.fromstring(s3_upload_response.text)
s3_filename = s3_upload_response_xml.find("Key").text

finish_upload_data = {
    'key': UPLOAD_KEY,
    's3_key': s3_filename,
    'size': os.path.getsize(FILENAME),
}
finish_upload_response = requests.post(LINK_UPLOAD_URL, headers=HEADERS, json=finish_upload_data)
print(finish_upload_response)
Path Params
string
required
Defaults to 22222222-0000-0000-0000-000000000000

An applicant's UUID

Query Params
string
Defaults to secret-api-token
string

Applicant Data Key (ex: drivers_license)

string

Key returned by S3 after upload

Headers
string
required
Defaults to secret-api-token

Access Token

Responses

Language
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json