GIPHY Clips (GIFs with Sound) have arrived! To add Clips to your app, email us at clips@giphy.com!
logo

Code Example

Below are code samples for using the Search Endpoint in Python, JavaScript, Ruby, PHP and the command line on connecting to the API to make a search query for "Ryan Gosling."

Copy Code
1# python
2import urllib
3import json
4url = "http://api.giphy.com/v1/gifs/search"
5
6params = urllib.parse.urlencode({
7 "q": "ryan gosling",
8 "api_key": "YOUR_API_KEY",
9 "limit": "5"
10})
11with urllib.request.urlopen("".join(url, params)) as response:
12 data = json.loads(response.read())
13
14print(json.dumps(data, sort_keys=True, indent=4))
15

Below are code samples for using the Upload Endpoint

Copy Code
1# python
2import urllib.request
3import json
4
5url = "http://upload.giphy.com/v1/gifs"
6
7values = {
8 "api_key": "YOUR_API_KEY",
9 "username": "JoeCool3000",
10 "source_image_url": "http://www.mysite.com/myfile.mp4"
11}
12
13headers = {
14 "Content-Type": "application/json",
15 "Accept": "application/json",
16}
17
18data = json.dumps(values).encode("utf-8")
19
20req = urllib.request.Request(url, data, headers)
21with urllib.request.urlopen(req) as res:
22 print(res.read().decode())
23

Support

If you have questions or need help getting set-up with GIPHY SDK or API, you can take a look at our FAQ.

If you don’t see your question listed, feel free to submit a request through our Help Center and we’ll get back to you! If you think you’ve found a bug with the SDK or API or their documentation, please file an issue via GitHub Issues. Thanks!


API Explorer

The API Explorer is a nifty tool that lets you take the API for a spin by inputting some sample queries and viewing the live responses!