---
title: pydo.genai.get_oauth2_url()
description: Get Oauth2 URL
product: Reference
url: https://docs.digitalocean.com/reference/pydo/reference/genai/get_oauth2_url/
last_updated: "2026-11-06"
---

> **For AI agents:** The documentation index is at [https://docs.digitalocean.com/llms.txt](https://docs.digitalocean.com/llms.txt). Markdown versions of pages use the same URL with `index.html.md` in place of the HTML page (for example, append `index.html.md` to the directory path instead of opening the HTML document).

# pydo.genai.get_oauth2_url()

Generated on 6 Nov 2026 from `pydo` version [`v0.45.0`](https://github.com/digitalocean/pydo/releases/tag/v0.45.0)

## Usage

```python
client.genai.get_oauth2_url(type=None, redirect_url=None)
```

Returns `JSON` Raises `HttpResponseError`

## Description

To generate an Oauth2-URL for use with your localhost, send a GET request to [`/v2/gen-ai/oauth2/url`](https://docs.digitalocean.com/reference/api/reference/agent-platform-api/index.html.md#genai_get_oauth2_url). Pass ‘http://localhost:3000 as redirect_url

## Parameters

`type` string optional

Type "google" / "dropbox".

`redirect_url` string optional

The redirect url.

## Response Example

## Show Response Example

```json
{
  "url": "example string"
}
```

## More Information

See [`/v2/gen-ai/oauth2/url`](https://docs.digitalocean.com/reference/api/reference/agent-platform-api/index.html.md#genai_get_oauth2_url) in the API reference for additional detail on responses, headers, parameters, and more.