Skip to main content
POST
Prepare an upload to OneDrive or SharePoint, or a replacement of an existing file's content, for a client with a shell

Authorizations

x-api-key
string
header
required

Organization API key passed as the x-api-key header. The raw key is the header value; do not prefix it with Bearer.

Body

application/json
size
integer
required

Exact file size in bytes.

Required range: 1 <= x <= 250000000000
driveId
string

The file's driveId from a search, folder or link result. Omit for the member's own OneDrive.

Required string length: 1 - 512
itemId
string

Replace this existing file's content. It keeps its link and sharing; the previous version stays in its version history.

Required string length: 1 - 512
baseRevision
string

Required with itemId: the eTag your copy was downloaded from. Refused with drive_conflict when the file changed since; download it again and reapply the edits, or save a new file.

Required string length: 1 - 512
Pattern: ^[\x20-\x7e]+$
folderId
string

New files only: the folder to create the file in; omit for the top of the drive.

Required string length: 1 - 512
name
string

New files only: the file name.

Required string length: 1 - 255
conflictBehavior
enum<string>
default:fail

New files only: fail, or let Microsoft rename the file when the name is taken.

Available options:
fail,
rename

Response

Secret upload session; file not yet uploaded.

ok
boolean
required
uploadUrl
string<uri>
required

Secret bearer upload-session URL. Never print, share, persist or log it, and never send an Authorization header to it.

method
string
required
Allowed value: "PUT"
size
integer
required
Required range: -9007199254740991 <= x <= 9007199254740991
chunkSize
number
required
expiresAt
string<date-time> | null
required
Pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
instructions
string
required
replaces
object

Present when the upload replaces an existing file's content.