# Postiz Public API Information
## 🔐 How to Get Your API Key
1. Go to **https://postiz.com** (or your self-hosted instance)
2. Login to your account
3. Go to **Settings** → **Public API**
4. Copy your **API Key**
## 📝 API Configuration
### Base URL
- **Hosted:** `https://api.postiz.com/public/v1`
- **Self-hosted:** `https://{YOUR_BACKEND_URL}/public/v1`
### Authentication
```
Authorization: {your_api_key}
```
**Note:** Do NOT use "Bearer" prefix, just the API key directly.
### Rate Limits
- **30 requests per hour**
## 📍 Available Endpoints
### 1. Get Integrations (Channels)
```
GET /integrations
```
Returns all connected social media channels.
### 2. List Posts
```
GET /posts
Query params: ?from=YYYY-MM-DD&to=YYYY-MM-DD
```
Returns posts within date range.
### 3. Create/Update Post
```
POST /posts
Body: {
type: "now" | "schedule" | "draft",
date: "YYYY-MM-DDTHH:mm:ss",
posts: [...],
tags: [...]
}
```
### 4. Delete Post
```
DELETE /posts/:id
```
Deletes a specific post.
### 5. Upload Media
```
POST /upload
Content-Type: multipart/form-data
Body: file
```
Uploads a media file.
### 6. Upload from URL
```
POST /upload-from-url
Body: { url: "..." }
```
Imports media from URL.
## ⚠️ Important Notes
### Media Management
Postiz Public API **does NOT have dedicated media endpoints** like:
- ❌ `GET /media` - list all media
- ❌ `DELETE /media/:id` - delete media by ID
### Workaround Strategy
To manage media, you need to:
1. Get all posts via `GET /posts`
2. Extract media URLs/IDs from post data
3. Delete media by deleting the associated posts
### Alternative Approach
If you need direct media management, you may need to:
1. Use Postiz Dashboard UI
2. Contact Postiz support for additional API endpoints
3. Use database access if self-hosted
## 📚 Official Documentation
https://docs.postiz.com/public-api
## 🔧 Next Steps for This Project
Since Postiz doesn't have direct media deletion endpoints, we need to:
1. **Option A:** Modify the tool to work with posts instead of media
- List posts and their media
- Delete entire posts (which deletes their media)
2. **Option B:** Use Postiz Dashboard + Browser Automation
- Automate the web UI to delete media
3. **Option C:** Direct Database Access (self-hosted only)
- Access Postiz database directly
- Delete media records and files
**Which approach would you prefer?**