querystringobligatoire
Keyword or phrase to search Unsplash photos for, e.g. "coffee" or "minimal workspace".
https://api.sandbase.ai/v1/api/unsplash/search-photosSearch Unsplash for free stock photos by keyword. Returns image URLs in several sizes, dimensions, alt text, the photographer's name and profile, and the photo's Unsplash page.
Votre sortie apparaîtra ici
Complétez les entrées, puis cliquez sur Exécuter.
Search Unsplash for free stock photos by keyword. Returns image URLs in several sizes, dimensions, alt text, the photographer's name and profile, and the photo's Unsplash page.
curl -X POST "https://api.sandbase.ai/v1/run" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "unsplash/search-photos", "limit": 2, "query": "coffee"}'
The result is returned in outputs[0].data. Lookups that find nothing fail with a not-found error.
| Name | Type | Required | Description |
|---|---|---|---|
query | string | Yes | Keyword or phrase to search Unsplash photos for, e.g. "coffee" or "minimal workspace". |
color | string | No | Only return photos with this dominant color tone. Omit for any color. One of: black_and_white, black, white, yellow, orange, red, purple, magenta, green, teal, blue. |
limit | integer | No | Maximum number of photos to return (1-20, default 20). You are billed per photo returned, so a lower limit costs less. |
orientation | string | No | Only return photos with this orientation. Omit for any orientation. One of: landscape, portrait, square. |
sortBy | string | No | Order results by best match (relevant, the default) or newest first (recent). One of: relevant, recent. |
Billed at the actual cost of each call: about $0.00165 per result returned, up to $0.0336 per request (about $0.0033 for the request above). A call can cost more when the first data source fails and another one answers. Failed calls and lookups that find nothing are not charged.
Commencer à construire
Point de terminaison de l'API de la plateforme avec authentification unifiée et suivi de l'utilisation.
curl -X POST "https://api.sandbase.ai/v1/api/unsplash/search-photos" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"limit": 2,
"query": "coffee",
"sortBy": "relevant"
}'Définissez votre clé API SandBase dans l'environnement de votre serveur. Les requêtes utilisent l'authentification Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Conservez votre clé côté serveur. Ne l'exposez pas dans le code du navigateur.
querystringobligatoireKeyword or phrase to search Unsplash photos for, e.g. "coffee" or "minimal workspace".
colorstringOnly return photos with this dominant color tone. Omit for any color.
Valeurs possibles : black_and_white, black, white, yellow, orange, red, purple, magenta, green, teal, blue
limitintegerMaximum number of photos to return (1-20, default 20). You are billed per photo returned, so a lower limit costs less.
sortBystringOrder results by best match (relevant, the default) or newest first (recent).
Par défaut : "relevant"
Valeurs possibles : relevant, recent
orientationstringOnly return photos with this orientation. Omit for any orientation.
Valeurs possibles : landscape, portrait, square
Exemple de réponse enregistré pour cette API ; aucune requête en direct n'est effectuée lors de l'affichage.
Aucune réponse enregistrée n'a été publiée. Exécutez l'API dans Playground pour inspecter sa réponse.
Explorer plus
| API | Prix | Réponse |
|---|---|---|
Unsplash Photo SearchCette API Unsplash | À partir de $0.0033 par appel | JSON |
Questions
Envoyez une requête POST à https://api.sandbase.ai/v1/api/unsplash/search-photos avec votre clé API SandBase dans l’en-tête Authorization (Bearer) et les paramètres dans un corps JSON. Vous pouvez aussi l’essayer dans le Playground sur cette page sans écrire de code.
À partir de $0.0033 par appel, facturé depuis votre solde SandBase. Vous ne payez que les appels que vous effectuez ; aucun abonnement.
Obligatoire : query (string). Facultatif : color (l’un de black_and_white, black, white, yellow, orange, red, purple, magenta, green, teal, blue), limit (integer), sortBy (l’un de relevant, recent) et orientation (l’un de landscape, portrait, square). Le tableau des paramètres et le Playground sur cette page listent tous les champs.
Une réponse JSON renvoyée dans la même requête HTTP (synchrone).
Non. Unsplash Photo Search fonctionne via SandBase, donc une seule clé API SandBase couvre ce point de terminaison ainsi que toutes les autres API et tous les modèles du catalogue. Vous n’avez pas besoin de demander un accès API Unsplash séparément.