CSV Upload
const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'x-partner': '<x-partner>',
'Content-Type': 'application/json'
},
body: JSON.stringify({file_name: '<string>', data: '<string>'})
};
fetch('https://api.dcycle.io/v1/hotel-stays/bulk/csv', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/v1/hotel-stays/bulk/csv"
payload = {
"file_name": "<string>",
"data": "<string>"
}
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>",
"x-partner": "<x-partner>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://api.dcycle.io/v1/hotel-stays/bulk/csv \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>' \
--header 'x-partner: <x-partner>' \
--data '
{
"file_name": "<string>",
"data": "<string>"
}
'{
"upload_url": "<string>",
"file_name": "<string>",
"file_id": "<string>",
"destination_file_key": "<string>",
"message": "<string>",
"organization_id": "<string>"
}CSV Upload
Generate a presigned URL for bulk hotel stays CSV upload
POST
/
v1
/
hotel-stays
/
bulk
/
csv
CSV Upload
const options = {
method: 'POST',
headers: {
'x-api-key': '<x-api-key>',
'x-organization-id': '<x-organization-id>',
'x-partner': '<x-partner>',
'Content-Type': 'application/json'
},
body: JSON.stringify({file_name: '<string>', data: '<string>'})
};
fetch('https://api.dcycle.io/v1/hotel-stays/bulk/csv', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.dcycle.io/v1/hotel-stays/bulk/csv"
payload = {
"file_name": "<string>",
"data": "<string>"
}
headers = {
"x-api-key": "<x-api-key>",
"x-organization-id": "<x-organization-id>",
"x-partner": "<x-partner>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://api.dcycle.io/v1/hotel-stays/bulk/csv \
--header 'Content-Type: application/json' \
--header 'x-api-key: <x-api-key>' \
--header 'x-organization-id: <x-organization-id>' \
--header 'x-partner: <x-partner>' \
--data '
{
"file_name": "<string>",
"data": "<string>"
}
'{
"upload_url": "<string>",
"file_name": "<string>",
"file_id": "<string>",
"destination_file_key": "<string>",
"message": "<string>",
"organization_id": "<string>"
}← Hotel Stays API
Generate a presigned S3 URL for bulk importing hotel stays via CSV. After uploading the file to the presigned URL, the system automatically processes the CSV rows and creates hotel stay records.
Deprecated. Use
POST /v2/hotel-stays: the hotel stays as JSON records in the request, all or nothing, idempotent, with no file to upload. This endpoint keeps working; its responses carry Deprecation and Link: </v2/hotel-stays>; rel="successor-version" headers. Its responses also carry Sunset: Fri, 30 Apr 2027 00:00:00 GMT: the endpoint is retired on April 30, 2027 (see the changelog).Request
Headers
Body Parameters
Response
Example
# Step 1: Get presigned URL
RESPONSE=$(curl -s -X POST "https://api.dcycle.io/v1/hotel-stays/bulk/csv" \
-H "x-api-key: ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}" \
-H "x-partner: dcycle" \
-H "Content-Type: application/json" \
-d '{
"file_name": "hotel-stays-q1-2025.csv",
"data": ""
}')
# Step 2: Upload CSV to presigned URL
UPLOAD_URL=$(echo $RESPONSE | jq -r '.upload_url')
curl -X PUT "$UPLOAD_URL" -H "Content-Type: text/csv" --data-binary @hotel-stays-q1-2025.csv
echo "File ID: $(echo $RESPONSE | jq -r '.file_id')"
import requests
import os
# Step 1: Get presigned URL
response = requests.post(
"https://api.dcycle.io/v1/hotel-stays/bulk/csv",
headers={
"x-api-key": os.getenv("DCYCLE_API_KEY"),
"x-organization-id": os.getenv("DCYCLE_ORG_ID"),
"x-partner": "dcycle",
"Content-Type": "application/json",
},
json={
"file_name": "hotel-stays-q1-2025.csv",
"data": "",
},
)
result = response.json()
# Step 2: Upload CSV to presigned URL
with open("hotel-stays-q1-2025.csv", "rb") as f:
requests.put(result["upload_url"], data=f, headers={"Content-Type": "text/csv"})
print(f"File ID: {result['file_id']}")
const axios = require('axios');
const fs = require('fs');
// Step 1: Get presigned URL
const { data } = await axios.post('https://api.dcycle.io/v1/hotel-stays/bulk/csv', {
file_name: 'hotel-stays-q1-2025.csv',
data: '',
}, {
headers: {
'x-api-key': process.env.DCYCLE_API_KEY,
'x-organization-id': process.env.DCYCLE_ORG_ID,
'x-partner': 'dcycle',
'Content-Type': 'application/json',
},
});
// Step 2: Upload CSV to presigned URL
const csv = fs.readFileSync('hotel-stays-q1-2025.csv');
await axios.put(data.upload_url, csv, { headers: { 'Content-Type': 'text/csv' } });
console.log(`File ID: ${data.file_id}`);
Successful Response
{
"upload_url": "https://s3.eu-west-1.amazonaws.com/dcycle-uploads/...",
"file_name": "hotel-stays-q1-2025.csv",
"file_id": "file-uuid",
"destination_file_key": "organizations/org-uuid/hotel-stays/file-uuid.csv",
"message": "Upload URL generated successfully",
"organization_id": "org-uuid"
}
Common Errors
401 Unauthorized
Cause: Missing or invalid API key{"detail": "Invalid API key for organization", "code": "INVALID_API_KEY"}
403 Forbidden
Cause: The authenticated user is not a member of the organization{"detail": "Logged User is not Member of Organization", "code": "LOGGED_USER_NOT_MEMBER"}
422 Unprocessable Entity
Cause: Missing required fields (e.g.file_name)
{
"detail": [
{
"loc": ["body", "file_name"],
"msg": "field required",
"type": "value_error.missing"
}
]
}
Related Endpoints
List Hotel Stays
Browse imported hotel stays
Create Hotel Stay
Create a single hotel stay manually
Was this page helpful?