py-meme API
A simple API for you to integrate into your code and fetch memes.
Overview
Introduction
This is a simple API which you can integrate into your code to fetch memes. The API can be integrated into most programming languages and returns a meme in the form of URLs.
What you need
A good programming language and a working internet connection is all you need to use the API. Since the API returns simple URLs, you don't need to get any modules for your platform. All you need is to know how to make requests through the programming language of your choice.
Basic procedure
Firstly you need to make a request to this endpoint
https://api.pymeme.repl.co
A simple request to the URL itself returns data related to a random meme. On top of that, you can pass certain arguments to get some different results. These will be discussed in the next section.
Passing Arguments
Arguments can be passed as suffixes to the main URL, for example, adding "/help" to the end of the main URL leads to this documentation page. You can even add keywords to get specific memes. Usage of keywords will be discussed in the methods section of the page.
Handling Errors
We run our API on very lightweight servers and it is not surprising that errors might occur. You need to get well acquainted on how to identify errors and what to do when an error occurs. Detailed instructions on error identification are provided in the methods section of the page.
FAQs
Q - Is the API free to use?
A - Yes, as of now you can use it anytime you want absolutely free of cost.

Q - Does the API do anything other than access memes?
A - No, the API is created with a simple design in mind and cannot be used for anything other than memes.

Q - Can I use it with any programming language?
A - You can use it with most of all programming languages. If the language provides usage of HTTP requests and JSON data, you can use our API with ease.

Q - Can I use it with HTML?
A - Yes, you can use Javascript to integrate it into your HTML page.

Q - What if I face an error and don't find a solution?
A - You can contact us on the discord info given and report bugs or get help with specific errors.

Methods
Random Meme
Responds with a random meme from the "r/memes" sub-reddit from reddit.com.

Endpoints:
https://api.pymeme.repl.co/
https://api.pymeme.repl.co/random/
Returns: A response in JSON format, which contains the post URL, image URL and the meme title.
Return type: Dictionary
Meme Search
Responds with the meme found after searching with the given keywords. Note: If no meme is found with the given keywords, a random meme is sent.

Endpoint:
https://api.pymeme.repl.co/query=[queries]
Note: if multiple queries are present they can be mentioned one after the other, separated by a "+"
Returns: A response in JSON format, which contains the post URL, image URL and the meme title.
Return type: Dictionary
Docs
Doesn't respond with anything. However, this URL will redirect to the Documentation of the API.

Endpoint:
https://api.pymeme.repl.co/help
Returns: The Documentation of the py-meme API
Return type: Redirect
Response Schema
The sole response format of the API is JSON.

A "response" property is always returned, which describes the communication between our server and the user's system. An error message is returned in the "response" property, if an error occurs.

All the meme content is present in the "meme" property of the response.

Note: The meme property is not present if an error occurs.

An example of a successful request.
{
"meme":
{
"author":"anoreksicni",
"downvotes":0,
"image url":"https://i.redd.it/0wbivqv9nvr31.jpg",
"post url":"https://www.reddit.com/dgcej8",
"title":"Its all coming together",
"upvotes":177702
},
"response":"Successfully fetched meme."
}
An example of an unsuccessful request.
{
"response":"Error collecting the meme. It might be an error in your request or it might be an error on our side. If you believe it's an error on your side, please visit our documentation page."
}
Quickstart
This guide explains how to set up a simple program in the following programming languages that can make requests to the py-meme API.
JavaScript


Python
import requests
URL = "https://api.pymeme.repl.co/"
response = requests.get(URL)
data = response.json()
print(data)
Feedback
Feel free to fill up the form or write to us on Discord or via mail, if you want to give your feedback, report a problem, give a suggestion or ask for help.
To fill up the form or write to us on Discord or via mail, click on any of the icons below.