<!-- source: https://secondlayer.tools/docs/api-reference#get-print-schema -->

## Print payload schemas for a contract

`GET /v1/index/contracts/{contract_id}/print-schema`

Infers the shape of a contract's `print` payloads from its canonical print events, grouped by the tuple's `topic` field. Reads the newest 1500 and oldest 500 events, so fields the contract stopped emitting still show. Takes no query parameters. Held in memory for 5 minutes per contract. Not metered.

### Path parameters

| Name | Type | Description |
| --- | --- | --- |
| `contract_id` | string, required | Contract principal, `<address>.<name>`. Anything that does not look like one is refused. |

### Returns

One `PrintSchema` object.

### Responses

- `200` Inferred print schemas
- `400` `contract_id` is not a contract principal, or a query parameter was sent (`VALIDATION_ERROR`)
- `401` This bind requires the instance token, and it was missing or wrong
- `429` Rate limited; retry after `Retry-After` seconds

### Example

```bash
curl https://api.secondlayer.tools/v1/index/contracts/SP2BM6AQSMQ04CX8KDE62QBFVZTDZ2ZX80GZJSBZ4.zc-claim-helper-v2/print-schema \
  -H "Authorization: Bearer $SECONDLAYER_API_KEY"
```

```json
{
  "contract_id": "SP2BM6AQSMQ04CX8KDE62QBFVZTDZ2ZX80GZJSBZ4.zc-claim-helper-v2",
  "topics": [
    {
      "topic": "zc-claim-ok",
      "count": 2,
      "first_height": 9004646,
      "last_height": 9004646,
      "non_tuple": false,
      "fields": [
        {
          "name": "earned",
          "camel_name": "earned",
          "clarity_type": "uint",
          "ts_type": "bigint",
          "column_type": "uint",
          "always_present": true
        },
        {
          "name": "reward-cycle",
          "camel_name": "rewardCycle",
          "clarity_type": "uint",
          "ts_type": "bigint",
          "column_type": "uint",
          "always_present": true
        },
        {
          "name": "staker",
          "camel_name": "staker",
          "clarity_type": "principal",
          "ts_type": "string",
          "column_type": "principal",
          "always_present": true
        },
        {
          "name": "withdrawal-request",
          "camel_name": "withdrawalRequest",
          "clarity_type": "(optional ?)",
          "ts_type": "unknown | null",
          "column_type": "jsonb",
          "always_present": true,
          "optional_some_rate": 0
        }
      ]
    },
    {
      "topic": "claim-many",
      "count": 1,
      "first_height": 9004646,
      "last_height": 9004646,
      "non_tuple": false,
      "fields": [
        {
          "name": "err-count",
          "camel_name": "errCount",
          "clarity_type": "uint",
          "ts_type": "bigint",
          "column_type": "uint",
          "always_present": true
        },
        {
          "name": "manager",
          "camel_name": "manager",
          "clarity_type": "principal",
          "ts_type": "string",
          "column_type": "principal",
          "always_present": true
        },
        {
          "name": "ok-count",
          "camel_name": "okCount",
          "clarity_type": "uint",
          "ts_type": "bigint",
          "column_type": "uint",
          "always_present": true
        },
        {
          "name": "submitted",
          "camel_name": "submitted",
          "clarity_type": "uint",
          "ts_type": "bigint",
          "column_type": "uint",
          "always_present": true
        }
      ]
    }
  ],
  "sampled": false,
  "total_events": 3,
  "total_events_capped": false,
  "sample": {
    "size": 3,
    "newest_height": 9004646,
    "oldest_height": 9004646
  },
  "tip": {
    "block_height": 9048938,
    "finalized_height": 9048671,
    "lag_seconds": 23,
    "source_block_height": 9048938
  }
}
```
