API

Lexica Search API

To use Lexica's search API, create a GET request with a query parameter q as your search term. For example, to search for the term "apples", you would make a request to:

GET https://lexica.art/api/v1/search?q=apples

For a reverse image search, you can pass in the URL of an image as the query.

GET https://lexica.art/api/v1/search?q=https://media.gettyimages.com/photos/crete-senesi-countryside-in-summer-tuscany-italy-picture-id1411845730

Search Response

The API will return a JSON object containing an array of 50 image search results.

{
"images": [
{
// The ID of the image
"id": "0482ee68-0368-4eca-8846-5930db866b33",
// URL for the image's gallery
"gallery": "https://lexica.art?q=0482ee68-0368-4eca-8846-5930db866b33",
// Link to this image
"src": "https://image.lexica.art/md/0482ee68-0368-4eca-8846-5930db866b33",
// Link to an compressed & optimized version of this image
"srcSmall": "https://image.lexica.art/sm/0482ee68-0368-4eca-8846-5930db866b33",
// The prompt used to generate this image
"prompt": "cute chubby blue fruits icons for mobile game ui ",
// Image dimensions
"width": 512,
"height": 512,
// Seed
"seed": "1413536227",
// Whether this image is a grid of multiple images
"grid": false,
// The model used to generate this image
"model": "stable-diffusion",
// The ID for this image's prompt
"promptid": "d9868972-dad8-477d-8e5a-4a0ae1e9b72b"
},
...
]
}

Support and more

For API support or to share what you're building with the Lexica API, check out the #development channel in the Lexica Discord.