Attempting to send push notification from my laravel server to expo not working

Please provide the following:

  1. SDK Version:37
  2. Platforms(Android/iOS/web/all):Expo mobile app android /ios

This is the api error that i recieve when i make a post request to expo api:

{"errors":[{"code":"API_ERROR","message":"child \"to\" fails because [\"to\" is required], \"value\" must be an

This is the request i am trying to make

       'to' => "ExponentPushToken[xxxxxxxxxxxxxxxx]",
       'body'=>'hello World',


     $response = Http::withHeaders([
         'Content-Type' => 'application/json',
     ])->post('', [
         'debug' => TRUE,
         'body' => $payload,

but when i make the api call from my expo app using javascript its works fine

  sendPushNotification = async () => {
    const message = {
      to: this.state.expoPushToken,
      sound: 'default',
      title: 'Hello',
      body: 'Hello World',
      data: { data: 'goes here' },
      _displayInForeground: true,

    const response = await fetch('', {
      method: 'POST',
      headers: {
        Accept: 'application/json',
        'Accept-encoding': 'gzip, deflate',
        'Content-Type': 'application/json',
      body: JSON.stringify(message),

FINALLY FIXED IT ! this dude s answer solved it for me ,any way i changed my laravel code to


              'to' => "ExponentPushToken[xxxxxxxxxxxxxxxxx]",
              'body'=>'hello world',

        $curl = curl_init();

        curl_setopt_array($curl, array(
            CURLOPT_URL => "",
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_ENCODING => "",
            CURLOPT_MAXREDIRS => 10,
            CURLOPT_TIMEOUT => 30,
            CURLOPT_POSTFIELDS => json_encode($payload),
            CURLOPT_HTTPHEADER => array(
                "Accept: application/json",
                "Accept-Encoding: gzip, deflate",
                "Content-Type: application/json",
                "cache-control: no-cache",

        $response = curl_exec($curl);

        $err = curl_error($curl);


        if ($err) {
            return $err;
        } else {
            return $response;

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.