Skip to content

Creating gifs

Justin Forest edited this page Mar 23, 2022 · 1 revision

To create a new gif, the following steps should be made:

  1. Upload the file to the server.
  2. Submit a gif.
  3. Wait for the gif to be ready.

Example session

(1) Upload the file

To upload a file, you need to request an upload ticket, send the file, wait for it to be processed, then use the ticket id. See uploading files for detailed instructions. A ticket id is a UUID, which looks like this: "17fb69668eb-4b9f-6cae-9193-96690489d235".

(2) Submit a gif

When your file (upload ticket) is ready, you can send it to the API to create a gif.

Example request:

POST /v2/gifs/submit
Host: api.redgifs.com
Content-Type: application/json
Authorization: Bearer my_oauth_token

{
 "ticket": "17fb69668eb-4b9f-6cae-9193-96690489d235",
 "keepAudio": true,
 "private": false,
 "tags": [
  "MILF",
  "Mistress",
  "Massage"
 ]
}

Example response:

HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: no-cache

{
 "id": "palegoldenroddarkvioletibis",
 "duration": 22
}

Here, "palegoldenroddarkvioletibis" is the unique gif id, and "duration" is the expected processing time. At this moment, the gif is currently in the draft state and is not accessible. Wait until it's been processed.

(3) Checking gif status

Request:

GET /v1/gifs/fetch/status/palegoldenroddarkvioletibis
Host: api.redgifs.com
Authorization: Bearer my_oauth_token

Response:

HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: no-cache

{
 "task": "encoding",
 "progress": 3
}

Here, "status" can be "encoding", "complete" or "error". You should repeat this request until the status is "complete" or "error".