# Get an artifact preview

The cached raster snapshot for a commit, as an image response.

## GET `/v1/artifacts/{ref}/preview`

### Authorization

`Authorization` Bearer token · header required

- `Authorization: Bearer <key>` with the Space key (`sfc_` prefix) of an unclaimed Space. The same key is the fragment of the claim URL and the token in the Space's `/_/__/<key>` sign-in URL.

or

- `Authorization` Bearer token · header required
  
  `Authorization: Bearer <token>` with an API key (`sfa_` prefix), an OAuth access token, a session token, or a Space machine credential (`sfm_` prefix).

or

- `Authorization` OAuth2 access token · header required
  
  OAuth 2.0 with Spacefast scopes. People use the authorization code flow; machines use client credentials.

**Scopes:** `connectors:read`

### Path parameters

- `ref` string required

### Query parameters

- `team` string (min length 1)
- `commitSha` string required (min length 1)

### Responses

- **200** The artifact preview, as an image.
- **404** No preview cached for that commit.

## Try it

### Server

**Base URL** https://api.spacefast.com  
Custom base URL Overrides the selected server when set.

### Request

#### cURL

```bash
curl -X GET "https://api.spacefast.com/v1/artifacts/string/preview?commitSha=string" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

#### JavaScript

```javascript
const response = await fetch("https://api.spacefast.com/v1/artifacts/string/preview?commitSha=string", {
  method: "GET",
  headers: {
    "Authorization": "Bearer YOUR_TOKEN"
  }
});
```

#### Python

```python
import requests

response = requests.get(
    "https://api.spacefast.com/v1/artifacts/string/preview?commitSha=string",
    headers={
        "Authorization": "Bearer YOUR_TOKEN"
    },
)
```

### Response

- **200**  
The artifact preview, as an image.

- **404**  
No preview cached for that commit.
