User Guide

About the REST API

The REST API provides a programmatic interface to interact with our services, allowing you to stamp files, inline data, or existing CIDs. This API is designed to be flexible and secure, supporting various data formats and authentication methods.

Getting Started with the REST API

To begin using the REST API, you need to have a valid API token for authentication. The API is accessible via standard HTTP methods and returns JSON responses.

How to Obtain an API Key

  1. Log in to your vBase account at https://app.vbase.com

  2. In your User Profile, navigate to "Account Settings"

  3. Copy the API key from this screen and store it securely

Base URL

https://app.vbase.com/api/v1/

About the OpenAPI Description for the REST API

Our REST API is documented using OpenAPI, providing a comprehensive description of available endpoints, parameters, and response formats. You can explore the API using the Swagger UI, which offers an interactive interface for testing API calls.

Access the Swagger UI at:

For programmatic clients (agents, SDKs), fetch the OpenAPI/Swagger JSON at:

The Swagger UI route also supports:

Authenticating to the REST API

Authentication is required for all API requests. Use the Bearer token method by including an Authorization header in your requests. The format should be:

Request Validation Rules

For endpoints that use strict request schemas, unknown or unrecognized request keys are rejected with 400 Bad Request. Only documented request fields are accepted.

Keeping your API credentials secure

  • Never share your API token publicly

  • Store your API token securely

  • Use environment variables to store your API token

  • Never commit API tokens to version control

API Endpoints

Verify User Collection

POST /v1/collections/verify

This endpoint verifies a stamped collection against blockchain records for the authenticated user.

Request Formats

Choose the request body format with Content-Type:

  • application/json: send the verify request JSON body

  • text/csv: send the raw CSV string in the body

For JSON requests, top-level collection_name and user_address are optional. If they are omitted or set to null, the backend will try to infer collection metadata from the submitted records.

The context object is also optional and may be omitted or set to null. Each entry in objects may omit file_name or set it to null.

For CSV requests, the leading metadata section collection_name,user_address,collection_timezone is optional.

Legacy multipart/form-data uploads are also supported with a .csv or .json file in the file field.

Use Accept: application/json for the response.

Example Requests

JSON body:

CSV body:

Legacy multipart upload:

Example Response

Response (200):

Each entry in collections identifies the verified collection by:

  • name: collection name

  • cid: collection/set CID

  • user_address: resolved owner address used for verification

  • matched_receipts: blockchain receipts matched to submitted objects for this collection

  • unmatched_objects: submitted objects with no matching blockchain receipt for this collection

  • unmatched_receipts: blockchain receipts with no matching submitted object for this collection

Upload Stamped File

POST /v1/stamps/upload-stamped-file

This endpoint allows you to upload a file or inline data that has been previously stamped and verified against blockchain records.

Overview

The upload stamped file endpoint calculates the object CID from the submitted file or inline data, verifies that matching blockchain commitments exist for the authenticated user and collection, uploads the content, and associates each uploaded file with its matching commitment.

Content must be provided as either file or data, but not both. file_name is required whenever data is provided.

If the same stamped content is uploaded again with a different file name, the endpoint is idempotent: it returns the existing file object with HTTP 200 and does not create another uploaded copy for the same commitment.

If multiple commitments in the collection match the same object CID, the first successful upload stores one timestamped file copy for each matching commitment. The API response contains one matching commitment_receipt and file_object.

Request Parameters

Parameter
Type
Required
Description

collection_name

String

No

Collection name (case-insensitive, must not be empty). Provide this or collection_cid.

collection_cid

String

No

Collection CID (hex hash). Provide this or collection_name.

file

File

No

Previously stamped file to upload. Provide this or data, but not both.

data

String

No

Inline text / JSON data to upload. Provide this or file, but not both.

file_name

String

Conditional

Required when data is provided.

Note: User address is automatically determined from the authenticated user's profile, so no user_address parameter is needed. At least one of collection_name or collection_cid must be present, and exactly one of file or data must be present.

Validation Process

The endpoint performs the following validations in sequence:

  1. Input Validation: Validates collection name is not empty, validates collection identifiers (collection_name/collection_cid), enforces exactly one content source (file xor data), and requires file_name whenever data is provided.

  2. User Address Resolution: Automatically determines user address from authenticated user's profile

  3. Collection Lookup: Finds the collection by name or CID for the authenticated user

  4. CID Calculation: Calculates object CID from the uploaded file, or from inline data when no file is provided

  5. Blockchain Verification: Verifies that matching commitments exist in blockchain records for the user's address and collection

  6. File Association: Uploads the file and associates it with each matching commitment that does not already have a file

  7. Idempotent Duplicate Handling: Returns the existing file object with HTTP 200 when a matching commitment is already associated with a file

Unknown or unrecognized form fields are rejected with 400 Bad Request.

Response Codes

Status Code
Description
When It Occurs

200

File already uploaded

Matching commitment already has an associated file; no duplicate copy is created

201

File uploaded successfully

File passes all validations and uploads successfully for one or more matching commitments

400

Invalid input or validation failed

Empty collection name or missing required parameters

404

Collection not found or no blockchain records found

Collection doesn't exist or no matching blockchain records

500

File processing, blockchain, or upload errors

CID calculation fails, blockchain errors, or upload failures

Example Requests

Successful Upload:

Successful Upload Using Collection CID and Inline Data:

Response (201):

Duplicate Upload Response (200):

Error Responses:

Collection Not Found (404):

No Blockchain Records (404):

File Processing Error (500):

Error Handling

The API uses structured error responses with appropriate HTTP status codes to help you handle different error scenarios:

  • 4xx Client Errors: Issues with your request (missing parameters, invalid data, not found)

  • 5xx Server Errors: Internal processing issues (file processing, blockchain connectivity, upload failures)

Always check the HTTP status code first, then parse the error message for specific details about what went wrong.

Best Practices

  1. Validate Input: Ensure collection names are not empty before sending requests

  2. Handle Errors: Implement proper error handling for all status codes

  3. File Validation: Only upload files that have been previously stamped

  4. Collection Management: Ensure collections exist before attempting uploads

  5. Retry Logic: Implement retry logic for 5xx errors (server issues)

  6. Rate Limiting: Respect API rate limits to avoid throttling

Last updated