Skip to content

Storage​

Direct uploads of images to the platform's CDN bucket, and the record of the original and the crop behind each cropped image.


Upload an image​

POST
/storage/upload

Stores a base64-encoded raster image on the platform CDN and returns its public URL, which the media gallery, outcome reports and the campaign form accept. Requires a bearer session. Only raster image types are accepted (no SVG or HTML), into one of the StorageBucket folders. Omit path and the server stores the file under a new unique path beginning with the caller's user id, returned as path. A supplied path must begin with the caller's own user id, profile id or Cognito sub, the same rule POST /storage/delete applies. An upload never replaces an existing file. A file may be up to 15 MB (the original of a cropped photo).

Authorizations​

BearerAuth

In the browser, authentication rides on the httpOnly session cookies set by /cognito/signin or the Google / Apple sign-in at /cognito/oauth/{provider}. For scripts and for Swagger UI testing, paste an API key (fh_live_…, created with POST /api-keys); a Cognito JWT is accepted too. Sign-in does not return a token in its body.

Type
HTTP (bearer)

Request Body​

application/json
JSON
{
"bucket": "string",
"path": "3f6c1b9e-7d2a-4c8e-9b1f-2a4d6e8f0c13/cover-1717171717.jpg",
"fileBase64": "string",
"contentType": "string"
}

Responses​

Stored

application/json
JSON
{
"success": true,
"url": "string",
"path": "string"
}

Playground​

Server
Authorization
Body

Samples​


Read the original and the crop behind a cropped image​

GET
/image-crops

The record POST /image-crops saved for a cropped image, so the crop dialog can reopen on the original. The original holds whatever the crop cut away, so only the record's author, the image's owner (as POST /image-crops judges it) and staff who edit other people's images can read it; anybody else gets the same 404 as an image with no record, and the dialog then edits the image itself. Requires a bearer session.

Authorizations​

BearerAuth

In the browser, authentication rides on the httpOnly session cookies set by /cognito/signin or the Google / Apple sign-in at /cognito/oauth/{provider}. For scripts and for Swagger UI testing, paste an API key (fh_live_…, created with POST /api-keys); a Cognito JWT is accepted too. Sign-in does not return a token in its body.

Type
HTTP (bearer)

Parameters​

Query Parameters

url*

The cropped image's URL (output_url).

Type
string
Required
Format
"uri"
Max Length
2048

Responses​

The original and the crops

application/json
JSON
{
"original_url": "string",
"crop": "string",
"secondary_crop": "string"
}

Playground​

Server
Authorization
Variables
Key
Value

Samples​


Record the original and the crop behind a cropped image​

POST
/image-crops

Every image upload and edit goes through one crop dialog, which uploads the untouched original next to the cropped output and then records here where the crop sits on the original, keyed by the output's URL, so editing the image later reopens the dialog on the original with the crop restored. Both URLs must be images on the FundlyHub CDN: the original an upload into one of the StorageBucket folders, the output that or a processed avatar, organization logo or banner. The caller must own the output: its path begins with their id (an upload or their own avatar), or they may manage that user or organization. Saving again for the same output replaces the record, but only its own author can do that. Requires a bearer session.

Authorizations​

BearerAuth

In the browser, authentication rides on the httpOnly session cookies set by /cognito/signin or the Google / Apple sign-in at /cognito/oauth/{provider}. For scripts and for Swagger UI testing, paste an API key (fh_live_…, created with POST /api-keys); a Cognito JWT is accepted too. Sign-in does not return a token in its body.

Type
HTTP (bearer)

Request Body​

application/json
JSON
{
"output_url": "https://fundlyhub.org/uploads/community-photos/3f6c1b9e-7d2a-4c8e-9b1f-2a4d6e8f0c13/1717171717-crop.jpg",
"original_url": "https://fundlyhub.org/uploads/community-photos/3f6c1b9e-7d2a-4c8e-9b1f-2a4d6e8f0c13/1717171716-original.jpg",
"crop": "string",
"secondary_crop": {
"area": {
"x": 0,
"y": 0,
"width": 0,
"height": 0
},
"zoom": 0,
"rotation": 0
}
}

Responses​

Recorded

application/json
JSON
{
"data": {
"output_url": "string",
"original_url": "string",
"crop": "string",
"secondary_crop": {
"area": {
"x": 0,
"y": 0,
"width": 0,
"height": 0
},
"zoom": 0,
"rotation": 0
},
"created_at": "string"
}
}

Playground​

Server
Authorization
Body

Samples​


Delete an uploaded image​

POST
/storage/delete

Deletes one uploaded file. The path's first segment must be the caller's own user id, profile id or Cognito sub; files uploaded under any other prefix cannot be deleted through this endpoint. Requires a bearer session.

Authorizations​

BearerAuth

In the browser, authentication rides on the httpOnly session cookies set by /cognito/signin or the Google / Apple sign-in at /cognito/oauth/{provider}. For scripts and for Swagger UI testing, paste an API key (fh_live_…, created with POST /api-keys); a Cognito JWT is accepted too. Sign-in does not return a token in its body.

Type
HTTP (bearer)

Request Body​

application/json
JSON
{
"bucket": "string",
"path": "string"
}

Responses​

Deleted

application/json
JSON
{
"success": true
}

Playground​

Server
Authorization
Body

Samples​


Powered by VitePress OpenAPI

Built with VitePress