# User

Player profile APIs. Allow clients to retrieve and update player information stored in the Sverse managed backend.

## Get current user profile

> Retrieve profile information of the currently authenticated user.\
> \
> The user is identified by the \*\*sessionId\*\* provided via Bearer token.\
> No additional parameters are required.\
> \
> \### Authentication\
> \- \*\*Bearer Token\*\*: \`sessionId\` returned from Login API\
> \
> This API is intended for \*\*developers without their own backend\*\*.<br>

```json
{"openapi":"3.0.3","info":{"title":"Sverse Managed Backend (Client SDK)","version":"1.0.0"},"tags":[{"name":"User","description":"Player profile APIs.\nAllow clients to retrieve and update player information\nstored in the Sverse managed backend.\n"}],"servers":[{"url":"https://be.sverse.io","description":"Sverse Managed Backend (Production)"}],"security":[{"sessionAuth":[]}],"components":{"securitySchemes":{"sessionAuth":{"type":"http","scheme":"bearer","bearerFormat":"sessionId","description":"Use the `sessionId` returned from the Login API.\nExample:\nAuthorization: Bearer 9d7b6121-30d3-44cf-8b4f-c00e2f4f016e\n"}},"schemas":{"ErrorResponse":{"type":"object","required":["error","code","message"],"properties":{"error":{"type":"boolean"},"message":{"type":"string","description":"Human-readable error message (dynamic)"},"details":{"type":"object","description":"Optional additional error details","additionalProperties":true},"requestId":{"type":"string","description":"Unique request identifier for tracing"}}}}},"paths":{"/api/public/users/profile":{"get":{"tags":["User"],"summary":"Get current user profile","description":"Retrieve profile information of the currently authenticated user.\n\nThe user is identified by the **sessionId** provided via Bearer token.\nNo additional parameters are required.\n\n### Authentication\n- **Bearer Token**: `sessionId` returned from Login API\n\nThis API is intended for **developers without their own backend**.\n","operationId":"getUserProfile","responses":{"200":{"description":"Get user profile successfully","content":{"application/json":{"schema":{"type":"object","required":["error","data"],"properties":{"error":{"type":"boolean"},"data":{"type":"object","properties":{"id":{"type":"string","description":"User identifier"},"name":{"type":"string"},"email":{"type":"string","format":"email"},"metadata":{"type":"object","description":"Custom user metadata","additionalProperties":true},"serverId":{"type":"string","description":"Game server identifier"}}}}}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Invalid or expired session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## Update current user profile

> Update profile information of the currently authenticated user.\
> \
> The user is identified automatically via the \*\*sessionId\*\* provided\
> in the Bearer token. Developers do \*\*not\*\* need to pass user identity explicitly.\
> \
> \### Authentication\
> \- \*\*Bearer Token\*\*: \`sessionId\` returned from Login API\
> \- \*\*x-api-key\*\*: Game API key\
> \
> This API is intended for \*\*developers without their own backend\*\*,\
> using Sverse user management services.<br>

```json
{"openapi":"3.0.3","info":{"title":"Sverse Managed Backend (Client SDK)","version":"1.0.0"},"tags":[{"name":"User","description":"Player profile APIs.\nAllow clients to retrieve and update player information\nstored in the Sverse managed backend.\n"}],"servers":[{"url":"https://be.sverse.io","description":"Sverse Managed Backend (Production)"}],"security":[{"sessionAuth":[]}],"components":{"securitySchemes":{"sessionAuth":{"type":"http","scheme":"bearer","bearerFormat":"sessionId","description":"Use the `sessionId` returned from the Login API.\nExample:\nAuthorization: Bearer 9d7b6121-30d3-44cf-8b4f-c00e2f4f016e\n"}},"schemas":{"ErrorResponse":{"type":"object","required":["error","code","message"],"properties":{"error":{"type":"boolean"},"message":{"type":"string","description":"Human-readable error message (dynamic)"},"details":{"type":"object","description":"Optional additional error details","additionalProperties":true},"requestId":{"type":"string","description":"Unique request identifier for tracing"}}}}},"paths":{"/api/public/users/profile":{"put":{"tags":["User"],"summary":"Update current user profile","description":"Update profile information of the currently authenticated user.\n\nThe user is identified automatically via the **sessionId** provided\nin the Bearer token. Developers do **not** need to pass user identity explicitly.\n\n### Authentication\n- **Bearer Token**: `sessionId` returned from Login API\n- **x-api-key**: Game API key\n\nThis API is intended for **developers without their own backend**,\nusing Sverse user management services.\n","operationId":"updateUserProfile","parameters":[{"name":"x-api-key","in":"header","required":true,"description":"Game API key","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"username":{"type":"string","description":"New display name of the user"},"metadata":{"type":"object","description":"Custom user metadata","additionalProperties":true}}}}}},"responses":{"200":{"description":"User information updated successfully","content":{"application/json":{"schema":{"type":"object","required":["error","message","data"],"properties":{"error":{"type":"boolean"},"message":{"type":"string"},"data":{"type":"object","properties":{"id":{"type":"string"},"identity":{"type":"string"},"name":{"type":"string"},"email":{"type":"string","format":"email"},"metadata":{"type":"object","additionalProperties":true}}}}}}}},"400":{"description":"Invalid request or missing required fields","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Invalid or expired session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Game not found or API key invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```


---

# 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://sverse-1.gitbook.io/sverse-docs/api-reference/client/user.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.
