Create a file

Creates a file.

Additionally, a file can be sent by:

  • Multipart/form-data POST request: In this request, the file is uploaded and all property names are the same as the JSON names.
  • File body request: In this request, the file body is sent as the request body, with the appropriate Content-Type. No additional properties can be set with the request data.

Permitted file types: .jpg, .png, .gif, .pdf, and .mp3.

When using a publishable API key, only private files can be created. The files can be modified at a later point or time, or can be accessed using a secret API key.

SecuritySecretApiKey or JWT or PublishableApiKey
Request
Request Body schema: application/json
One of:
file
required
string

File in base64 encoded format.

isPublic
boolean

Specifies if the file is available publicly without authentication. If this value is true, the permalink in the _links section contains the public URL.

name
string

File name used for downloading.

description
string

Description of the file.

sourceType
string or null

Source of the file.

Enum: "upload" "camera"
tags
Array of strings

List of tags associated with the file.

Responses
201

File created.

Response Headers
Location
string <uri>

Location of the related resource.

Example: "https://api.rebilly.com/example"
Response Schema: application/json
id
string <= 50 characters

Unique resource ID. Defaults to UUID v4.

name
string

Original file name.

extension
string

File extension.

description
string

Description of the file.

sourceType
string or null

Source of the file.

Enum: "upload" "camera" "organization-export" "organization-closure-export"
tags
Array of strings

List of tags associated with the file.

mime
string

MIME type of the file.

Enum: "image/png" "image/jpeg" "image/gif" "application/pdf"
size
integer

File size, in bytes.

width
integer

Image width. This field applicable to images only.

height
integer

Image height. This field applicable to images only.

sha1
string

Hash sum of the file.

createdTime
string <date-time> (CreatedTime)

Date and time which is set automatically when the resource is created.

updatedTime
string <date-time> (UpdatedTime)

Date and time which updates automatically when the resource is updated.

isPublic
boolean

Specifies if the file is available publicly without authentication. If this value is true, the permalink in the _links section contains the public URL.

Array of objects

Related links.

Array
href
string

Link URL.

rel
string

Type of link.

Enum: "self" "download" "signedLink" "permalink"
401

Unauthorized access. Invalid credentials used.

403

Access forbidden.

422

Invalid data sent.

post/files
Request samples
application/json
{
  • "file": "R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=",
  • "isPublic": false,
  • "name": "logo.png",
  • "description": "My file description",
  • "sourceType": "upload",
  • "tags": [
    ]
}
Response samples
application/json
{
  • "id": "4f6cf35x-2c4y-483z-a0a9-158621f77a21",
  • "name": "string",
  • "extension": "string",
  • "description": "string",
  • "sourceType": "upload",
  • "tags": [
    ],
  • "mime": "image/png",
  • "size": 0,
  • "width": 0,
  • "height": 0,
  • "sha1": "string",
  • "createdTime": "2019-08-24T14:15:22Z",
  • "updatedTime": "2019-08-24T14:15:22Z",
  • "isPublic": true,
  • "_links": [
    ]
}