Skip to main content

File Mutation

Upload File

uploadFile imports a file from a source URL and creates the Nolt file record. The complete workflow is:

  1. Make the source file available at an HTTPS URL that Nolt's server can fetch without browser cookies or an interactive login.
  2. Call uploadFile with that URL. Nolt retrieves the source, stores it, and returns the file record.

The mutation is not a binary-upload endpoint. If the file is not already available by URL, upload it to your own storage service first.

Required Headers

HeaderDescription
Content-Type: application/jsonGraphQL requests use a JSON body
apikeyA write-enabled API key; it also scopes the request to a board
ssotypeSSO type for the user making the request
ssoidSSO ID for the user making the request

Mutation Structure

mutation UploadFile(
$url: String!
$type: String!
$filename: String
$commentId: String
) {
uploadFile(
url: $url
type: $type
filename: $filename
commentId: $commentId
) {
id
bytes
cloudinaryId
name
url
type
version
legacyUrl
commentId
}
}

Input Fields

FieldTypeDescription
urlString!Publicly fetchable source URL
typeString!profile-image or comment
filenameStringOptional filename to use when storing the file
commentIdStringRequired for comment; must identify an existing comment

Complete cURL Example

curl -X POST \
-H "Content-Type: application/json" \
-H "apikey: YOUR_API_KEY" \
-H "ssotype: SSO" \
-H "ssoid: USER_SSO_ID" \
--data '{"query":"mutation UploadFile($url: String!, $type: String!, $filename: String, $commentId: String) { uploadFile(url: $url, type: $type, filename: $filename, commentId: $commentId) { id name url type commentId } }","variables":{"url":"https://files.example.com/screenshot.png","type":"comment","filename":"screenshot.png","commentId":"COMMENT_ID"}}' \
https://api.nolt.io/api/v1/graphql

Profile Image

For profile-image, the ssotype and ssoid headers identify the existing board user whose profile image will be updated. Do not pass commentId.

mutation UploadProfileImage($url: String!, $filename: String) {
uploadFile(url: $url, type: "profile-image", filename: $filename) {
id
name
url
type
}
}

Comment Attachment

For comment, commentId is required. The mutation creates the association between the returned file and that comment.

mutation UploadCommentAttachment(
$url: String!
$filename: String
$commentId: String!
) {
uploadFile(
url: $url
type: "comment"
filename: $filename
commentId: $commentId
) {
id
name
url
type
commentId
}
}

Error Handling

The API returns GraphQL errors for an invalid or read-only API key, missing SSO headers, an unsupported type, a missing or unknown commentId, an unknown profile user, or a source URL that the upload service cannot fetch.