API Documentation
Each service in the Pinner ecosystem provides self-hosted OpenAPI (Swagger) documentation.
Service Endpoints
| Service | Domain | Description |
|---|---|---|
| IPFS | ipfs.pinner.xyz | File upload, pinning, TUS protocol |
| Account | account.pinner.xyz | User account, API keys, limits |
Accessing Swagger Docs
Every service exposes three documentation endpoints:
| Endpoint | Format | Description |
|---|---|---|
/swagger | HTML | Interactive Swagger UI |
/swagger.yaml | YAML | OpenAPI specification file |
/swagger.json | JSON | OpenAPI specification file |
Examples
IPFS Service:- https://ipfs.pinner.xyz/swagger - Interactive UI
- https://ipfs.pinner.xyz/swagger.yaml - YAML spec
- https://ipfs.pinner.xyz/swagger.json - JSON spec
- https://account.pinner.xyz/swagger - Interactive UI
- https://account.pinner.xyz/swagger.yaml - YAML spec
- https://account.pinner.xyz/swagger.json - JSON spec
Using Swagger UI
The interactive Swagger UI allows you to:
- Browse all available endpoints
- View request/response schemas
- Execute API calls directly from the browser
- Generate client code in multiple languages
Programmatic Access
Download the OpenAPI spec for use in code generation tools:
# Download IPFS service spec
curl -o ipfs-swagger.json https://ipfs.pinner.xyz/swagger.json
# Download Account service spec
curl -o account-swagger.json https://account.pinner.xyz/swagger.jsonGenerate TypeScript Clients with Orval
Orval generates type-safe TypeScript clients from OpenAPI specifications with support for multiple frameworks including React Query, SWR, Angular, and plain fetch.
Installation
npm install orval --save-devConfiguration
Create an orval.config.ts file in your project:
import { defineConfig } from "orval";
export default defineConfig({
pinner: {
input: "./pinner-api.yaml",
output: {
mode: "tags",
client: "react-query",
target: "src/api",
schemas: "src/api/model",
},
},
});Generate API Client
# Download the OpenAPI spec
curl -o pinner-api.yaml https://ipfs.pinner.xyz/swagger.yaml
# Generate TypeScript client
npx orvalFramework-Specific Examples
React Query (default):import { useQuery, useMutation } from "@tanstack/react-query";
import { getPins, uploadFile } from "./src/api/pinner";
function PinsComponent() {
const { data, isLoading } = useQuery({
queryKey: ["pins"],
queryFn: getPins,
});
// ...
}import useSWR from "swr";
import { getPins } from "./src/api/pinner";
function PinsComponent() {
const { data } = useSWR("/pins", getPins);
// ...
}import { getPins } from "./src/api/pinner";
async function fetchPins() {
const response = await getPins();
return response.data;
}Using with Portal SDK
The portal-sdk demonstrates Orval integration with the Account API:
# From the portal-sdk directory
cd libs/portal-sdk
pnpm orvalThis generates type-safe clients at src/account/generated/ with fetch-based HTTP calls.
See Also
- Authentication - API authentication
- Small File Uploads - POST upload method
- Large File Uploads - TUS resumable uploads
- Archive Uploads - Archive-specific options
- Upload Limits - Check account limits