> ## Documentation Index
> Fetch the complete documentation index at: https://solana.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# Create Attestation

> Creates a new attestation under a specific credential and schema

Creates a new attestation under a specific credential and schema. This
instruction allows authorized signers to create attestations that contain
verified data and have a defined expiration time.

## Parameters

| Parameter       | Type                | Description                                                                 |
| --------------- | ------------------- | --------------------------------------------------------------------------- |
| `payer`         | `TransactionSigner` | The account that will pay for the transaction                               |
| `authority`     | `TransactionSigner` | The authorized signer of the credential                                     |
| `credential`    | `Address`           | The credential account associated with the schema                           |
| `schema`        | `Address`           | The schema account that defines the attestation structure                   |
| `attestation`   | `Address`           | The attestation account to create                                           |
| `systemProgram` | `Address`           | The System Program account (defaults to '11111111111111111111111111111111') |
| `nonce`         | `Address`           | A unique identifier for the attestation                                     |
| `data`          | `Uint8Array`        | The attestation data that must conform to the schema                        |
| `expiry`        | `number \| bigint`  | The expiration timestamp for the attestation                                |

## Returns

Returns an `Instruction` (`{ accounts, data, programAddress }`). Add it to a
transaction and send it with your client, for example
`client.sendTransaction(instruction)`. There is no `sendAndConfirm()` method.
[Create a Client](/developers/docs/tools/attestations/quickstart/installation#create-a-client) sets up `client`, `payerSigner`, and `authoritySigner`.

## Example

```typescript
import {
  deriveAttestationPda,
  getCreateAttestationInstruction
} from "sas-lib";

// The attestation account is a PDA derived from the credential, schema and nonce
const [attestationPda] = await deriveAttestationPda({
  credential: credentialAddress,
  schema: schemaAddress,
  nonce: nonceAddress
});

const instruction = getCreateAttestationInstruction({
  payer: payerSigner,
  authority: authoritySigner,
  credential: credentialAddress,
  schema: schemaAddress,
  attestation: attestationPda,
  nonce: nonceAddress,
  data: attestationData,
  expiry: expiryTimestamp
});

// Send the instruction with your Kit client
await client.sendTransaction(instruction);
```

## Important Notes

- Only authorized signers of the credential can create attestations
- The authority must be a signer of the transaction
- The payer must be a signer of the transaction
- The attestation account must be writable
- The credential and schema accounts must be readable
- This operation requires the System Program for rent exemption calculations
- The schema must not be paused
- The data must conform to the schema's structure and validation rules
- The nonce must be unique for each attestation
- The expiry timestamp must be in the future
- The attestation will be invalid after the expiry timestamp
- The credential must be associated with the schema
