Skip to content

Latest commit

 

History

History
161 lines (130 loc) · 3.78 KB

File metadata and controls

161 lines (130 loc) · 3.78 KB
title Quickstart
description Get your API key and make your first upload in under five minutes

Get started in three steps

Make your first API call and upload a file to Snipp.

Step 1: Get your API key

  1. Sign in at snipp.gg.
  2. Open Settings and navigate to the API section.
  3. Copy your API key. You'll include it in the api-key header with every request.
Never share your API key or commit it to version control. Store it in an environment variable in production.

Step 2: Verify your setup

Test your API key by fetching your own profile:

```bash cURL curl -X GET "https://api.snipp.gg/users/@me" \ -H "api-key: YOUR_API_KEY" ```
const res = await fetch("https://api.snipp.gg/users/@me", {
  headers: { "api-key": "YOUR_API_KEY" },
});
const data = await res.json();
console.log(data.user.username);
import requests

res = requests.get(
    "https://api.snipp.gg/users/@me",
    headers={"api-key": "YOUR_API_KEY"},
)
print(res.json()["user"]["username"])

A successful response returns your user object:

{
  "user": {
    "id": "123456789012345678",
    "username": "yourname",
    "plus": false,
    "verified": false,
    "badges": { ... },
    "uploads": 0
  }
}

Step 3: Upload a file

Upload an image or video to your account:

```bash cURL curl -X POST "https://api.snipp.gg/upload" \ -H "api-key: YOUR_API_KEY" \ -H "post-privacy: unlisted" \ -F "file=@/path/to/image.png" ```
const formData = new FormData();
formData.append("file", fileInput.files[0]);

const res = await fetch("https://api.snipp.gg/upload", {
  method: "POST",
  headers: {
    "api-key": "YOUR_API_KEY",
    "post-privacy": "unlisted",
  },
  body: formData,
});
const data = await res.json();
console.log(data.url);
import requests

with open("image.png", "rb") as f:
    res = requests.post(
        "https://api.snipp.gg/upload",
        headers={
            "api-key": "YOUR_API_KEY",
            "post-privacy": "unlisted",
        },
        files={"file": f},
    )
print(res.json()["url"])

The response includes a direct URL to your file and a post object with share metadata:

{
  "message": "Upload successful!",
  "url": "https://i.snipp.gg/123456789012345678/abc123.png",
  "post": {
    "code": "AbCd1234",
    "url": "https://snipp.gg/share/AbCd1234",
    "postPrivacy": "unlisted"
  }
}

Albums

Upload multiple files in one request to create an album. Just add more -F "file=@..." fields:

curl -X POST "https://api.snipp.gg/upload" \
  -H "api-key: YOUR_API_KEY" \
  -H "posttitle: My album" \
  -F "file=@photo1.png" \
  -F "file=@photo2.png"

Albums are the default when sending 2+ files. To create separate posts instead, add -H "post-type: individual".

Privacy options

Control who can see your uploads by setting the post-privacy header:

Value Visibility
private Only you can view it
unlisted Anyone with the share link can view it (default)
public Visible to everyone and eligible for the Discover feed

Next steps

Learn how the API key header works and security best practices. Explore all available endpoints and response schemas. See supported formats and size limits per plan. Understand request limits and how to handle throttling.