Skip to main content
POST
/
v1
/
files
PHP (SDK)
declare(strict_types=1);

require 'vendor/autoload.php';

use Spaire;
use Spaire\Models\Components;

$sdk = Spaire\Spaire::builder()
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();

$request = new Components\DownloadableFileCreate(
    organizationId: '1dbfc517-0bbf-4301-9ba8-555ca42b9737',
    name: '<value>',
    mimeType: '<value>',
    size: 612128,
    upload: new Components\S3FileCreateMultipart(
        parts: [],
    ),
);

$response = $sdk->files->create(
    request: $request
);

if ($response->fileUpload !== null) {
    // handle response
}
{
  "id": "<string>",
  "organization_id": "<string>",
  "name": "<string>",
  "path": "<string>",
  "mime_type": "<string>",
  "size": 123,
  "storage_version": "<string>",
  "checksum_etag": "<string>",
  "checksum_sha256_base64": "<string>",
  "checksum_sha256_hex": "<string>",
  "last_modified_at": "2023-11-07T05:31:56Z",
  "upload": {
    "id": "<string>",
    "path": "<string>",
    "parts": [
      {
        "number": 123,
        "chunk_start": 123,
        "chunk_end": 123,
        "url": "<string>",
        "expires_at": "2023-11-07T05:31:56Z",
        "checksum_sha256_base64": "<string>",
        "headers": {}
      }
    ]
  },
  "version": "<string>",
  "size_readable": "<string>",
  "is_uploaded": false
}

Documentation Index

Fetch the complete documentation index at: https://docs.spairehq.com/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

You can generate an Organization Access Token from your organization's settings.

Body

application/json

Schema to create a file to be associated with the downloadables benefit.

name
string
required
mime_type
string
required
size
integer
required
upload
S3FileCreateMultipart · object
required
service
string
required
Allowed value: "downloadable"
organization_id
string<uuid4> | null

The organization ID.

Example:

"1dbfc517-0bbf-4301-9ba8-555ca42b9737"

checksum_sha256_base64
string | null
version
string | null

Response

File created.

id
string<uuid4>
required

The ID of the object.

organization_id
string<uuid4>
required
name
string
required
path
string
required
mime_type
string
required
size
integer
required
storage_version
string | null
required
checksum_etag
string | null
required
checksum_sha256_base64
string | null
required
checksum_sha256_hex
string | null
required
last_modified_at
string<date-time> | null
required
upload
S3FileUploadMultipart · object
required
version
string | null
required
service
enum<string>
required
Available options:
downloadable,
product_media,
organization_avatar
size_readable
string
required
is_uploaded
boolean
default:false