Accessing the pexels image library using the API You should regsiter with the website who ll give you a key similar to the one below which you can use to access search for images const apikey 563492ad6f917000010000019b983f3b62fe43daa92e746d4553dd35 fetch https api pexels com v1 search query people headers Authorization apikey then resp return resp json then data console log data console log ready Accessing the pexels image library using the API You should regsiter with the website who ll give you a key similar to the one below which you can use to access search for images This example grabs pictures of cats we get the first one and add it to the page output const apikey 563492ad6f917000010000019b983f3b62fe43daa92e746d4553dd35 fetch https api pexels com v1 search query cats headers Authorization apikey then resp return resp json then data let photo data photos 0 console log photo let img document createElement img img src photo src large document body appendChild img document body style height 400pt console log ready
which you can use to access search for images This example grabs pictures of cats we get the first one and add it to the page output const apikey 563492ad6f917000010000019b983f3b62fe43daa92e746d4553dd35 fetch https api pexels com v1 search query cats headers Authorization apikey then resp return resp json then data let photo data photos 0 console log photo let img document createElement img img src photo src large document body appendChild img document body style height 400pt console log ready