If you search "Freepik API," you will probably land on two very different things: an API for searching and downloading Freepik's stock photos, vectors, and icons, and a separate endpoint called Mystic that generates brand new images from a text prompt. Most developers typing that search are looking for the second one. This guide covers both, but spends most of its time on Mystic.
One thing to know before you start: in April 2026, Freepik rebranded its product line as Magnific, taking the name of the AI upscaler it acquired in 2024 and folding the stock library and AI tools under it. That rename has now reached the developer documentation. The main API reference lives at docs.magnific.com and its examples call api.magnific.com with an x-magnific-api-key header. The older api.freepik.com host and x-freepik-api-key header still work, and one key works on either, so existing code is not broken. New code should use the Magnific names. If a request comes back with an authentication error, check your dashboard for which host and header your key expects before assuming the problem is in your code.
What Is the Freepik API?
It is a web API that covers three things under one developer account:
- Stock content search and download. Search and pull licensed photos, vectors, icons, and templates from a library of over 250 million assets, the same content you would otherwise browse by hand.
- Mystic, the in-house image generator. Freepik's own model family, with its own endpoint and its own pricing, separate from the stock library.
- Other companies' models, resold. Easy to miss, but the same API also fronts several Flux models, Seedream 4 and 4.5, and others. So "the Freepik API" is not only Freepik's own models, which matters if you were picking it specifically to avoid a reseller.
When people search "Freepik API," they are almost always asking about Mystic, not the stock search endpoints. The stock API is useful if you are building something like a design tool that needs licensed assets on demand, but it solves a different problem. If image generation is what you are after more broadly, our AI image API guide covers how these tools work across providers.
What You Can Do With It
Stock Content Endpoints
The stock side lets you search the photo, vector, and icon libraries by keyword, filter by orientation, content type, or color, then trigger a licensed download. One rule catches people out: you have to call the download endpoint every time a user in your app actually uses an asset (sets it as a header image, drops it into a post, and so on), even if you already have the file cached locally. That call is how Freepik tracks usage for licensing. Skipping it is a licensing violation and can get your API access revoked.
Mystic AI Image Generation Endpoint
Mystic takes a text prompt and returns one or more generated images. It is not one fixed model but six variants you pick between with the model parameter:
- realism (the default): a more natural, less "AI-looking" color palette. Strong for photographs, and it works on illustrations too.
- zen: smoother and cleaner, with fewer objects in the scene and less fine detail. The softest looking of the set.
- flexible: follows prompts well, with more saturated, higher-contrast results than realism or fluid. Good for illustration and fantasy scenes.
- fluid: the best of the set at sticking to your prompt, with good average quality across image types and a creative streak. Note that it accepts a narrower list of aspect ratios than the others, so check the reference before switching to it.
- super_real: nearly as versatile as flexible but tuned for realism. It beats editorial_portraits on medium shots, though it is weaker on close-ups.
- editorial_portraits: built for close-up portraits, where it is the strongest of the six. Use super_real instead once you pull back to a medium shot.
One caveat on the default worth knowing: Freepik's own documentation warns that realism may not follow your prompt well if you are generating something fantastical or a recognizable character, and recommends zen, flexible, or fluid for those. Since realism is what you get when you do not set the model at all, that is an easy trap to fall into.
You can also give Mystic a structure reference image, which controls the composition (turning a rough sketch into a finished illustration, for instance), or a style reference image, which copies the look of another image. On top of that you control resolution (1k, 2k, or 4k), aspect ratio, and how much extra detail gets added at the higher resolutions. Our post on using reference images in AI image generation covers how to get good results from this approach generally.
Freepik API Pricing
The API is pay as you go, with no subscription required. Pricing is split by service:
| Service | Pricing |
|---|---|
| AI image generation (Mystic and other generation endpoints) | 0.40 EUR / 100 creations, 1 EUR / 250 creations, 100 EUR / 25,000 creations |
| Images and templates | 1 EUR / 25 requests, 4 EUR / 100 requests, 100 EUR / 2,500 requests |
| Icons | 1 EUR / 100 requests, 5 EUR / 500 requests, 100 EUR / 50,000 requests |
| AI-powered search | 0.20 EUR / 100 requests, 1 EUR / 500 requests, 100 EUR / 50,000 requests |
A "creation" is one generation call. At the volume tier, that works out to roughly 0.004 EUR per image, which is cheap compared to most generation APIs, though the upscaler is priced separately and by output size, so a workflow that generates and then upscales costs considerably more than the table suggests. New accounts get 5 EUR of free credit. Billing is worked out monthly, with invoices issued on the 5th of the following month, and you can cap spending with a monthly budget limit in the dashboard (500 EUR is the highest you can set yourself; above that you have to talk to sales).
Worth noting: this is the developer API pricing, which is separate from the consumer subscription plans sold on freepik.com and magnific.com. Consumer credits do not carry over to API usage, which surprises people who already pay for a plan. For how this compares to other image generation pricing, see our AI image API pricing guide, and for what the 5 EUR trial looks like next to other providers' free offers, our post on what is actually free in AI image generation.
Getting Your Freepik API Key
- Go to the API dashboard and sign up or log in. It now sits on magnific.com following the rebrand.
- Generate a key from the dashboard. Keys are tied to your account and your billing.
- Send the key in a header,
x-magnific-api-key(or the olderx-freepik-api-key), not as a Bearer token. That trips up people used to the more common pattern.
A minimal generation request looks like this.
curl --request POST \
--url https://api.magnific.com/v1/ai/mystic \
--header 'Content-Type: application/json' \
--header 'x-magnific-api-key: YOUR_API_KEY' \
--data '{
"prompt": "a cozy reading nook by a rainy window, warm lamp light",
"resolution": "2k",
"aspect_ratio": "widescreen_16_9",
"model": "realism"
}'Official Freepik API vs. Using Apiframe
If you are comparing Freepik against other AI image APIs, one thing worth saying plainly: as of this writing, Apiframe does not carry Mystic. Apiframe brings Midjourney, Flux, Nano Banana, Ideogram, and GPT Image together behind one key and one bill, but Mystic is not among them. If Mystic specifically is what you need, you will be integrating directly with Freepik for now.
That said, the friction with a direct integration is real: another key and billing relationship for one model, its own limits to track, its own response format to parse. If your actual goal is "AI images in my product" rather than "Mystic specifically," it is worth looking at what a single API covers first. Mystic's six variants map onto roughly the same ground other models cover: Nano Banana Pro for realistic work with strong text rendering, Flux for photography and product shots, Midjourney for illustration and stylized output. One header and one job pattern across all of them cuts the integration work, particularly if you are already generating video or music the same way.
For a structured way to weigh one provider against another rather than taking anyone's word for it, see our guide on how to choose an AI media API.
How to Call the Freepik API: Code Example
Mystic runs in the background. You submit a request, get back a task ID, then check on it until the image is ready. Tasks move from CREATED to IN_PROGRESS and then finish or fail.
import requests
import time
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.magnific.com/v1/ai/mystic"
headers = {
"Content-Type": "application/json",
"x-magnific-api-key": API_KEY,
}
payload = {
"prompt": "a cozy reading nook by a rainy window, warm lamp light",
"resolution": "2k",
"aspect_ratio": "widescreen_16_9",
"model": "realism",
}
# 1. Submit the generation request
response = requests.post(BASE_URL, headers=headers, json=payload)
response.raise_for_status()
task_id = response.json()["data"]["task_id"]
print(f"Task submitted: {task_id}")
# 2. Check the task until it finishes
status_url = f"{BASE_URL}/{task_id}"
while True:
status_response = requests.get(status_url, headers=headers)
data = status_response.json()["data"]
if data["status"] == "COMPLETED":
print("Generated images:", data["generated"])
break
elif data["status"] == "FAILED":
print("Generation failed:", data)
break
time.sleep(3)If you would rather not sit in a loop, pass a webhook_url in the first request and Freepik will call your server when the task status changes, so nothing has to wait.
Common Errors and Rate Limits
- 429 Too Many Requests: you have hit your per-minute or per-day request limit. Generation has a second set of limits counted in images rather than requests, so a single call asking for several images can hit that ceiling while your request count looks fine. Both vary by service, so check your dashboard.
- 400 Bad Request on
structure_referenceorstyle_reference: these fields want the image itself, encoded as text, not a link to one. Passing a URL is the most common mistake here. - Character and style overrides being ignored without warning: if you are using a saved character or style (through the
@character_nameprompt syntax or thestyling.charactersarray) and you also pass astructure_referenceorstyle_reference, the override is dropped silently rather than raising an error. The same happens on fluid, flexible, super_real, and editorial_portraits, which do not support them at all. Check your output rather than trusting a 200 response. - The content filter cannot be turned off.
filter_nsfwis locked on unless Freepik's support team has specifically approved your account. Plan for some prompts being rejected, and decide how your app handles that. Our guide to AI content moderation covers handling this gracefully.
Freepik API Alternatives
If you are weighing Freepik and Mystic against other options:
- Apiframe: not a direct replacement, since it has no stock library and no Mystic, but one API across many other image and video models if breadth is what you want. Our roundup of the best AI image generator APIs covers how they compare on price and quality.
- Unsplash or Pexels: stock photo APIs, worth a look if you only need the stock side and no generation at all.
- Going straight to a model provider (OpenAI, Google, Black Forest Labs): sensible if you have settled on one model and will not be switching, though it means a separate key and bill for each one you add.
FAQ
Is the Freepik API free?
New accounts get 5 EUR of free credit, which goes a long way on generation given the per-image cost, but there is no permanently free tier. After the trial credit it is pay as you go.
Can output be used commercially?
Yes, generated images can be used commercially under Freepik's licensing terms. Read the license page itself rather than taking this as the final word, since terms vary by content type and plan, and the stock library has stricter rules than generated output.
What resolutions does Mystic support?
1k, 2k, and 4k, set with the resolution parameter.
Which Mystic model should I start with?
Realism is the default and a reasonable starting point for photographic work, but switch to fluid or flexible if your prompt describes anything fantastical, since realism tends to drift from the prompt there. For portraits, use editorial_portraits on close-ups and super_real on medium shots. Run the same prompt through two or three and compare before settling.
Does it support image editing or upscaling?
Mystic itself only generates, but the wider API includes separate editing and upscaling endpoints, with the Magnific upscaler now part of the same platform. Upscaling is priced by output size rather than per call, so budget it separately. For a dedicated look at editing tools in this space, our AI image editing API guide covers that side. If your product needs more than one AI image model, or you are already pulling video and music generation into the same codebase, it is worth seeing what a single API covers before you commit to a single-provider integration. Our getting started guide walks through that in a few minutes.