Build with Ghost Deploy

Your code. Connected.

Store files, connect familiar S3 tools and automate your deployments. Start with a guide, then explore the API reference.

API reference

Get started

  1. Create a Space in your workspace and open its access-key settings.
  2. Create a key with the permissions and folder access your application needs. Uploads need write access; downloads need read access.
  3. Copy the connection settings into your server’s environment. Keep the secret out of browser code, mobile apps and Git.

Space keys access files. Workspace API tokens automate applications. These are separate credentials and cannot replace each other.

Spaces & S3

Use a standard S3 SDK with your Space key pair. Set the endpoint to https://spaces.ghostdeploy.com, enable path-style addressing and use the bucket name and signing region shown in your Space’s connection settings.

JavaScript · AWS SDK

import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3';

const s3 = new S3Client({
  endpoint: 'https://spaces.ghostdeploy.com',
  region: process.env.AWS_DEFAULT_REGION,
  forcePathStyle: true,
  credentials: {
    accessKeyId: process.env.AWS_ACCESS_KEY_ID,
    secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
  },
});

await s3.send(new PutObjectCommand({
  Bucket: process.env.AWS_BUCKET,
  Key: 'uploads/hello.txt',
  Body: 'Hello from my application',
  ContentType: 'text/plain',
}));

Laravel · S3 disk

FILESYSTEM_DISK=s3
AWS_ENDPOINT=https://spaces.ghostdeploy.com
AWS_BUCKET=YOUR_SPACE_BUCKET
AWS_DEFAULT_REGION=YOUR_SIGNING_REGION
AWS_USE_PATH_STYLE_ENDPOINT=true
AWS_ACCESS_KEY_ID=YOUR_SPACE_KEY_ID
AWS_SECRET_ACCESS_KEY=YOUR_SPACE_SECRET

Use your existing S3 disk configuration, with its endpoint and path-style options enabled. Private files require authenticated downloads or short-lived signed URLs; do not assume a public object URL.

Python · boto3

import os
import boto3
from botocore.config import Config

s3 = boto3.client('s3',
    endpoint_url='https://spaces.ghostdeploy.com',
    region_name=os.environ['AWS_DEFAULT_REGION'],
    aws_access_key_id=os.environ['AWS_ACCESS_KEY_ID'],
    aws_secret_access_key=os.environ['AWS_SECRET_ACCESS_KEY'],
    config=Config(s3={'addressing_style': 'path'}))
s3.put_object(Bucket=os.environ['AWS_BUCKET'],
              Key='uploads/hello.txt', Body=b'Hello')

S3 requests use AWS Signature Version 4. A native GhostDeploy-Key header does not authenticate an S3 request. S3 compatibility does not include every AWS feature; check your Space’s connection status and the API reference before integrating advanced operations.

Native storage API

Prefer a simple HTTP API? Use https://spaces.ghostdeploy.com/v1/objects with a Space key. Responses use JSON; file downloads return bytes or a short-lived download redirect.

curl https://spaces.ghostdeploy.com/v1/objects \
  -H "Authorization: GhostDeploy-Key $SPACE_KEY_ID:$SPACE_SECRET"

Upload a file

curl -X PUT https://spaces.ghostdeploy.com/v1/objects \
  -H "Authorization: GhostDeploy-Key $SPACE_KEY_ID:$SPACE_SECRET" \
  -H "X-GhostDeploy-Object-Path: uploads/hello.txt" \
  -H "X-GhostDeploy-Upload-Size: 5" \
  -H "Content-Type: text/plain" \
  --data-binary 'Hello'

Use the exact byte size of your file. Retrieve or delete a file at /v1/objects/OBJECT_ID using the object ID returned by the API. Delete access is a separate key permission. Never forward your key to a download redirect; use the client library below to handle it safely.

Deployment API

Create a workspace token in Workspace → API tokens. Select only the scopes your integration needs. Send it as a Bearer token to the workspace API using your workspace’s public ID.

curl https://ghostdeploy.com/api/v1/workspaces/YOUR_WORKSPACE_ID/applications \
  -H "Authorization: Bearer $GD_API_TOKEN"

Listing requires applications.read. Follow data.nextCursor to read another page; the maximum page size is 100.

Deploy an existing application stage

curl -X POST \
  https://ghostdeploy.com/api/v1/workspaces/YOUR_WORKSPACE_ID/applications/STAGE_ID/action \
  -H "Authorization: Bearer $GD_API_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"action":"redeploy"}'

Requires applications.deploy. Use the stage ID from the application listing. A 202 response means the deployment was queued; check its status in your application’s deployment page before treating it as live. Use rebuild only when a clean build is needed.

Create an application

With applications.create, POST your validated application configuration to the applications endpoint. Include a unique Idempotency-Key of 16–200 letters, digits or ._:- characters. Reuse the same key and identical body when retrying an uncertain request. The API reference describes the supported runtime, source, environment and resource fields. Workspace permissions, plan limits and source access still apply.

Client libraries

Download the lightweight server-side clients. They provide native file operations and workspace deployment calls without additional dependencies. For S3 operations, continue using your preferred S3 SDK.

import { SpacesClient, GhostDeployClient } from './ghostdeploy.mjs';

const files = new SpacesClient({
  accessKeyId: process.env.SPACE_KEY_ID,
  secretAccessKey: process.env.SPACE_SECRET,
});
const listing = await files.list();

const gd = new GhostDeployClient({
  token: process.env.GD_API_TOKEN,
  workspaceId: process.env.GD_WORKSPACE_ID,
});
const applications = await gd.applications();

Version 0.1.0 · Downloadable source clients, not npm or PyPI packages. Review updates before replacing the copy used by your application.

Troubleshooting

401 · Check the credential pair
Use a Space key for storage and a workspace token for deployments. Check expiration and revocation.
403 · Check permissions
A successful bucket check does not prove write access. Check the key’s write permission, folder scope and IP restrictions. For S3, check the endpoint, signing region and path-style configuration too.
409 or 423 · Check the current operation
A conflicting operation or active investigation may block another deployment. Check its status before retrying.
429 · Slow down requests
Respect rate limits. Do not retry mutations blindly; application creation retries must use their original idempotency key.
Open the complete API reference