# Raw Requests

**Package:** Anthropic Laravel | **Version:** 1 | **URL:** https://mozex.dev/docs/anthropic-laravel/v1/usage/raw-requests

---

`Anthropic::request()` calls any API path, for an endpoint the package has no method for yet. Your key, the config's headers and retries, and `Anthropic::withOptions()` all apply, and an error status throws the same exceptions as every other call.

```php
use Anthropic\Laravel\Facades\Anthropic;
use Illuminate\Support\Facades\Cache;

// The first page; pass its next_page back as 'page' for the next one.
$skills = Cache::remember('anthropic.skills', now()->addHour(), function () {
    return Anthropic::request('GET', 'skills', ['limit' => 100])->data['data'];
});
```

`GET` and `DELETE` send the parameters in the query string, `POST` and `PUT` in a JSON body, and a `betas` parameter becomes the `anthropic-beta` header, as on every other call. `->data` is the decoded JSON (or the body's text when it isn't JSON), `->status` is the HTTP status, and `->meta()` has the request ID and rate-limit headers. The path works with or without the `/v1` the API reference prints.

## Testing

Queue a `RawResponse::fake()` with the whole body you want back, and assert on `Raw::class`:

```php
use Anthropic\Resources\Raw;
use Anthropic\Responses\Raw\RawResponse;

Anthropic::fake([
    RawResponse::fake(['data' => [], 'next_page' => null]),
]);

$this->get('/skills')->assertOk();

Anthropic::assertSent(Raw::class, fn (string $method, string $httpMethod, string $path): bool => $path === 'skills');
```

The fake records the path exactly as your code passed it, so `/v1/skills` and `skills` assert differently. A status other than 200 is a named argument: `RawResponse::fake('', status: 204)` fakes an answer without a body.

---

For the response shape, paths and what's recorded, see the [Raw Requests page in the PHP docs](https://mozex.dev/docs/anthropic-php/v1/usage/raw-requests) or the [Anthropic API reference](https://platform.claude.com/docs/en/api/overview).

---

## Table of Contents

- [Introduction](https://mozex.dev/docs/anthropic-laravel/v1)
- [AI Integration](https://mozex.dev/docs/anthropic-laravel/v1/ai-integration)
- [Support Us](https://mozex.dev/docs/anthropic-laravel/v1/support-us)
- [Requirements](https://mozex.dev/docs/anthropic-laravel/v1/requirements)
- [Changelog](https://mozex.dev/docs/anthropic-laravel/v1/changelog)
- [Contributing](https://mozex.dev/docs/anthropic-laravel/v1/contributing)
- [Questions & Issues](https://mozex.dev/docs/anthropic-laravel/v1/questions-and-issues)
- [About Mozex](https://mozex.dev/docs/anthropic-laravel/v1/about)

### Usage

- [Messages](https://mozex.dev/docs/anthropic-laravel/v1/usage/messages)
- [Streaming](https://mozex.dev/docs/anthropic-laravel/v1/usage/streaming)
- [Tool Use](https://mozex.dev/docs/anthropic-laravel/v1/usage/tool-use)
- [Thinking](https://mozex.dev/docs/anthropic-laravel/v1/usage/thinking)
- [Server Tools](https://mozex.dev/docs/anthropic-laravel/v1/usage/server-tools)
- [Citations](https://mozex.dev/docs/anthropic-laravel/v1/usage/citations)
- [Token Counting](https://mozex.dev/docs/anthropic-laravel/v1/usage/token-counting)
- [Models](https://mozex.dev/docs/anthropic-laravel/v1/usage/models)
- [Batches](https://mozex.dev/docs/anthropic-laravel/v1/usage/batches)
- [Completions](https://mozex.dev/docs/anthropic-laravel/v1/usage/completions)
- [Files](https://mozex.dev/docs/anthropic-laravel/v1/usage/files)
- [Raw Requests](https://mozex.dev/docs/anthropic-laravel/v1/usage/raw-requests)

### Reference

- [Configuration](https://mozex.dev/docs/anthropic-laravel/v1/reference/configuration)
- [Error Handling](https://mozex.dev/docs/anthropic-laravel/v1/reference/error-handling)
- [Meta Information](https://mozex.dev/docs/anthropic-laravel/v1/reference/meta-information)
- [Testing](https://mozex.dev/docs/anthropic-laravel/v1/reference/testing)
- [Using alongside laravel/ai](https://mozex.dev/docs/anthropic-laravel/v1/reference/laravel-ai)
- [Diagnostics](https://mozex.dev/docs/anthropic-laravel/v1/reference/diagnostics)