> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.6mm.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.6mm.com/_mcp/server.

# Direct Entry URL

This guide targets **Agent Java SDK `v0.3.0`**, Java 8+, and the tagged public contract. Examples run in a partner backend after initializing `client` in [Quick Start](/sdk/agent-sdk/java/quick-start).

## Example prerequisites

The Java snippets share these imports. Initialize `client` using Quick Start and obtain `platformUserId` from the saved binding. Example user/order IDs must be replaced with your own persisted values.

```java
import com.sixmm.agent.*;
import com.sixmm.agent.model.*;
import java.util.*;
```

## Direct Entry URL

Direct entry URL is for redirect mode. A partner user clicks a button on the
partner site, opens 6MM frontend, and is automatically logged in.

```java
import com.sixmm.agent.model.CreateEntryUrlRequest;
import com.sixmm.agent.model.CreateEntryUrlResponse;

CreateEntryUrlResponse resp = client.createEntryUrl(
        CreateEntryUrlRequest.of("agent-user-001")
                .withRedirectPath("/en/futures/BTCUSDT?tradingMode=real")
                .withReturnUrl("https://partner.example.com/return#markets"));

System.out.println(resp.webUrl);
System.out.println(resp.expireAt);
```

Field rules:

| Field          | Description                                                                                            |
| -------------- | ------------------------------------------------------------------------------------------------------ |
| `redirectPath` | 6MM frontend relative path. It must start with `/`, for example `/en/futures/BTCUSDT?tradingMode=real` |
| `returnUrl`    | Partner absolute URL used when the user exits 6MM frontend. Only `http` and `https` are allowed        |
| `expireAt`     | Entry ticket expiration time as a Unix timestamp in seconds                                            |

The example opens perpetual futures in real mode. For simulated trading, use `tradingMode=demo` in the frontend and explicitly pass `environment=SIMULATED` in the corresponding backend wallet requests. Frontend `tradingMode` and backend funds `environment` are configured separately. Creating an entry URL authenticates the user; it does not transfer funds or select a wallet environment.

Security requirements:

* `webUrl` contains a one-time ticket. Use it immediately and do not store it long term.
* If the entry URL expires or has been used, generate a new one from the partner site.
* `returnUrl` must not be `javascript:`, a relative path, or a URL with userinfo.

## Product and mode selection

Use the current frontend route supplied by 6MM. For example `/zh-CN/up-down?tradingMode=demo`, `/zh-CN/high-low?tradingMode=real`, `/zh-CN/grid-prediction?tradingMode=real`, or `/zh-CN/futures/BTCUSDT?tradingMode=real`. The ticket authenticates the user; it does not select a funding environment or move funds.

See [Seconds trading](/sdk/agent-sdk/java/seconds-trading) for redirect and embedded examples.

## Source and related guides

* [Official v0.3.0 source](https://github.com/6mm-com/agent-java-sdk/tree/54aa3c1)
* [Query overview and pagination](/sdk/agent-sdk/java/perpetual-queries)
* [Funding wallet](/sdk/agent-sdk/java/funding-wallet)
* [Upgrade guide](/sdk/agent-sdk/java/upgrade)