cgfaces.com API

API Documentation for cgfaces.com

Welcome to the documentation for cgfaces.com API. This API provides access to a large collection of high-quality images of people, places, and things that can be used for a variety of applications.


Getting Started:

To use the CGFaces API, you must first create an account on the CGFaces website. Once you have created an account, go to your profile and click on the "API Tokens" section. Fill in the required details to create an API token that you can use to access the API.

API Endpoint:

The base URL for the API is https://cgfaces.com/api. All requests to the API should be made using this URL.

Authentication:

All requests to the API require authentication using a bearer token. The token should be included in the Authorization header of each request.

To authenticate, use the following command:


  curl https://cgfaces.com/api/search
    -H "Accept: application/json"
    -H "Authorization: Bearer {token}"

              

Search for Images:

To search for images, use the following API endpoint:


  GET /search

              

Example Request:


  curl https://cgfaces.com/api/search?q=face&per_page=10&page=1
        -H "Accept: application/json"
        -H "Authorization: Bearer {token}"

              

Query Parameters:

  • q: The search query.
  • per_page: The number of results per page (default 20).
  • page: The page number to retrieve (default 1).

Example Response:

The API response is returned in JSON format. The response contains pagination information along with the search results. Each search result contains details of the image, including the UUID, width, height, slug, and URLs for different sizes of the image. The response also includes links for self, HTML, and download.

                
{
      "current_page": 1,
      "first_page_url": "http://cgfaces.com/api/search?page=1",
      "from": 1,
      "last_page": 8,
      "last_page_url": "http://cgfaces.com/api/search?page=8",
      "links": [
      {
          "url": null,
          "label": "« Previous",
          "active": false
      },
      {
          "url": "http://cgfaces.com/api/search?page=1",
          "label": "1",
          "active": true
      },
      {
          "url": "http://cgfaces.com/api/search?page=2",
          "label": "2",
          "active": false
      },
      {
          "url": "http://cgfaces.com/api/search?page=3",
          "label": "3",
          "active": false
      },
      {
          "url": "http://cgfaces.com/api/search?page=4",
          "label": "4",
          "active": false
      },
      {
          "url": "http://cgfaces.com/api/search?page=5",
          "label": "5",
          "active": false
      },
      {
          "url": "http://cgfaces.com/api/search?page=6",
          "label": "6",
          "active": false
      },
      {
          "url": "http://cgfaces.com/api/search?page=7",
          "label": "7",
          "active": false
      },
      {
          "url": "http://cgfaces.com/api/search?page=8",
          "label": "8",
          "active": false
      },
      {
          "url": "http://cgfaces.com/api/search?page=2",
          "label": "Next »",
          "active": false
      }],
      "next_page_url": "http://cgfaces.com/api/search?page=2",
      "path": "http://cgfaces.com/api/search",
      "per_page": 20,
      "prev_page_url": null,
      "to": 20,
      "total": 159,
      "results": [
      {
          "uuid": "bf527b1f-00a0-4c8b-8a39-959b0e56be29",
          "width": 4096,
          "height": 4096,
          "slug": "portrait-of-child-bf527b1f-00a0-4c8b-8a39-959b0e56be29",
          "updated_at": "2023-03-06T20:03:22.000000Z",
          "urls":
          {
              "thumb": "http://cgfaces.com/collection/preview/bf527b1f-00a0-4c8b-8a39-959b0e56be29.jpg",
              "small": "http://cgfaces.com/collection/1024px/bf527b1f-00a0-4c8b-8a39-959b0e56be29.jpg",
              "regular": "http://cgfaces.com/collection/2048px/bf527b1f-00a0-4c8b-8a39-959b0e56be29.jpg",
              "full": "http://cgfaces.com/collection/2048px/bf527b1f-00a0-4c8b-8a39-959b0e56be29.jpg"
          },
          "links":
          {
              "self": "http://cgfaces.com/api/image/portrait-of-child-bf527b1f-00a0-4c8b-8a39-959b0e56be29",
              "html": "http://cgfaces.com/en/image/portrait-of-child-bf527b1f-00a0-4c8b-8a39-959b0e56be29",
              "download": "http://cgfaces.com/download/portrait-of-child-bf527b1f-00a0-4c8b-8a39-959b0e56be29"
          },
          "download":
          {
              "small": "http://cgfaces.com/download/portrait-of-child-bf527b1f-00a0-4c8b-8a39-959b0e56be29/small",
              "regular": "http://cgfaces.com/download/portrait-of-child-bf527b1f-00a0-4c8b-8a39-959b0e56be29/regular",
              "large": "http://cgfaces.com/download/portrait-of-child-bf527b1f-00a0-4c8b-8a39-959b0e56be29"
          }
      }]
  }
                
            

Wrapping Up

The CGFaces API provides a simple way to search for images on the website. By following the documentation above, you should be able to easily integrate the API into your application. If you have any questions or issues, please contact us