https://hadithapi.com/api/{bookSlug}/chapters?apiKey={API_KEY}

Replace any book slug with {bookSlug}. E.g; sahih-bukhari.
See the book slugs.

Path Parameters
apiKey (required)
Your api key, generated in your profile.
Query Parameters
paginate (optional)
Number of chapters you want to paginate.
Default: none
Responses
403
Forbidden - API key is required.
401
Unauthorized - API key is invalid.
404
Not found - Books not found.
200
Success - Books has been found.
Book slugs
Book Slug
Sahih Bukhari sahih-bukhari
Sahih Muslim sahih-muslim
Jami' Al-Tirmidhi al-tirmidhi
Sunan Abu Dawood abu-dawood
Sunan Ibn-e-Majah ibn-e-majah
Sunan An-Nasa`i sunan-nasai
Mishkat Al-Masabih mishkat
Musnad Ahmad musnad-ahmad
Al-Silsila Sahiha al-silsila-sahiha
Sample code:
                    
                        const apiUrl = 'https://hadithapi.com/api/sahih-bukhari/chapters?apiKey={API_KEY}';
                        fetch(apiUrl)
                        .then(response => response.json())
                        .then(data => {
                            console.log(data);
                        })
                        .catch(error => {
                            console.log(error);
                        })
                    
                
                    
                        const apiUrl = 'https://hadithapi.com/api/sahih-bukhari/chapters?apiKey={API_KEY}';
                        $.ajax({
                            url: apiUrl,
                            type: 'get',
                            success: function(data){
                                console.log(data);
                            },
                            error: function(err){
                                console.log(err);
                            }
                        })
                    
                
                    
                        $response = file_get_contents('https://hadithapi.com/api/sahih-bukhari/chapters?apiKey={API_KEY}');
                        $response = json_decode($response);
                        print_r($response);