# API authentication

Endpoints for API authentication (optional)

## Generate Login Message

> Generate a login message for a specific wallet address and chain.\
> \
> \- \*\*wallet\_address\*\*: The wallet address of the user\
> \- \*\*selected\_chain\*\*: The chain of the user

```json
{"openapi":"3.1.0","info":{"title":"Walver API","version":"1.1.42"},"tags":[{"name":"API authentication","description":"Endpoints for API authentication (optional)"}],"paths":{"/api/generate-login-message":{"get":{"tags":["API authentication"],"summary":"Generate Login Message","description":"Generate a login message for a specific wallet address and chain.\n\n- **wallet_address**: The wallet address of the user\n- **selected_chain**: The chain of the user","operationId":"generate_login_message_api_generate_login_message_get","parameters":[{"name":"wallet_address","in":"query","required":true,"schema":{"type":"string","title":"Wallet Address"}},{"name":"selected_chain","in":"query","required":true,"schema":{"type":"string","title":"Selected Chain"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiLoginMessageResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"ApiLoginMessageResponse":{"properties":{"message":{"type":"string","title":"Message"},"nonce":{"type":"string","title":"Nonce"},"expiration":{"type":"integer","title":"Expiration"}},"type":"object","required":["message","nonce","expiration"],"title":"ApiLoginMessageResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}
```

## Login

> Login with a specific wallet address and chain.\
> \
> \- \*\*wallet\_address\*\*: The wallet address of the user\
> \- \*\*selected\_chain\*\*: The chain of the user\
> \- \*\*nonce\*\*: The nonce of the message\
> \- \*\*message\*\*: The message to sign\
> \- \*\*signature\*\*: The signature of the message

```json
{"openapi":"3.1.0","info":{"title":"Walver API","version":"1.1.42"},"tags":[{"name":"API authentication","description":"Endpoints for API authentication (optional)"}],"paths":{"/api/login":{"post":{"tags":["API authentication"],"summary":"Login","description":"Login with a specific wallet address and chain.\n\n- **wallet_address**: The wallet address of the user\n- **selected_chain**: The chain of the user\n- **nonce**: The nonce of the message\n- **message**: The message to sign\n- **signature**: The signature of the message","operationId":"login_api_login_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiLoginRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiLoginResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"ApiLoginRequest":{"properties":{"wallet_address":{"type":"string","title":"Wallet Address"},"selected_chain":{"type":"string","title":"Selected Chain"},"nonce":{"type":"string","title":"Nonce"},"message":{"type":"string","title":"Message"},"signature":{"anyOf":[{"items":{"type":"integer"},"type":"array"},{"type":"string"}],"title":"Signature"}},"type":"object","required":["wallet_address","selected_chain","nonce","message","signature"],"title":"ApiLoginRequest"},"ApiLoginResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expires At"}},"type":"object","required":["success","message"],"title":"ApiLoginResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}
```

## Logout

> Logout from the API.\
> \
> \- \*\*session\_id\*\*: The session ID of the user

```json
{"openapi":"3.1.0","info":{"title":"Walver API","version":"1.1.42"},"tags":[{"name":"API authentication","description":"Endpoints for API authentication (optional)"}],"paths":{"/api/logout":{"post":{"tags":["API authentication"],"summary":"Logout","description":"Logout from the API.\n\n- **session_id**: The session ID of the user","operationId":"logout_api_logout_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiLogoutRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiLogoutResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"ApiLogoutRequest":{"properties":{"session_id":{"type":"string","title":"Session Id"}},"type":"object","required":["session_id"],"title":"ApiLogoutRequest"},"ApiLogoutResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"}},"type":"object","required":["success","message"],"title":"ApiLogoutResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}
```
