# starknet_getClassAt - Get the contract clas...

Get the contract class definition in the given block at the given address

## Request Parameters

- `block_id` (`string, required`): Block reference ("latest", "l1_accepted", block hash, or block number)
- `contract_address` (`felt252, required`): Contract address

## Request Example

```json
{
  "jsonrpc": "2.0",
  "method": "starknet_getClassAt",
  "params": [
    "latest",
    "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7"
  ],
  "id": 1
}
```

## Response Fields

- `result` (`OBJECT, required`): The contract class Contract class definition with Sierra program, entry points, and ABI

## Successful Response

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {}
}
```

## Errors

| Code | Message            |
| ---- | ------------------ |
| 24   | Block not found    |
| 20   | Contract not found |

## Examples

cURL
JavaScript

```bash
curl -X POST https://api-starknet-mainnet.n.dwellir.com/YOUR_API_KEY \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "starknet_getClassAt",
    "params": [
      "latest",
      "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7"
    ],
    "id": 1
  }'
```

```javascript
import { RpcProvider } from 'starknet';

const provider = new RpcProvider({
  nodeUrl: 'https://api-starknet-mainnet.n.dwellir.com/YOUR_API_KEY',
});

const payload = {
  method: 'starknet_getClassAt',
  params: [
    "latest",
    "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7"
  ]
};

const result = await provider.fetchEndpoint(payload.method, payload.params);
console.log(result);
```
