Zoho crm insert api is not working

Zoho crm insert api is not working

Hello all,

I am having issue in inserting data through post api in Lead .

I am getting this error: 

object(stdClass)#2 (4) { ["code"]=> string(22) "AUTHENTICATION_FAILURE" ["details"]=> object(stdClass)#3 (0) { } ["message"]=> string(21) "Authentication failed" ["status"]=> string(5) "error" }


My code is:

<?php

    function insert_leads(){
        $accesstoken = '1000.eb4d9947827e42da8f29b8d24d650259.734213ba7c517*****************';

        $post_data=[
            'data'=>[
                [
                    'Company' =>'Mildain',
                    'Last_Name' =>'Pandey',
                    'First_Name' =>'Saroj',
                    'Email' =>'saroj@mildain.in',
                    'State' =>'Delhi',
                    'Phone' =>'8377972697',
                    'Description' =>'This is test api',
                ]
                ],
                'trigger' =>[
                    "approval",
                    "workflow",
                    "blueprint"
                ]
            ];
            $ch = curl_init();
            curl_setopt($ch,CURLOPT_URL,'https://www.zohoapis.in/crm/v2/Leads');
            curl_setopt($ch,CURLOPT_POST, 1);                //0 for a get request
            curl_setopt($ch,CURLOPT_POSTFIELDS,json_encode($post_data));
            curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0);
            curl_setopt($ch,CURLOPT_HTTPHEADER,array('Authorization: Zoho-oauthtoken'.$accesstoken, 'Content-Type: application/x-www-form-urlencoded'));

            $response = curl_exec($ch);
            $response = json_decode($response);
            var_dump($response);
            // return $response;
            // echo '<pre>';
            // print_r($response);
    }
    insert_leads();

?>