# Dog CEO

> Pull dog pictures and breed data into a workflow from the Dog CEO API: a random dog, a random pick from one breed, or every picture of a breed a page at a time. Browse or search the full catalogue of nearly a hundred breeds and their sub-breeds, look one up to see how many pictures exist, pick a breed at random, and download a picture to post or attach. Every picture comes back with the breed it shows and alt text ready to caption it. No account or API key required.

App · Images & Design · 10 actions. Web page: https://docs.lodol.com/docs/integrations/dog-ceo

## Actions

### Download a dog picture

Download a dog picture as a file, so a later step can attach it to an email, post it to a chat or put it in storage. Name a breed for a picture of that breed, pass a picture's URL from an earlier step to fetch that exact one, or give neither for any dog at all. No API key required.

**Inputs**

- Breed (`breed`, text): Optional. Which breed to download a picture of. Leave blank for any dog at all. Ignored when a picture URL is given.
- Sub-breed (`sub_breed`, text): Optional. The variety within that breed, e.g. "afghan" for a hound or "golden" for a retriever. Leave blank to cover the whole breed, sub-breeds included.
- Picture URL (`image_url`, text): Optional. The exact picture to download, as returned by one of the picture actions. Only the Dog CEO API's own image host is accepted.

**Outputs**

- `byte_size` (number): The file's size in bytes.
- `content_type` (text): The picture's media type, e.g. image/jpeg.
- `document_ref` (text): The stored document's reference.
- `documents` (list): The downloaded picture as a document, ready to attach to a later step.
- `image` (object): One picture, with the breed it shows.
- `url` (text): A URL that serves the stored file.

**Example output**

```json
{
  "byte_size": 51234,
  "content_type": "image/jpeg",
  "document_ref": "doc_dog_ceo_hound_afghan",
  "documents": [
    {
      "content_type": "image/jpeg",
      "document_ref": "doc_dog_ceo_hound_afghan",
      "filename": "hound-afghan-n02088094_1003.jpg",
      "size_bytes": 51234,
      "url": "/actions/core/serve-document/doc_dog_ceo_hound_afghan"
    }
  ],
  "image": {
    "alt_text": "Afghan hound dog",
    "breed": "hound",
    "breed_slug": "hound-afghan",
    "display_name": "Afghan Hound",
    "sub_breed": "afghan",
    "url": "https://images.dog.ceo/breeds/hound-afghan/n02088094_1003.jpg"
  },
  "url": "/actions/core/serve-document/doc_dog_ceo_hound_afghan"
}
```

### Get a breed

Get one breed or sub-breed in full: the varieties inside it, how many pictures the Dog CEO API holds of it, and one of those pictures to show. Use it to check a breed exists before a later step asks for its pictures. No API key required.

**Inputs**

- Breed (`breed`, text, required): The breed, as the Dog CEO API names it: one lowercase word such as "hound", "retriever" or "poodle". A sub-breed can be given here too, written either way round ("hound/afghan" or "afghan hound"), and Search breeds will find the exact name for anything else.
- Sub-breed (`sub_breed`, text): Optional. The variety within that breed, e.g. "afghan" for a hound or "golden" for a retriever. Leave blank to cover the whole breed, sub-breeds included.

**Outputs**

- `breed` (text): The breed's name as the Dog CEO API spells it: lowercase, one word, e.g. "hound". This is what the other actions take.
- `breed_slug` (text): The breed and sub-breed joined the way an image URL writes them, e.g. "hound-afghan". Can be passed straight back in as the breed.
- `display_name` (text): A readable name for the breed, e.g. "Afghan Hound".
- `has_sub_breeds` (true/false): True when this breed has varieties. Branch on it before asking for one.
- `image_count` (number): How many pictures the Dog CEO API holds. For a whole breed this counts its sub-breeds' pictures too.
- `is_sub_breed` (true/false): True when this row names a sub-breed rather than a breed.
- `sample_image` (object): One picture, with the breed it shows.
- `sub_breed` (text): The sub-breed within that breed, e.g. "afghan". Null when the record is a whole breed rather than one of its varieties.
- `sub_breed_count` (number): How many sub-breeds this breed has.
- `sub_breeds` (list): The varieties within this breed, as their own names without the breed in front. Empty for a breed that has none.

**Example output**

```json
{
  "breed": "hound",
  "breed_slug": "hound",
  "display_name": "Hound",
  "has_sub_breeds": true,
  "image_count": 808,
  "is_sub_breed": false,
  "sample_image": {
    "alt_text": "Afghan hound dog",
    "breed": "hound",
    "breed_slug": "hound-afghan",
    "display_name": "Afghan Hound",
    "sub_breed": "afghan",
    "url": "https://images.dog.ceo/breeds/hound-afghan/n02088094_1003.jpg"
  },
  "sub_breed": null,
  "sub_breed_count": 7,
  "sub_breeds": [
    "afghan",
    "basset",
    "blood",
    "english",
    "ibizan",
    "plott",
    "walker"
  ]
}
```

### Get a random breed

Pick a dog breed at random: the breed-of-the-day step. Each pick comes back with its sub-breeds listed, so a following step can ask for a picture of it. No API key required.

**Inputs**

- How many (`count`, number): Optional. How many breeds to pick. Between 1 and 50; one by default. From 1 to 50. Default: `1`.
- Include sub-breeds (`include_sub_breeds`, true/false): Optional. List each pick's sub-breeds alongside it. On by default; turning it off draws from the main breed names on their own. Default: `true`.

**Outputs**

- `breeds` (list): The breeds that were picked.
- `count` (number): How many records are in this page.
- `sub_breeds_included` (true/false): True when each breed came back with its sub-breeds listed. False when only the main breed names were asked for.

**Example output**

```json
{
  "breeds": [
    {
      "breed": "hound",
      "display_name": "Hound",
      "has_sub_breeds": true,
      "sub_breed_count": 7,
      "sub_breeds": [
        "afghan",
        "basset",
        "blood",
        "english",
        "ibizan",
        "plott",
        "walker"
      ]
    }
  ],
  "count": 1,
  "sub_breeds_included": true
}
```

### Get a random dog picture

Get a picture of a dog at random, from any breed, with the breed it shows and alt text ready to caption it. The URL can be embedded straight into a message or an email. No API key required.

**Inputs**

- How many (`count`, number): Optional. How many pictures to pick. Between 1 and 50; one by default. Each is drawn on its own, so a large batch may repeat a breed. From 1 to 50. Default: `1`.

**Outputs**

- `count` (number): How many records are in this page.
- `image` (object): The first picture, so a step that wanted one doesn't have to index into the list.
- `images` (list): The pictures that were picked.
- `requested_count` (number): How many pictures were asked for.

**Example output**

```json
{
  "count": 1,
  "image": {
    "alt_text": "Afghan hound dog",
    "breed": "hound",
    "breed_slug": "hound-afghan",
    "display_name": "Afghan Hound",
    "sub_breed": "afghan",
    "url": "https://images.dog.ceo/breeds/hound-afghan/n02088094_1003.jpg"
  },
  "images": [
    {
      "alt_text": "Afghan hound dog",
      "breed": "hound",
      "breed_slug": "hound-afghan",
      "display_name": "Afghan Hound",
      "sub_breed": "afghan",
      "url": "https://images.dog.ceo/breeds/hound-afghan/n02088094_1003.jpg"
    }
  ],
  "requested_count": 1
}
```

### Get a random picture of a breed

Get a picture of one breed at random. Naming only the breed draws from its varieties too, so a random hound may be an afghan or a basset; name the sub-breed to pin it down. No API key required.

**Inputs**

- Breed (`breed`, text, required): The breed, as the Dog CEO API names it: one lowercase word such as "hound", "retriever" or "poodle". A sub-breed can be given here too, written either way round ("hound/afghan" or "afghan hound"), and Search breeds will find the exact name for anything else.
- Sub-breed (`sub_breed`, text): Optional. The variety within that breed, e.g. "afghan" for a hound or "golden" for a retriever. Leave blank to cover the whole breed, sub-breeds included.
- How many (`count`, number): Optional. How many pictures to pick. Between 1 and 50; one by default. From 1 to 50. Default: `1`.

**Outputs**

- `breed` (text): The breed's name as the Dog CEO API spells it: lowercase, one word, e.g. "hound". This is what the other actions take.
- `breed_slug` (text): The breed and sub-breed joined the way an image URL writes them, e.g. "hound-afghan". Can be passed straight back in as the breed.
- `count` (number): How many records are in this page.
- `display_name` (text): A readable name for the breed, e.g. "Afghan Hound".
- `image` (object): The first picture, so a step that wanted one doesn't have to index into the list.
- `images` (list): The pictures that were picked.
- `is_sub_breed` (true/false): True when this row names a sub-breed rather than a breed.
- `requested_count` (number): How many pictures were asked for.
- `sub_breed` (text): The sub-breed within that breed, e.g. "afghan". Null when the record is a whole breed rather than one of its varieties.

**Example output**

```json
{
  "breed": "hound",
  "breed_slug": "hound-afghan",
  "count": 1,
  "display_name": "Afghan Hound",
  "image": {
    "alt_text": "Afghan hound dog",
    "breed": "hound",
    "breed_slug": "hound-afghan",
    "display_name": "Afghan Hound",
    "sub_breed": "afghan",
    "url": "https://images.dog.ceo/breeds/hound-afghan/n02088094_1003.jpg"
  },
  "images": [
    {
      "alt_text": "Afghan hound dog",
      "breed": "hound",
      "breed_slug": "hound-afghan",
      "display_name": "Afghan Hound",
      "sub_breed": "afghan",
      "url": "https://images.dog.ceo/breeds/hound-afghan/n02088094_1003.jpg"
    }
  ],
  "is_sub_breed": true,
  "requested_count": 1,
  "sub_breed": "afghan"
}
```

### Get a random sub-breed

Pick a variety of one breed at random, e.g. one of the twenty-five terriers. A breed with no varieties says so rather than failing silently. No API key required.

**Inputs**

- Breed (`breed`, text, required): The breed whose varieties you want, as the Dog CEO API names it: one lowercase word such as "hound", "terrier" or "bulldog". Give the breed on its own, not one of its varieties. Search breeds will find the exact name for anything else.
- How many (`count`, number): Optional. How many sub-breeds to pick. Between 1 and 50; one by default. From 1 to 50. Default: `1`.

**Outputs**

- `breed` (text): The breed's name as the Dog CEO API spells it: lowercase, one word, e.g. "hound". This is what the other actions take.
- `count` (number): How many records are in this page.
- `display_name` (text): A readable name for the breed, e.g. "Afghan Hound".
- `sub_breeds` (list): The sub-breeds that were picked.

**Example output**

```json
{
  "breed": "hound",
  "count": 1,
  "display_name": "Hound",
  "sub_breeds": [
    {
      "breed": "hound",
      "breed_slug": "hound-afghan",
      "display_name": "Afghan Hound",
      "is_sub_breed": true,
      "sub_breed": "afghan"
    }
  ]
}
```

### List a breed's pictures

List every picture the Dog CEO API holds of one breed, a page at a time: hundreds for a popular breed, and for a whole breed that includes all of its varieties. Use it to build a gallery or to count what exists. No API key required.

**Inputs**

- Breed (`breed`, text, required): The breed, as the Dog CEO API names it: one lowercase word such as "hound", "retriever" or "poodle". A sub-breed can be given here too, written either way round ("hound/afghan" or "afghan hound"), and Search breeds will find the exact name for anything else.
- Sub-breed (`sub_breed`, text): Optional. The variety within that breed, e.g. "afghan" for a hound or "golden" for a retriever. Leave blank to cover the whole breed, sub-breeds included.
- Number of results (`limit`, number): Optional. How many pictures to return in this page. Between 1 and 100; 25 by default. From 1 to 100. Default: `25`.
- Skip (`offset`, number): Optional. How many records to skip before this page. Use the next offset from the previous result to page through. 0 by default. At least 0. Default: `0`.

**Outputs**

- `breed` (text): The breed's name as the Dog CEO API spells it: lowercase, one word, e.g. "hound". This is what the other actions take.
- `breed_slug` (text): The breed and sub-breed joined the way an image URL writes them, e.g. "hound-afghan". Can be passed straight back in as the breed.
- `count` (number): How many records are in this page.
- `display_name` (text): A readable name for the breed, e.g. "Afghan Hound".
- `has_more` (true/false): True when more records exist than this page holds.
- `images` (list): The pictures in this page.
- `is_sub_breed` (true/false): True when this row names a sub-breed rather than a breed.
- `next_offset` (number): The offset that fetches the next page. Null when this is the last one.
- `sub_breed` (text): The sub-breed within that breed, e.g. "afghan". Null when the record is a whole breed rather than one of its varieties.
- `total_count` (number): How many records there are in total, across every page.

**Example output**

```json
{
  "breed": "hound",
  "breed_slug": "hound-afghan",
  "count": 1,
  "display_name": "Afghan Hound",
  "has_more": true,
  "images": [
    {
      "alt_text": "Afghan hound dog",
      "breed": "hound",
      "breed_slug": "hound-afghan",
      "display_name": "Afghan Hound",
      "sub_breed": "afghan",
      "url": "https://images.dog.ceo/breeds/hound-afghan/n02088094_1003.jpg"
    }
  ],
  "is_sub_breed": true,
  "next_offset": 25,
  "sub_breed": "afghan",
  "total_count": 239
}
```

### List breeds

List every dog breed the Dog CEO API knows, each with the sub-breeds inside it, a page at a time. This is the catalogue the other actions draw on: the names here are the ones they take. No API key required.

**Inputs**

- Main breeds only (`main_breeds_only`, true/false): Optional. Return just the main breed names, without the sub-breeds inside each one. Off by default. Default: `false`.
- Number of results (`limit`, number): Optional. How many breeds to return in this page. Between 1 and 100; 25 by default. From 1 to 100. Default: `25`.
- Skip (`offset`, number): Optional. How many records to skip before this page. Use the next offset from the previous result to page through. 0 by default. At least 0. Default: `0`.

**Outputs**

- `breeds` (list): The breeds in this page.
- `count` (number): How many records are in this page.
- `has_more` (true/false): True when more records exist than this page holds.
- `next_offset` (number): The offset that fetches the next page. Null when this is the last one.
- `sub_breeds_included` (true/false): True when each breed came back with its sub-breeds listed. False when only the main breed names were asked for.
- `total_count` (number): How many records there are in total, across every page.
- `total_sub_breed_count` (number): How many sub-breeds exist across every breed. Null when only the main breed names were asked for.

**Example output**

```json
{
  "breeds": [
    {
      "breed": "hound",
      "display_name": "Hound",
      "has_sub_breeds": true,
      "sub_breed_count": 7,
      "sub_breeds": [
        "afghan",
        "basset",
        "blood",
        "english",
        "ibizan",
        "plott",
        "walker"
      ]
    }
  ],
  "count": 1,
  "has_more": true,
  "next_offset": 25,
  "sub_breeds_included": true,
  "total_count": 98,
  "total_sub_breed_count": 108
}
```

### List sub-breeds

List the varieties within one breed, e.g. the seven kinds of hound or the twenty-five kinds of terrier. A breed with none comes back as an empty list rather than an error, so a workflow can branch on the count. No API key required.

**Inputs**

- Breed (`breed`, text, required): The breed whose varieties you want, as the Dog CEO API names it: one lowercase word such as "hound", "terrier" or "bulldog". Give the breed on its own, not one of its varieties. Search breeds will find the exact name for anything else.

**Outputs**

- `breed` (text): The breed's name as the Dog CEO API spells it: lowercase, one word, e.g. "hound". This is what the other actions take.
- `count` (number): How many sub-breeds this breed has.
- `display_name` (text): A readable name for the breed, e.g. "Afghan Hound".
- `has_sub_breeds` (true/false): True when this breed has varieties. Branch on it before asking for one.
- `sub_breeds` (list): The varieties within this breed.

**Example output**

```json
{
  "breed": "hound",
  "count": 7,
  "display_name": "Hound",
  "has_sub_breeds": true,
  "sub_breeds": [
    {
      "breed": "hound",
      "breed_slug": "hound-afghan",
      "display_name": "Afghan Hound",
      "is_sub_breed": true,
      "sub_breed": "afghan"
    }
  ]
}
```

### Search breeds

Find the breeds and sub-breeds whose name matches some text. This is how a workflow turns what a person typed into the breed the Dog CEO API takes: "golden retriever" comes back as the retriever breed and its golden sub-breed. Every word has to appear, in any order. No API key required.

**Inputs**

- Search text (`query`, text, required): The breed to look for. Capitals and word order do not matter, so "Golden Retriever" and "retriever golden" find the same breed.
- Number of results (`limit`, number): Optional. How many matches to return in this page. Between 1 and 100; 25 by default. From 1 to 100. Default: `25`.
- Skip (`offset`, number): Optional. How many records to skip before this page. Use the next offset from the previous result to page through. 0 by default. At least 0. Default: `0`.

**Outputs**

- `count` (number): How many records are in this page.
- `has_more` (true/false): True when more records exist than this page holds.
- `matches` (list): The matching breeds and sub-breeds in this page.
- `next_offset` (number): The offset that fetches the next page. Null when this is the last one.
- `query` (text): The text that was searched for.
- `total_count` (number): How many records there are in total, across every page.

**Example output**

```json
{
  "count": 1,
  "has_more": false,
  "matches": [
    {
      "breed": "retriever",
      "breed_slug": "retriever-golden",
      "display_name": "Golden Retriever",
      "is_sub_breed": true,
      "sub_breed": "golden",
      "sub_breed_count": 0,
      "sub_breeds": []
    }
  ],
  "next_offset": null,
  "query": "golden retriever",
  "total_count": 1
}
```
