Documentation Index
Fetch the complete documentation index at: https://docs.devin.ai/llms.txt
Use this file to discover all available pages before exploring further.
This endpoint uploads files to our servers and returns a URL that you can reference in Devin sessions. The file isn’t automatically sent to any session - you need to include the URL in your prompts.
How to Use Uploaded Files
Devin only recognizes attachments when they are written in the exact format ATTACHMENT:"{file_url}" (singular ATTACHMENT, all caps). The ATTACHMENT: line must be on its own line in the prompt, and the URL must be enclosed in double quotes.Simply including the raw URL without this format will not work. Variants like ATTACHMENTS: (plural) are also not recognized.
To reference an uploaded file in a Devin session:
- Upload the file using this endpoint to get a URL
- Include the URL in your prompt when creating a session or sending a message
- Format the URL correctly by putting
ATTACHMENT:"{file_url}" on its own line in your prompt
Complete Example
import os
import requests
DEVIN_API_KEY = os.getenv("DEVIN_API_KEY")
# Step 1: Upload the file
with open("data.csv", "rb") as f:
response = requests.post(
"https://api.devin.ai/v1/attachments",
headers={"Authorization": f"Bearer {DEVIN_API_KEY}"},
files={"file": f}
)
file_url = response.text
# Step 2: Create a session that references the uploaded file
session_response = requests.post(
"https://api.devin.ai/v1/sessions",
headers={"Authorization": f"Bearer {DEVIN_API_KEY}"},
json={
"prompt": f"""Please analyze the data in the attached CSV file and create a summary report.
Focus on identifying trends and key insights.
ATTACHMENT:"{file_url}"
"""
}
)
print(session_response.json())
Important: The ATTACHMENT: prefix must be on its own line in the prompt with the URL enclosed in double quotes, exactly as shown above: ATTACHMENT:"{url}". To attach multiple files, add one ATTACHMENT:"{file_url}" line per file.Personal API Key (apk_user_) or Service API Key (apk_)
The response is of type string.