Developer Platform
Publish to HashBin from your app
Let your users store 256t content on HashBin.org directly from your web app. Users authorize your app via OAuth 2.0, and uploads are billed to their HashBin balance.
Why register your app?
Security
Redirect URI validation prevents authorization codes from being intercepted. Only your registered origins receive tokens.
User trust
The consent screen shows your app name so users know exactly who is requesting access to their balance.
Spending controls
Users can set per-app monthly spending limits. Revocation and rate limiting are tracked per app.
Integration overview
- Register your app below to get a
client_idandclient_secret. - Redirect users to
/oauth/authorizewith PKCE parameters. - The user signs in (via their existing HashBin account) and approves your app.
- HashBin redirects back to your
redirect_uriwith an authorization code. - Exchange the code at
/oauth/tokenfor an access token (1 hr) and refresh token (30 days). - Use the access token to publish content via
POST /api/content. Uploads use the user's default retention period, are billed to their balance, and return a content URL onhttps://256t.us/{cid}.
Example: app served from GitHub Pages
If your app is hosted on GitHub Pages, use your Pages URL as the redirect URI when registering. For example:
https://your-username.github.io/your-repo/callback.htmlYour callback page receives the authorization code and exchanges it for tokens. A minimal implementation using the hosted SDK:
<!-- callback.html served from GitHub Pages -->
<script type="module">
import HashBin from 'https://hashbin.org/sdk/hashbin.js';
const hb = HashBin.configure({
clientId: 'YOUR_CLIENT_ID',
redirectUri: 'https://your-username.github.io/your-repo/callback.html',
contentBaseUrl: 'https://256t.us'
});
// Completes the OAuth flow using the code in the URL
await hb.handleCallback();
// Now you can publish content
const result = await hb.publish(new Blob(['Hello, HashBin!']));
console.log('Published:', result.cid, result.url);
</script>Or install via npm:
npm install hashbin-sdkSee the SDK documentation for the full API reference.
GitHub Pages upload utilities
Upload via API key: fastest manual upload flow, supports selecting retention per upload, but requires handling an API key in the page.
Upload via registered app: OAuth app flow with scoped and revocable access, no API key sharing, and uploads billed using the user's default retention settings.
Available scopes
| Scope | Description |
|---|---|
content:write |
Publish content, billed to the user's balance using their default retention period |
content:read |
Check whether content exists and read its metadata |
balance:read |
View the user's current balance (useful for pre-flight checks) |
Third-party apps can only publish. Deletion, retention extension, and account management are not available through OAuth tokens.