Files
File Fields
Field | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
attached_to |
object | Other objects that this file is embedded in as a raw object.
Only set if the file has been attached to another object.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
audio_info |
object | Audio properties.
Only set if
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
created_at |
string | The time at which the file was created in ISO 8601 format; YYYY-MM-DDTHH:MM:SSZ. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
derived_files |
object | Up to 10 derivative files. The keys can be anything, though keys starting with core_ are reserved. Reserved keys are allowed if they match specified parameters. For example:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
file_token |
string | A token to allow you to modify the file.
Only set on |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
file_token_read |
string | A token to allow you to access the file.
Only set if |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
id |
string | Primary identifier for a file. This will be an integer, but it is always expressed as a string to avoid limitations with the way JavaScript integers are expressed. This id space is unique to file objects. There can be a File and User with the same ID; no relation is implied. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
image_info |
object | Image properties.
Only set if
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
is_complete |
boolean | Whether file is a placeholder, or the contents have been uploaded. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
is_public |
boolean | Whether file is public or private. If private, it still may be attached to a public object, such as a post. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
kind |
string | Valid options are audio , video , image , and other . audio is currently limited to 52428800-byte files (32MiB). See Mime Types for explanation. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mime_type |
string | Mime encoding of the file. See Mime Types for details.
Only set if file is complete. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
name |
string | A readable name of the file. Can be used descriptively or not. Up to 256 Unicode characters. Be sure to escape if necessary. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
raw |
object | The raw items attached to this object.
Only set if query parameter specified.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
sha256 |
string | sha256 checksum of file.
Only set if file is complete. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
size |
integer | Size of the file in bytes.
Only set if file is complete. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
source |
object | An embedded object of the client that created the file. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
total_size |
integer | Size of the file plus any derivative files, in bytes.
Only set if file is complete. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
type |
string | The type of file. Generally uses a reversed domain name to identify the intended purpose. Non-core file types (io.pnut.core.* ) are not authenticated by the server; clients should not assume other clients created their file types the same way. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
user |
object | This is an embedded User object.
In certain cases, this key may be omitted. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
user_id |
string | Primary identifier for the user who created the file.
Only set if the |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
url |
string | Direct link to the file, but with an expiration.
Only set if file is complete. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
url_expires_at |
string | ISO 8601 timestamp of when url will expire; YYYY-MM-DDTHH:MM:SSZ. After expiration, file object will need to be fetched to get a new link (GET /files/{file_id} , this also refreshes any derivative files).
Only set if file is complete. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
url_short |
string | A redirect link to the file.
Only set if |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
upload_parameters |
object |
Only set on creation of a file placeholder.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
video_info |
object | Video properties.
Only set if
|
General File Parameters
Any endpoint that returns file objects can be subject to these parameters.
General Parameters
Name | Type | Description | Default |
---|---|---|---|
include_client |
integer (0 or 1) | Include client object. If false, a source_id field will be included instead. |
true |
include_incomplete |
integer (0 or 1) | Include incomplete files. Only applicable to the user's file stream. | true |
include_private |
integer (0 or 1) | Include private files. Only applicable to the user's file stream. | true |
mime_types |
list | Comma-separated list of mime types to retrieve. Only applicable to the user's file stream. | all |
file_types |
string | Comma-separated list of file types to retrieve. Only applicable to the user's file stream. If not included, will return any files the app is authorized to view. | all |
exclude_file_types |
string | Comma-separated list of file types not to retrieve. Only applicable to the user's file stream. Ignored if file_types set. |
none |
include_raw |
integer (0 or 1) | Include raw on all objects. | false |
include_file_raw |
integer (0 or 1) | Include raw on all file objects. | false |
include_user |
integer (0 or 1) | Include user object. If false, a user_id field will be included instead. |
true |
Mime Types
kind
and mime_type
must be coordinated.
Both are optional when uploading a file in one step.
If creating a file placeholder and uploading later, kind
is required on creation, and mime_type
is optional on file upload.
- If you specify both, it will return an error if they do not match.
- If you do not specify either, the API will interpret
mime_type
and assignkind
based on what it finds. - If you only specify
kind
, the API will interpretmime_type
and return an error if they do not match. - If you only specify
mime_type
, the API will assignkind
based onmime_type
.
Multiple mime types are accepted for some file types, but they will be normalized and recorded as a single mime type listed in the charts below.
File Encoding
If the included mime_type
matches any of the following, its text encoding will attempt to be detected by the server (i.e., for UTF-8 encoding):
text/{anything}
application/msword
application/vnd.oasis.opendocument.text
application/rtf
application/xml
application/json
application/javascript
Audio
Files with kind: audio
must have the following mime_type
:
File Type | mime_type |
Also accepted |
---|---|---|
MP3 | audio/mpeg | audio/mp3 |
MP4 | audio/mp4 | audio/m4a, audio/x-m4a |
WAVE | audio/wave | audio/wav, audio/x-wav, audio/x-pn-wav |
FLAC | audio/flac | audio/x-flac |
Video
Files with kind: video
must have the following mime_type
:
File Type | mime_type |
Also accepted |
---|---|---|
MP4 | video/mpeg | video/quicktime, video/m4v, video/x-m4v, video/mp4 |
WEBM | video/webm | - |
Image
Files with kind: image
must have the following mime_type
:
File Type | mime_type |
Also accepted |
---|---|---|
PNG | image/png | - |
JPEG | image/jpeg | image/jpg |
GIF | image/gif | - |