"Bearer $token", 'Content-Type' => 'application/json' ])->post($endpoint . '/_synapse/admin/v1/registration_tokens/new', [ 'uses_allowed' => 1, 'length' => 12, 'expiry_time' => now()->addWeek()->valueOf(), ]); if ($response->successful()) { return $response->json()['token'] ?? null; } Log::error('Failed to create Synapse registration token', [ 'status' => $response->status(), 'body' => $response->body() ]); return null; } }