HTTP API
REST API reference for custom PichaFlow integrations.
PichaFlow can be integrated into any language or framework that supports HTTP requests.
Base URL
The default API endpoint is:
https://api.pichaflow.com/v1
Authentication
All requests must include your Secret Key in the Authorization header as a Bearer token.
Authorization: Bearer sk_live_your_secret_key
1. Uploading Images (cURL)
curl -X POST https://api.pichaflow.com/v1/upload \
-H "Authorization: Bearer sk_live_..." \
-F "file=@/path/to/your/image.jpg" \
-F "alt=Description for SEO" \
-F "tags=[\"ecommerce\", \"summer\"]"
2. Python Integration
import requests
url = "https://api.pichaflow.com/v1/upload"
headers = {
"Authorization": "Bearer sk_live_your_secret_key"
}
files = {
"file": open("product.jpg", "rb")
}
data = {
"alt": "Summer Collection Boot",
"tags": "[\"ecommerce\"]"
}
response = requests.post(url, headers=headers, files=files, data=data)
print(response.json())
3. Node.js (Fetch)
const formData = new FormData();
formData.append('file', fileInput.files[0]);
formData.append('alt', 'Modern Sofa');
const response = await fetch('https://api.pichaflow.com/v1/upload', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk_live_your_secret_key'
},
body: formData
});
const result = await response.json();
4. PHP Integration
$ch = curl_init('https://api.pichaflow.com/v1/upload');
$cfile = new CURLFile('image.jpg', 'image/jpeg', 'file');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
'file' => $cfile,
'alt' => 'Luxury Watch'
]);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer sk_live_your_secret_key'
]);
$result = curl_exec($ch);
curl_close($ch);
5. Go Integration
package main
import (
"bytes"
"io"
"mime/multipart"
"net/http"
"os"
)
func main() {
file, _ := os.Open("image.jpg")
defer file.Close()
body := &bytes.Buffer{}
writer := multipart.NewWriter(body)
part, _ := writer.CreateFormFile("file", "image.jpg")
io.Copy(part, file)
writer.WriteField("alt", "Coffee Mug")
writer.Close()
req, _ := http.NewRequest("POST", "https://api.pichaflow.com/v1/upload", body)
req.Header.Set("Content-Type", writer.FormDataContentType())
req.Header.Set("Authorization", "Bearer sk_live_your_secret_key")
client := &http.Client{}
client.Do(req)
}
6. Rust Integration
use reqwest::header::{AUTHORIZATION, HeaderValue};
use reqwest::multipart;
use std::fs;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let file_path = "image.jpg";
let file_bytes = fs::read(file_path)?;
let form = multipart::Form::new()
.part("file", multipart::Part::bytes(file_bytes).file_name("image.jpg"))
.text("alt", "Titanium Wristwatch")
.text("tags", "[\"luxury\", \"watch\"]");
let response = client
.post("https://api.pichaflow.com/v1/upload")
.header(AUTHORIZATION, HeaderValue::from_static("Bearer sk_live_your_secret_key"))
.multipart(form)
.send()
.await?;
println!("Status: {}", response.status());
println!("Body: {}", response.text().await?);
Ok(())
}