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

# CommunityNotesClient

> Methods for X API v2 Community Notes endpoints.

Access **Community Notes** endpoints via `client.community_notes` (`CommunityNotesClient`).

## Methods

| Method | Endpoint | Behavior | Summary |
| :- | :- | :- | :- |
| [`create`](#create) | `POST /2/notes` | Standard | Create a Community Note |
| [`delete`](#delete) | `DELETE /2/notes/{id}` | Standard | Delete a Community Note |
| [`evaluate`](#evaluate) | `POST /2/notes/evaluate` | Standard | Evaluate a Community Note |
| [`search_eligible_posts`](#search_eligible_posts) | `GET /2/notes/search/posts_eligible_for_notes` | Paginated | Search for Posts Eligible for Community Notes |
| [`search_written`](#search_written) | `GET /2/notes/search/notes_written` | Paginated | Search for Community Notes Written |

## `create`

POST `/2/notes`

**Create a Community Note**

Creates a Community Note on a Post. With test\_mode set to true, the note is only for testing and is not publicly visible.

```ruby theme={null}
require "xdk"

client = Xdk::Client.new(access_token: ENV.fetch("X_ACCESS_TOKEN"))

response = client.community_notes.create(
  body: { "test_mode" => true, "post_id" => "1895000000000000000", "info" => { "text" => "Hello from XDK!", "classification" => "misinformed_or_potentially_misleading", "misleading_tags" => ["disputed_claim_as_fact"], "trustworthy_sources" => true } }
)
puts response
```

### Parameters

**body** `Hash` *required*

Request payload.

**Returns:** `Hash`

***

## `delete`

DELETE `/2/notes/{id}`

**Delete a Community Note**

Deletes a community note.

```ruby theme={null}
require "xdk"

client = Xdk::Client.new(access_token: ENV.fetch("X_ACCESS_TOKEN"))

response = client.community_notes.delete(id: "1895000000000000000")
puts response
```

### Parameters

**id** `String` *required*

`id` (path parameter).

**Returns:** `Hash`

***

## `evaluate`

POST `/2/notes/evaluate`

**Evaluate a Community Note**

Evaluates the text of a proposed Community Note on a Post and returns its claim-opinion score.

```ruby theme={null}
require "xdk"

client = Xdk::Client.new(access_token: ENV.fetch("X_ACCESS_TOKEN"))

response = client.community_notes.evaluate(
  body: { "post_id" => "1895000000000000000", "note_text" => "example" }
)
puts response
```

### Parameters

**body** `Hash` *required*

Request payload.

**Returns:** `Hash`

***

## `search_eligible_posts`

GET `/2/notes/search/posts_eligible_for_notes` Paginated

**Search for Posts Eligible for Community Notes**

Retrieves Posts that are eligible for Community Notes.

```ruby theme={null}
require "xdk"

client = Xdk::Client.new(access_token: ENV.fetch("X_ACCESS_TOKEN"))

client.community_notes.search_eligible_posts(test_mode: true).each do |page|
  puts page["data"]
end
```

### Parameters

**test\_mode** `Boolean` *required*

`test_mode` (query parameter).

**Optional keyword arguments (9)**

**max\_results** `Integer`

`max_results` (query parameter).

**pagination\_token** `String`

`pagination_token` (query parameter).

**post\_selection** `String`

`post_selection` (query parameter).

**post\_fields** `Array\<String\>`

A comma separated list of Post fields to display.

**expansions** `Array\<String\>`

A comma separated list of fields to expand.

**user\_fields** `Array\<String\>`

A comma separated list of User fields to display.

**media\_fields** `Array\<String\>`

A comma separated list of Media fields to display.

**poll\_fields** `Array\<String\>`

A comma separated list of Poll fields to display.

**place\_fields** `Array\<String\>`

A comma separated list of Place fields to display.

**Returns:** `Enumerator<Hash>`

***

## `search_written`

GET `/2/notes/search/notes_written` Paginated

**Search for Community Notes Written**

Retrieves the Community Notes written by the authenticated user.

```ruby theme={null}
require "xdk"

client = Xdk::Client.new(access_token: ENV.fetch("X_ACCESS_TOKEN"))

client.community_notes.search_written(test_mode: true).each do |page|
  puts page["data"]
end
```

### Parameters

**test\_mode** `Boolean` *required*

`test_mode` (query parameter).

**Optional keyword arguments (3)**

**max\_results** `Integer`

`max_results` (query parameter).

**pagination\_token** `String`

`pagination_token` (query parameter).

**note\_fields** `Array\<String\>`

A comma separated list of Note fields to display.

**Returns:** `Enumerator<Hash>`

***
