Brive Developers Back to Brive
Brive API v1

Developer Documentation

Upload and manage media through Brive using your Blogger Mind account and a Brive API key.

BASE URL https://brive.bloggersminds.com/api/v1
Brive returns a canonical public media URL for every successful upload. Your application can use that URL directly in an <img>, <video>, CSS file, or other supported media context.

Getting Started

Brive lets your application store media through the Brive API without connecting to Google Drive directly. Your application sends a Brive API key, Brive selects an available connected Drive, stores the media, and returns a public Brive URL.

1. Create a Brive API key Create a key from your Blogger Mind account and keep the secret on your server.
2. Send the file to Brive Use POST /api/v1/media with Authorization: Bearer ....
3. Read the JSON response Store the returned media ID and public URL in your application.
4. Use the public media URL Use the returned url wherever your application needs the uploaded media.

Authentication

Brive API requests use a Bearer API key. Send the key in the HTTP Authorization header.

Authorization: Bearer YOUR_BRIVE_API_KEY
Never put your Brive API key directly into public HTML, client-side JavaScript, browser source code, or a public repository. Keep the key on your server.

API keys are tied to the existing Blogger Mind user account. Brive does not require a separate Brive user account.

Rate Limits

Brive protects the public API against excessive requests and abuse. Rate limits are applied separately to each API key.

Current limits
500 requests per minute
5,000 requests per hour

These limits are controlled by Brive and may be changed by the Brive administrator.

Rate-limit headers

API responses include rate-limit information so your application can monitor its remaining allowance.

X-RateLimit-Limit: 500X-RateLimit-Remaining: 497X-RateLimit-Hour-Limit: 5000X-RateLimit-Hour-Remaining: 4997

When the limit is exceeded

Brive returns HTTP 429 Too Many Requests. The response includes a Retry-After header telling your application how many seconds to wait before retrying.

HTTP/1.1 429 Too Many Requests
Retry-After: 45

{
  "success": false,
  "error": {
    "code": "rate_limit_exceeded",
    "message": "Too many requests. Please try again later."
  }
}
Your application should handle HTTP 429 responses gracefully and retry after the specified Retry-After period.

Upload Media

POST https://brive.bloggersminds.com/api/v1/media

Request

Send a multipart/form-data request with the file in the file field.

POST /api/v1/media
Authorization: Bearer YOUR_BRIVE_API_KEY
Content-Type: multipart/form-data

file = your-image.jpg

Request requirements

  • Use POST.
  • Send multipart/form-data.
  • Send the API key as a Bearer token.
  • Send the media file in the file field.
  • Keep the API key server-side; do not expose it to browsers.

Supported upload field

The documented field is file. The current API also accepts media for compatibility with the Brive website uploader.

API Responses

A successful upload returns HTTP 201 Created and a JSON response containing the media metadata.

{
  "success": true,
  "media": {
    "id": 1842,
    "filename": "hero-image.webp",
    "original_filename": "hero-image.webp",
    "mime_type": "image/webp",
    "file_size": 248392,
    "url": "https://brive.bloggersminds.com/m/1842",
    "thumbnail_url": "https://brive.bloggersminds.com/m/1842",
    "is_public": true,
    "created_at": "2026-08-22T15:00:00+06:00"
  }
}
Field Meaning
id Brive media ID.
filename Stored filename used by Brive.
original_filename Original filename supplied by the uploader.
mime_type Validated MIME type of the uploaded media.
file_size File size in bytes.
url Canonical public Brive media URL.
thumbnail_url Currently the same canonical URL.
is_public Whether the media is publicly accessible.
created_at Media creation timestamp.

Get Media

GET https://brive.bloggersminds.com/api/v1/media?id=1842

This returns metadata for a media item owned by the authenticated API-key user.

GET /api/v1/media?id=1842
Authorization: Bearer YOUR_BRIVE_API_KEY

The response uses the same media metadata contract as the upload response.

Delete Media

DELETE https://brive.bloggersminds.com/api/v1/media?id=1842
DELETE /api/v1/media?id=1842
Authorization: Bearer YOUR_BRIVE_API_KEY

Brive verifies that the media belongs to the authenticated Blogger Mind user, removes it through the media manager, and marks the local media record as deleted.

{
  "success": true,
  "deleted": {
    "id": 1842
  }
}

PHP Example

This example uploads an image from a PHP server and reads the Brive response.

<?php

$apiKey = 'YOUR_BRIVE_API_KEY';
$filePath = '/path/to/image.jpg';

$ch = curl_init(
    'https://brive.bloggersminds.com/api/v1/media'
);

curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . $apiKey,
        'Accept: application/json',
    ],
    CURLOPT_POSTFIELDS => [
        'file' => new CURLFile(
            $filePath,
            'image/jpeg',
            'image.jpg'
        ),
    ],
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT => 120,
]);

$response = curl_exec($ch);

if ($response === false) {
    throw new RuntimeException(curl_error($ch));
}

$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);

curl_close($ch);

$data = json_decode($response, true);

if ($status < 200 || $status >= 300 || empty($data['success'])) {
    throw new RuntimeException(
        $data['error']['message'] ?? 'Brive upload failed.'
    );
}

$mediaId = $data['media']['id'];
$mediaUrl = $data['media']['url'];
$mimeType = $data['media']['mime_type'];
$fileSize = $data['media']['file_size'];

echo $mediaUrl;

Use the returned values

$data['media']['id'];
$data['media']['url'];
$data['media']['mime_type'];
$data['media']['file_size'];

For example, $data['media']['url'] can become the source of an image on your website:

<img
    src="<?= htmlspecialchars($data['media']['url']) ?>"
    alt="Uploaded image"
>

cURL example

curl -X POST \
  -H "Authorization: Bearer YOUR_BRIVE_API_KEY" \
  -H "Accept: application/json" \
  -F "file=@/path/to/image.jpg" \
  https://brive.bloggersminds.com/api/v1/media

The API returns JSON. Your application can parse the response and store the returned id or url.

API Responses

Brive returns JSON for API requests. A successful upload returns the media metadata needed by the external application to store and use the Brive media URL.

{
  "success": true,
  "media": {
    "id": 1842,
    "filename": "hero-image.webp",
    "original_filename": "hero-image.webp",
    "mime_type": "image/webp",
    "file_size": 248392,
    "url": "https://brive.bloggersminds.com/m/1842",
    "thumbnail_url": "https://brive.bloggersminds.com/m/1842",
    "is_public": true,
    "created_at": "2026-08-11T21:00:00+06:00"
  }
}

Important response fields

  • media.id — Brive media ID.
  • media.url — canonical public media URL.
  • media.filename — stored filename.
  • media.original_filename — original uploaded filename.
  • media.mime_type — detected media MIME type.
  • media.file_size — file size in bytes.
  • media.is_public — whether the media is publicly accessible.
  • media.created_at — creation timestamp.

Errors

Errors use a consistent JSON structure.

{
  "success": false,
  "error": {
    "code": "invalid_api_key",
    "message": "Invalid API key."
  }
}
HTTP status Example code Meaning
429 rate_limit_exceeded The API key exceeded its configured request limit. Wait for the Retry-After period before retrying.
400 missing_file The upload request did not contain a file.
400 invalid_request The request parameters are invalid.
401 invalid_api_key The API key is missing or invalid.
401 inactive_api_key The API key has been revoked or disabled.
401 expired_api_key The API key has expired.
404 request_failed The requested media could not be found.
405 method_not_allowed The HTTP method is not supported.
409 request_failed No active Drive is currently available.
500 server_error An unexpected Brive server error occurred.

Language Examples

Brive currently documents integration examples for PHP, JavaScript, Python, and Node.js. Keep secret API keys on your server and never expose them in public browser code.

JavaScript Example

For security, do not expose a Brive secret API key in browser-side JavaScript. This example is intended for a server-side JavaScript environment such as Node.js.

const form = new FormData();
form.append('file', file);

const response = await fetch('https://brive.bloggersminds.com/api/v1/media', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer ' + process.env.BRIVE_API_KEY
  },
  body: form
});

const data = await response.json();
console.log(data.media?.url);

Python Example

import os
import requests

with open('image.jpg', 'rb') as image:
    response = requests.post(
        'https://brive.bloggersminds.com/api/v1/media',
        headers={
            'Authorization': f"Bearer {os.environ['BRIVE_API_KEY']}"
        },
        files={
            'file': ('image.jpg', image, 'image/jpeg')
        },
        timeout=60
    )

data = response.json()
print(data.get('media', {}).get('url'))

Node.js Example

Node.js applications can use the native fetch API with FormData and a file stream.

const fs = require('node:fs');

const form = new FormData();
form.append('file', new Blob([fs.readFileSync('image.jpg')], {
  type: 'image/jpeg'
}), 'image.jpg');

const response = await fetch(
  'https://brive.bloggersminds.com/api/v1/media',
  {
    method: 'POST',
    headers: {
      Authorization: 'Bearer ' + process.env.BRIVE_API_KEY
    },
    body: form
  }
);

const data = await response.json();
console.log(data.media?.url);

Public media URLs

Brive's canonical public media URL is:

https://brive.bloggersminds.com/m/1842

The URL is designed to be used directly by external websites. For an image:

<img src="https://brive.bloggersminds.com/m/1842" alt="Image">

The media endpoint returns the appropriate media Content-Type and serves public media inline.

The API key authenticates API operations. The returned public media URL is separate from the API authentication mechanism.