Skip to content

REST Against Humanity

REST Against Humanity is a public API for Cards Against Humanity. You can use it to programatically obtain cards from any of Cards Against Humanity's 71 official packs.

You should probably read the rules of Cards Against Humanity before using this API.

Endpoints

Packs

https://restagainsthumanity.com/api/v2/packs

Names of Cards Against Humanity packs available through REST Against Humanity.

Parameters

None.

Example Response

["CAH Base Set", "2012 Holiday Pack", "2014 Holiday Pack", ...]

Code Examples

import requests

resp = requests.get("https://restagainsthumanity.com/api/v2/packs")

if resp.status_code == 200:
    print(resp.json())
import axios from "axios";

const axios = require("axios");

axios.get("https://restagainsthumanity.com/api/v2/packs").then((resp) => {
  if (resp.status === 200) {
    console.log(resp.data);
  }
});
val (request, response, result) = Fuel.get("https://restagainsthumanity.com/api/v2/packs")
    .responseString()

if (response.statusCode == 200) {
    println(response.data)
}
var client = HttpClient.newHttpClient();

var request = HttpRequest.newBuilder()
    .uri(URI.create("https://restagainsthumanity.com/api/v2/packs"))
    .GET()
    .build();

var response = client.send(request, HttpResponse.BodyHandlers.ofString());

if (response.statusCode() == 200) {
    System.out.println(response.body());
}
let task = URLSession.shared.dataTask(with: URL(string: "https://restagainsthumanity.com/api/v2/packs")!) { data, response, error in
    if let data = data, let response = response as? HTTPURLResponse, response.statusCode == 200 {
        print(String(data: data, encoding: .utf8)!)
    }
}

task.resume()
require "net/http"
require "json"

uri = URI("https://restagainsthumanity.com/api/v2/packs")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri.request_uri)
response = http.request(request)

if response.code == "200"
    puts JSON.parse(response.body)
end

Cards

Cards Against Humanity cards.

https://restagainsthumanity.com/api/v2/cards

Parameters

Name Type Description Required? Default
packs string A comma-separated, case-sensitive, list of packs to limit the response to. No All packs
color string Limit the response to either black or white cards. Must be one of either "black" or "white". No N/A
pick integer The pick that black cards in the response should be limited to. (A black card's pick is the number of blank spaces it has for white cards to fill.) Must be either 1 or 2. No N/A
includePackNames boolean Whether to include the name of each card's originating pack in the response. No True

Danger

It's important that you separate pack names with commas onlynot commas and spaces.

For example, this is fine:

CAH Base Set,2012 Holiday Pack,90s Nostalgia Pack

But this is not:

CAH Base Set, 2012 Holiday Pack, 90s Nostalgia Pack

Unexpected whitespace will cause an HTTP 400 error.

Example Response

{
  "black": [
    {
      "text": "_ + _ = Hipsters",
      "pick": 2,
      "pack": "CAH Base Set"
    },
    {
      "text": "_ is a sure sign of mankind's decline.",
      "pick": 1,
      "pack": "CAH Base Set"
    },
    {
      "text": "_ would only happen in my worst nightmares.",
      "pick": 1,
      "pack": "CAH Base Set"
    }
  ],
  "white": [
    {
      "text": "A balanced breakfast.",
      "pack": "CAH Base Set"
    },
    {
      "text": "A big hoopla about nothing.",
      "pack": "CAH Base Set"
    },
    {
      "text": "A cat with... hands.",
      "pack": "CAH Base Set"
    }
  ]
}

Code Examples

import requests

params = {"packs": "CAH Base Set,CAH: First Expansion"}
resp = requests.get("https://restagainsthumanity.com/api/v2/cards", params=params)

if resp.status_code == 200:
    print(resp.json())
import axios from "axios";

const axios = require("axios");

axios
  .get("https://restagainsthumanity.com/api/v2/cards", {
    params: {
      packs: "CAH Base Set,CAH: First Expansion",
    },
  })
  .then((resp) => {
    if (resp.status === 200) {
      console.log(resp.data);
    }
  });
val (request, response, result) = Fuel.get("https://restagainsthumanity.com/api/v2/cards")
    .parameter("packs", "CAH Base Set,CAH: First Expansion")
    .responseString()

if (response.statusCode == 200) {
    println(response.data)
}
var client = HttpClient.newHttpClient();

var request = HttpRequest.newBuilder()
    .uri(URI.create("https://restagainsthumanity.com/api/v2/cards?packs=CAH Base Set,CAH: First Expansion"))
    .GET()
    .build();

var response = client.send(request, HttpResponse.BodyHandlers.ofString());

if (response.statusCode() == 200) {
    System.out.println(response.body());
}
let task = URLSession.shared.dataTask(with: URL(string: "https://restagainsthumanity.com/api/v2/cards?packs=CAH Base Set,CAH: First Expansion")!) { data, response, error in
    if let data = data, let response = response as? HTTPURLResponse, response.statusCode == 200 {
        print(String(data: data, encoding: .utf8)!)
    }
}

task.resume()
require "net/http"
require "json"

uri = URI("https://restagainsthumanity.com/api/v2/cards?packs=CAH Base Set,CAH: First Expansion")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri.request_uri)
response = http.request(request)

if response.code == "200"
    puts JSON.parse(response.body)
end