> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# Upvote

# Package: comments

# Namespace: Votes

# Method link: https://dev.wix.com/docs/api-reference/crm/community/feedback-moderation/comments/vote-v1/upvote.md

## Permission Scopes:
Manage comment votes: SCOPE.DC_COMMENTS.MANAGE-VOTES

## Introduction

Casts an upvote on a resource for the current identity.

Changes the current identity's existing downvote to an upvote.
Repeating the same vote doesn't remove it. To clear a vote, call
[Remove Vote](https://dev.wix.com/docs/api-reference/crm/community/feedback-moderation/comments/vote-v1/remove-vote.md).
Specify the resource's app and context in `contextData`. Voting must be enabled for that context.

---

## REST API

### Schema

```
 Method: upvote
 Description: Casts an upvote on a resource for the current identity.  Changes the current identity's existing downvote to an upvote. Repeating the same vote doesn't remove it. To clear a vote, call [Remove Vote](https://dev.wix.com/docs/api-reference/crm/community/feedback-moderation/comments/vote-v1/remove-vote.md). Specify the resource's app and context in `contextData`. Voting must be enabled for that context.
 URL: https://www.wixapis.com/v1/votes/upvote
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  resourceId, resourceFqdn
 Method parameters: 
   param name: contextData | type: ContextData | description: Identifies the app and context containing the resource. When provided, `contextData` takes precedence over the deprecated `contextToken`.  
        - name: appDefId | type: string | description: GUID of the app that owns the context.  | validation: format GUID
        - name: contextId | type: string | description: GUID of the context containing the resource.  | validation: maxLength 128
        - name: contextType | type: string | description: Optional type used by the app to resolve its context.  
   param name: contextToken | type: contextToken | description: Legacy context token. Use `contextData` instead.  
   param name: resourceFqdn | type: resourceFqdn | description: Entity type receiving the vote. For comments, specify `wix.comments.v2.comment`. | required: true | validation: maxLength 300
   param name: resourceId | type: resourceId | description: GUID of the resource receiving the vote. For a comment, specify the comment GUID. | required: true | validation: maxLength 128
 Return type: UpvoteResponse
  - name: vote | type: Vote | description: Vote cast or updated.  
     - name: resourceId | type: string | description: GUID of the resource receiving the vote. For comments, this is the comment GUID.  | validation: maxLength 128
     - name: resourceFqdn | type: string | description: Entity type receiving the vote. For comments, this is `wix.comments.v2.comment`.  | validation: maxLength 300
     - name: voteId | type: string | description: Vote GUID.  | read-only: true | validation: format GUID
     - name: type | type: Type | description: Vote type.  | read-only: true 
         - enum:
         -     UNKNOWN: Unknown vote type.
         -     UPVOTE: Vote in favor of the resource.
         -     DOWNVOTE: Vote against the resource.
     - name: createdBy | type: SocialIdentity | description: Identity that cast the vote.  | read-only: true 
        - name: identityId | type: string | description:   | validation: format GUID
        - name: identityType | type: IdentityType | description:   
             - enum: ANONYMOUS, MEMBER, USER, SERVICE, MEMBER_GROUP
     - name: createdDate | type: string | description: Date and time the vote was created.  | read-only: true | validation: format date-time
     - name: updatedDate | type: string | description: Date and time the vote was updated.  | read-only: true | validation: format date-time
     - name: context | type: VoteContext | description: App and context containing the resource.  
        - name: contextId | type: string | description: GUID of the context containing the resource.  | validation: maxLength 128
        - name: contextType | type: string | description: Type used by the app to identify the context.  
        - name: appDefId | type: string | description: GUID of the app that owns the context.  | read-only: true | validation: format GUID
        - name: metaSiteId | type: string | description: Site GUID.  | read-only: true | validation: format GUID
     - name: revision | type: string | description: Revision number, which increments when the vote is updated.  | read-only: true 

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: MISSING_METASITE_CONTEXT | Description: The authenticated request does not contain a site context.
   HTTP Code: 403 | Status Code: PERMISSION_DENIED | Application Code: PERMISSION_DENIED | Description: The [identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities.md) used to call the method doesn't have the required permissions.


```

### Examples

### Upvote a comment
Cast an upvote as a visitor or member. Replace the sample comment and category IDs with values from a context that allows voting.

```curl
curl -X POST \
'https://www.wixapis.com/v1/votes/upvote' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
-d '{
  "contextData": {
    "appDefId": "91c9d6a7-6667-41fb-b0b4-7d3b3ff0b02e",
    "contextId": "64ad407e0bf87891bba7de3a"
  },
  "resourceId": "90616636-cfe2-4f3d-88ce-1c3d8e3eaa67",
  "resourceFqdn": "wix.comments.v2.comment"
}'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.comments.votes.upvote(options)
 Description: Casts an upvote on a resource for the current identity.  Changes the current identity's existing downvote to an upvote. Repeating the same vote doesn't remove it. To clear a vote, call [Remove Vote](https://dev.wix.com/docs/api-reference/crm/community/feedback-moderation/comments/vote-v1/remove-vote.md). Specify the resource's app and context in `contextData`. Voting must be enabled for that context.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  options.resourceId, options.resourceFqdn, options
 Method parameters: 
   param name: options | type: UpvoteOptions  none | required: true 
        - name: resourceId | type: string | description: GUID of the resource receiving the vote. For a comment, specify the comment GUID. | required: true | validation: maxLength 128
        - name: resourceFqdn | type: string | description: Entity type receiving the vote. For comments, specify `wix.comments.v2.comment`. | required: true | validation: maxLength 300
        - name: contextData | type: ContextData | description: App and context containing the resource.  
           - name: appDefId | type: string | description: GUID of the app that owns the context.  | validation: format GUID
           - name: contextId | type: string | description: GUID of the context containing the resource.  | validation: maxLength 128
           - name: contextType | type: string | description: Optional type used by the app to resolve its context.  
 Return type: PROMISE<UpvoteResponse>
  - name: vote | type: Vote | description: Vote cast or updated.  
     - name: resourceId | type: string | description: GUID of the resource receiving the vote. For comments, this is the comment GUID.  | validation: maxLength 128
     - name: resourceFqdn | type: string | description: Entity type receiving the vote. For comments, this is `wix.comments.v2.comment`.  | validation: maxLength 300
     - name: voteId | type: string | description: Vote GUID.  | read-only: true | validation: format GUID
     - name: type | type: Type | description: Vote type.  | read-only: true 
         - enum:
         -     UNKNOWN: Unknown vote type.
         -     UPVOTE: Vote in favor of the resource.
         -     DOWNVOTE: Vote against the resource.
     - name: createdBy | type: SocialIdentity | description: Identity that cast the vote.  | read-only: true 
        - name: identityId | type: string | description:   | validation: format GUID
        - name: identityType | type: IdentityType | description:   
             - enum: ANONYMOUS, MEMBER, USER, SERVICE, MEMBER_GROUP
     - name: _createdDate | type: Date | description: Date and time the vote was created.  | read-only: true 
     - name: _updatedDate | type: Date | description: Date and time the vote was updated.  | read-only: true 
     - name: context | type: VoteContext | description: App and context containing the resource.  
        - name: contextId | type: string | description: GUID of the context containing the resource.  | validation: maxLength 128
        - name: contextType | type: string | description: Type used by the app to identify the context.  
        - name: appDefId | type: string | description: GUID of the app that owns the context.  | read-only: true | validation: format GUID
        - name: metaSiteId | type: string | description: Site GUID.  | read-only: true | validation: format GUID
     - name: revision | type: string | description: Revision number, which increments when the vote is updated.  | read-only: true 

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: MISSING_METASITE_CONTEXT | Description: The authenticated request does not contain a site context.
   HTTP Code: 403 | Status Code: PERMISSION_DENIED | Application Code: PERMISSION_DENIED | Description: The [identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities.md) used to call the method doesn't have the required permissions.


```

### Examples

### Upvote for the current identity
Use visitor or member authentication and replace the sample IDs with your comment, vote, and voting-enabled category IDs as applicable.

```javascript
import { votes } from "@wix/comments";

export async function upvoteExample() {
  const response = await votes.upvote({
    resourceId: "90616636-cfe2-4f3d-88ce-1c3d8e3eaa67",
    resourceFqdn: "wix.comments.v2.comment",
    contextData: {
      appDefId: "91c9d6a7-6667-41fb-b0b4-7d3b3ff0b02e",
      contextId: "64ad407e0bf87891bba7de3a",
    },
  });
  return response;
}

/* Promise resolves to:
{
  vote: {
    voteId: "5361b1fb-4e51-43f8-9247-05e1253b3119",
    resourceId: "90616636-cfe2-4f3d-88ce-1c3d8e3eaa67",
    resourceFqdn: "wix.comments.v2.comment",
    type: "UPVOTE",
    createdBy: { identityId: "81b3e2a2-60f4-4016-ab20-c2fda4c4c4f2", identityType: "MEMBER" },
    _createdDate: new Date("2026-09-09T09:00:00Z"),
    _updatedDate: new Date("2026-09-09T09:00:00Z"),
    context: {
      appDefId: "91c9d6a7-6667-41fb-b0b4-7d3b3ff0b02e",
      contextId: "64ad407e0bf87891bba7de3a",
      metaSiteId: "e4c3e43f-bcef-4d73-aee2-ab58ea702d03"
    },
    revision: "1"
  }
}
*/

```

### upvote (self-hosted)
Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { votes } from '@wix/comments';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { votes },
  // Include the auth strategy and host as relevant
});


async function upvote(options) {
  const response = await myWixClient.votes.upvote(options);
};
```

---