Create a one-time upload link for a file of any accepted size.
Declare the file (name, exact size in bytes and hex SHA-256) and get a file_id plus a one-time upload_url. Then send the exact bytes with an HTTP PUT to upload_url, for example: curl -T "<file>" "<upload_url>". The link works for 15 minutes, only once, and only for a file with exactly this size and SHA-256. The PUT reply, or GET /files/{file_id}, says ready or why the file was refused. Then use the file_id with media[].file_id on POST /posts and PATCH /posts/{id}. Accepted: PNG, JPG or GIF images up to 9 MB; MP4 video up to 450 MB; PDF, Word or PowerPoint up to 90 MB. The real file type is read from its bytes, never from the name. Programs, SVG images, old .doc/.ppt/.xls files, Office files with macros, embedded objects or outside links, and PDFs with scripts are refused. A file is kept for 24 hours and can only be used by the same API key or connected app, with this service. Treat upload_url and upload_token as secrets.
https://app.softsolz.uk/api/v1/services/social/files/upload-linksRecent Requests
Log in to see full request historyHeaders
AuthorizationstringrequiredBearer token: `Bearer sk_live_...` (or `sk_test_...` for sandbox). A login token will not work here.
Body Params
file_namestringFile name, e.g. deck.pptx.
size_bytesintegerExact size of the file in bytes.
sha256stringHex SHA-256 of the file (64 characters).
Response
Response Body
file_idstringPass this id to the service to use the file.statusstringready means the file passed every check and can be used.file_namestringCleaned file name.kindstring | nullWhat the file turned out to be, read from its bytes.mimestring | nullMedia type read from the bytes.size_bytesintegerSize in bytes.sha256string | nullHex SHA-256 of the file.reject_codestring | nullWhy the file was refused, when status is rejected.expires_atstring | nullWhen the file (or, before upload, the link) stops working.created_atstringWhen it was created.upload_urlstringOne-time address to PUT the file bytes to. Secret; expires in 15 minutes.upload_tokenstringThe secret part of upload_url.upload_methodstringAlways PUT.how_to_sendstringA ready-to-run command for sending the file.Request
import { SoftSolz } from '@softsolz/sdk';
const client = new SoftSolz({ apiKey: process.env.SOFTSOLZ_API_KEY });
const result = await client.social.createUploadLink({});console.log(result);Credentials
Sent as a Bearer token. Stored only in your browser.
Response · 201
{ "data": { "file_id": "string", "status": "string", "file_name": "string", "kind": "string", "mime": "string", "size_bytes": 0, "sha256": "string", "reject_code": "string", "expires_at": "string", "created_at": "string", "upload_url": "string", "upload_token": "string", "upload_method": "string", "how_to_send": "string" }}