> 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

# GetProviderState

# Package: marketplace

# Namespace: MarketplaceProviderStates

# Method link: https://dev.wix.com/docs/api-reference/account-level/studio-workspace/marketplace/provider-state-v1/get-provider-state.md

## Permission Scopes:
Manage CRM and Marketplace: SCOPE.ARENA.MANAGE-LEADS

## Introduction

Retrieves the provider state for the current account.
Each provider account has exactly one provider state, created during marketplace registration, so no ID is
required - the state is resolved from the calling account's identity. `id` on the returned state equals the
provider's account ID.

---

## REST API

### Schema

```
 Method: getProviderState
 Description: Retrieves the provider state for the current account. Each provider account has exactly one provider state, created during marketplace registration, so no GUID is required - the state is resolved from the calling account's identity. `id` on the returned state equals the provider's account GUID.
 URL: https://www.wixapis.com/partners/marketplace/v1/provider-states
 Method: GET
 Return type: GetProviderStateResponse
  - name: providerState | type: ProviderState | description: Retrieved provider state.  
     - name: id | type: string | description: Provider state GUID. Equal to the provider's account GUID.  | read-only: true | validation: format GUID
     - name: createdDate | type: string | description: Date and time the provider state was created.  | read-only: true | validation: format date-time
     - name: updatedDate | type: string | description: Date and time the provider state was last updated.  | read-only: true | validation: format date-time
     - name: publishedDate | type: string | description: Date and time the provider was first published to the marketplace.  | read-only: true | validation: format date-time
     - name: status | type: Status | description: Provider's current standing in the marketplace.  
        - name: statusType | type: Type | description: Provider's current status in the marketplace.  
             - enum:
             -     PENDING: Provider has registered for the marketplace and is awaiting review.
             -     APPROVED: Provider has been approved but isn't yet published to the marketplace.
             -     DENIED: Provider's application to join the marketplace was denied.
             -     PUBLISHED: Provider is live in the marketplace and eligible to receive new leads.
             -     SUSPENDED: Provider is temporarily removed from the marketplace and isn't receiving new leads. See `suspensionLiftDate` for when the suspension is lifted.
             -     REMOVED: Provider has been removed from the marketplace.
             -     BANNED: Provider has been permanently banned from the marketplace.
             -     PENDING_REAPPLICATION: Provider was removed and must reapply to rejoin the marketplace.
        - name: description | type: Description | description: Additional detail about the status, such as a warning that the provider is at risk of suspension or removal.  | read-only: true 
             - enum:
             -     NONE: No additional detail about the status.
             -     EXPIRED_BRIEFS_SUSPENSION_WARNING: Provider is at risk of suspension for repeatedly letting leads expire without responding.
             -     EXPIRED_BRIEFS_REMOVAL_WARNING: Provider is at risk of removal for repeatedly letting leads expire without responding.
             -     EXPIRED_BRIEFS_SUSPENSION: Provider was suspended for repeatedly letting leads expire without responding.
             -     EXPIRED_BRIEFS_REMOVAL: Provider was removed for repeatedly letting leads expire without responding.
             -     NO_COMPLETED_PROJECTS_REMOVAL: Provider was removed for not completing any projects.
             -     NO_COMPLETED_PROJECTS_REMOVAL_WARNING: Provider is at risk of removal for not completing any projects.
             -     PROLONGED_UNAVAILABILITY_SUSPENSION: Provider was suspended for being unavailable to receive leads for a prolonged period.
             -     PROLONGED_UNAVAILABILITY_SUSPENSION_WARNING: Provider is at risk of suspension for being unavailable to receive leads for a prolonged period.
             -     PROLONGED_UNAVAILABILITY_REMOVAL: Provider was removed for being unavailable to receive leads for a prolonged period.
             -     PROLONGED_UNAVAILABILITY_REMOVAL_WARNING: Provider is at risk of removal for being unavailable to receive leads for a prolonged period.
             -     LEFT_STUDIO: Provider was removed because they left Wix Studio.
        - name: suspensionLiftDate | type: string | description: Date and time a suspension is lifted and the provider can return to the marketplace. Available only when `statusType` is `SUSPENDED`.  | validation: format date-time
        - name: updateDate | type: string | description: Date and time the status was last updated.  | validation: format date-time
     - name: availability | type: Availability | description: Provider's availability to receive new leads.  
        - name: enabled | type: boolean | description: Whether the provider is currently accepting new leads.  
        - name: reason | type: OffReason | description: Reason the provider isn't accepting new leads.  | read-only: true 
             - enum:
             -     NONE: Provider is accepting new leads.
             -     USER: Provider paused new leads themselves.
             -     ADMIN: Wix paused new leads for the provider.
             -     EXPIRED_BRIEFS: New leads were paused because the provider repeatedly let leads expire without responding.
             -     FAKE_REVIEWS: New leads were paused because of fake reviews associated with the provider.
        - name: updatedDate | type: string | description: Date and time availability was last updated.  | read-only: true | validation: format date-time
     - name: revision | type: string | description: Revision number, which increments by 1 each time the provider state is updated. To prevent conflicting changes, the current revision must be passed when updating the provider state.  | validation: format uint64


```

### Examples

### Get Provider State
Retrieves the provider state for the current account

```curl
curl -X GET \
'https://www.wixapis.com/partners/marketplace/v1/provider-states' \
-H 'Authorization: <AUTH>'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.marketplaceProviderState.marketplaceProviderState.getProviderState()
 Description: Retrieves the provider state for the current account. Each provider account has exactly one provider state, created during marketplace registration, so no GUID is required - the state is resolved from the calling account's identity. `id` on the returned state equals the provider's account GUID.
 Return type: PROMISE<GetProviderStateResponse>
  - name: providerState | type: ProviderState | description: Retrieved provider state.  
     - name: _id | type: string | description: Provider state GUID. Equal to the provider's account GUID.  | read-only: true | validation: format GUID
     - name: _createdDate | type: Date | description: Date and time the provider state was created.  | read-only: true 
     - name: _updatedDate | type: Date | description: Date and time the provider state was last updated.  | read-only: true 
     - name: publishedDate | type: Date | description: Date and time the provider was first published to the marketplace.  | read-only: true 
     - name: status | type: Status | description: Provider's current standing in the marketplace.  
        - name: statusType | type: Type | description: Provider's current status in the marketplace.  
             - enum:
             -     PENDING: Provider has registered for the marketplace and is awaiting review.
             -     APPROVED: Provider has been approved but isn't yet published to the marketplace.
             -     DENIED: Provider's application to join the marketplace was denied.
             -     PUBLISHED: Provider is live in the marketplace and eligible to receive new leads.
             -     SUSPENDED: Provider is temporarily removed from the marketplace and isn't receiving new leads. See `suspensionLiftDate` for when the suspension is lifted.
             -     REMOVED: Provider has been removed from the marketplace.
             -     BANNED: Provider has been permanently banned from the marketplace.
             -     PENDING_REAPPLICATION: Provider was removed and must reapply to rejoin the marketplace.
        - name: description | type: Description | description: Additional detail about the status, such as a warning that the provider is at risk of suspension or removal.  | read-only: true 
             - enum:
             -     NONE: No additional detail about the status.
             -     EXPIRED_BRIEFS_SUSPENSION_WARNING: Provider is at risk of suspension for repeatedly letting leads expire without responding.
             -     EXPIRED_BRIEFS_REMOVAL_WARNING: Provider is at risk of removal for repeatedly letting leads expire without responding.
             -     EXPIRED_BRIEFS_SUSPENSION: Provider was suspended for repeatedly letting leads expire without responding.
             -     EXPIRED_BRIEFS_REMOVAL: Provider was removed for repeatedly letting leads expire without responding.
             -     NO_COMPLETED_PROJECTS_REMOVAL: Provider was removed for not completing any projects.
             -     NO_COMPLETED_PROJECTS_REMOVAL_WARNING: Provider is at risk of removal for not completing any projects.
             -     PROLONGED_UNAVAILABILITY_SUSPENSION: Provider was suspended for being unavailable to receive leads for a prolonged period.
             -     PROLONGED_UNAVAILABILITY_SUSPENSION_WARNING: Provider is at risk of suspension for being unavailable to receive leads for a prolonged period.
             -     PROLONGED_UNAVAILABILITY_REMOVAL: Provider was removed for being unavailable to receive leads for a prolonged period.
             -     PROLONGED_UNAVAILABILITY_REMOVAL_WARNING: Provider is at risk of removal for being unavailable to receive leads for a prolonged period.
             -     LEFT_STUDIO: Provider was removed because they left Wix Studio.
        - name: suspensionLiftDate | type: Date | description: Date and time a suspension is lifted and the provider can return to the marketplace. Available only when `statusType` is `SUSPENDED`.  
        - name: updateDate | type: Date | description: Date and time the status was last updated.  
     - name: availability | type: Availability | description: Provider's availability to receive new leads.  
        - name: enabled | type: boolean | description: Whether the provider is currently accepting new leads.  
        - name: reason | type: OffReason | description: Reason the provider isn't accepting new leads.  | read-only: true 
             - enum:
             -     NONE: Provider is accepting new leads.
             -     USER: Provider paused new leads themselves.
             -     ADMIN: Wix paused new leads for the provider.
             -     EXPIRED_BRIEFS: New leads were paused because the provider repeatedly let leads expire without responding.
             -     FAKE_REVIEWS: New leads were paused because of fake reviews associated with the provider.
        - name: _updatedDate | type: Date | description: Date and time availability was last updated.  | read-only: true 
     - name: revision | type: string | description: Revision number, which increments by 1 each time the provider state is updated. To prevent conflicting changes, the current revision must be passed when updating the provider state.  | validation: format uint64


```

### Examples

### Get Provider State
```javascript
import { marketplaceProviderState } from "@wix/marketplace-provider-state";

async function getProviderState() {
  const response = await marketplaceProviderState.getProviderState();

  return response;
}

/* Promise resolves to:
 * {
 *   "providerState": {
 *     "id": "2f7c9a1b-8d3e-4a5f-9c6b-1e0d2f3a4b5c",
 *     "createdDate": "2024-01-15T10:30:00.000Z",
 *     "updatedDate": "2024-06-02T09:12:45.000Z",
 *     "publishedDate": "2024-01-20T08:00:00.000Z",
 *     "status": {
 *       "statusType": "PUBLISHED",
 *       "description": "NONE",
 *       "updateDate": "2024-01-20T08:00:00.000Z"
 *     },
 *     "availability": {
 *       "enabled": true,
 *       "reason": "NONE",
 *       "updatedDate": "2024-06-02T09:12:45.000Z"
 *     },
 *     "revision": "10"
 *   }
 * }
 */

```

### getProviderState (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 { marketplaceProviderState } from '@wix/marketplace-provider-state';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


async function getProviderState() {
  const response = await myWixClient.marketplaceProviderState.getProviderState();
};
```

---