# Core API Endpoints

## Core API Endpoints

### Fetch Governance Proposals

Retrieve a list of active and past governance proposals.

```
GET /proposals
Response:
[
  {
    "proposalId": 1,
    "title": "Update Risk Parameters",
    "state": "Active",
    "createdAt": "2024-02-05T12:00:00Z",
    "votesFor": 150000000,
    "votesAgainst": 50000000
  }
]
```

### Get Proposal Details

Retrieve details of a specific proposal by proposalId.

```

GET /proposals/{proposalId}
Response:
{
  "proposalId": 1,
  "title": "Update Risk Parameters",
  "description": "Adjust risk parameters for oETH market.",
  "state": "Active",
  "votesFor": 150000000,
  "votesAgainst": 50000000,
  "quorum": 200000000,
  "timelockExpiration": "2024-02-07T12:00:00Z"
}
```

### Cast a Vote

Submit a vote for a proposal.

```
POST /vote
Request Body:
{
  "proposalId": 1,
  "voter": "0x123456789abcdef",
  "support": true,
  "signature": "0xabcdef..."
}
Response:
{
  "status": "success",
  "message": "Vote successfully recorded."
}
```

### Fetch Voter Receipts

Retrieve voting receipt details for a given proposalId and voter address.

```
GET /receipts/{proposalId}/{voter}
Response:
{
  "proposalId": 1,
  "voter": "0x123456789abcdef",
  "hasVoted": true,
  "support": true,
  "votes": 5000000
}
```

### Get Proposal State

Retrieve the current state of a proposal.

```
GET /proposals/{proposalId}/state
Response:
{
  "proposalId": 1,
  "state": "Active"
}
```

#### Security Considerations

* Rate limits apply to prevent abuse of the API.
* Authentication may be required for certain endpoints, such as submitting votes.
* All API interactions should be performed using secure HTTPS connections.

<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.onyx.org/api/core-api-endpoints.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
