> ## Documentation Index
> Fetch the complete documentation index at: https://docs.productflo.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Sign Up

> Create new user accounts

# Sign Up API

The signup endpoints allow new users to create accounts on the ProductFlo platform. Multiple registration methods are supported, including email, phone number, and OAuth providers.

## Email Signup

> [card] POST /auth/signup
>
> Create a new user account with email and password

Creates a new user account with email and password authentication.

### Request

> [tab] cURL
>
> ```bash theme={null}
> curl -X POST https://api.productflo.io/auth/signup \
>   -H "Content-Type: application/json" \
>   -d '{
>     "first_name": "John",
>     "last_name": "Doe",
>     "username": "johndoe",
>     "email": "john.doe@example.com",
>     "password": "secure-password",
>     "confirm_password": "secure-password"
>   }'
> ```

> [tab] JavaScript
>
> ```javascript theme={null}
> const response = await fetch('https://api.productflo.io/auth/signup', {
>   method: 'POST',
>   headers: {
>     'Content-Type': 'application/json',
>   },
>   body: JSON.stringify({
>     first_name: 'John',
>     last_name: 'Doe',
>     username: 'johndoe',
>     email: 'john.doe@example.com',
>     password: 'secure-password',
>     confirm_password: 'secure-password'
>   }),
>   credentials: 'include'
> });
>
> const data = await response.json();
> ```

> [tab] Python
>
> ```python theme={null}
> import requests
>
> response = requests.post(
>     'https://api.productflo.io/auth/signup',
>     json={
>         'first_name': 'John',
>         'last_name': 'Doe',
>         'username': 'johndoe',
>         'email': 'john.doe@example.com',
>         'password': 'secure-password',
>         'confirm_password': 'secure-password'
>     }
> )
>
> data = response.json()
> ```

### Request Body

**first\_name** `string`

The user's first name

**last\_name** `string`

The user's last name

**full\_name** `string`

The user's full name (alternative to providing first\_name and last\_name separately)

**username** `string` *required*

The user's username

**email** `string` *required*

The user's email address

**password** `string` *required*

The user's password

**confirm\_password** `string` *required*

Confirmation of the password (must match password)

### Response

**user** `object`

User information

**User properties**

**id** `string`

The user's unique identifier

**aud** `string`

The audience the token is intended for

**role** `string`

The user's role (usually "authenticated")

**email** `string`

The user's email address

**email\_confirmed\_at** `string`

Timestamp when the email was confirmed (or null if not confirmed)

**user\_metadata** `object`

User-specific metadata including profile information

**User metadata properties**

**first\_name** `string`

User's first name

**last\_name** `string`

User's last name

**session** `object`

Session information if auto-login is enabled

```json theme={null}
{
  "first_name": "John",
  "last_name": "Doe",
  "username": "johndoe",
  "email": "john.doe@example.com",
  "password": "secure-password",
  "confirm_password": "secure-password"
}
```

```json theme={null}
{
  "user": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "aud": "authenticated",
    "role": "authenticated",
    "email": "john.doe@example.com",
    "email_confirmed_at": null,
    "phone": "",
    "confirmed_at": null,
    "last_sign_in_at": "2023-05-01T12:34:56.789Z",
    "app_metadata": {
      "provider": "email",
      "providers": ["email"]
    },
    "user_metadata": {
      "first_name": "John",
      "last_name": "Doe"
    },
    "identities": [],
    "created_at": "2023-05-01T12:34:56.789Z",
    "updated_at": "2023-05-01T12:34:56.789Z"
  }
}
```

## Phone Signup

> [card] POST /auth/phone-signup
>
> Create a new user account with phone number and password

Creates a new user account with phone number and password authentication.

### Request

> [tab] cURL
>
> ```bash theme={null}
> curl -X POST https://api.productflo.io/auth/phone-signup \
>   -H "Content-Type: application/json" \
>   -d '{
>     "username": "johndoe",
>     "phone_number": "+12345678901",
>     "password": "secure-password",
>     "confirm_password": "secure-password"
>   }'
> ```

> [tab] JavaScript
>
> ```javascript theme={null}
> const response = await fetch('https://api.productflo.io/auth/phone-signup', {
>   method: 'POST',
>   headers: {
>     'Content-Type': 'application/json',
>   },
>   body: JSON.stringify({
>     username: 'johndoe',
>     phone_number: '+12345678901',
>     password: 'secure-password',
>     confirm_password: 'secure-password'
>   }),
>   credentials: 'include'
> });
>
> const data = await response.json();
> ```

### Request Body

**username** `string` *required*

The user's username

**phone\_number** `string` *required*

The user's phone number in international format (e.g., +12345678901)

**password** `string` *required*

The user's password

**confirm\_password** `string` *required*

Confirmation of the password (must match password)

### Response

Similar to email signup response, with phone number instead of email.

## OAuth Provider Signup

> [card] POST /auth/provider
>
> Create or login with an OAuth provider

Initiates the OAuth flow with an external provider like Google, GitHub, etc.

### Request

> [tab] cURL
>
> ```bash theme={null}
> curl -X POST https://api.productflo.io/auth/provider \
>   -H "Content-Type: application/json" \
>   -d '{
>     "provider": "google"
>   }'
> ```

> [tab] JavaScript
>
> ```javascript theme={null}
> const response = await fetch('https://api.productflo.io/auth/provider', {
>   method: 'POST',
>   headers: {
>     'Content-Type': 'application/json',
>   },
>   body: JSON.stringify({
>     provider: 'google'
>   })
> });
>
> const data = await response.json();
> // Redirect user to the provider URL
> window.location.href = data.url;
> ```

### Request Body

**provider** `string` *required*

The OAuth provider to use (e.g., google, github, apple)

### Response

**url** `string`

URL to redirect the user to for OAuth authentication

```json theme={null}
{
  "provider": "google"
}
```

```json theme={null}
{
  "url": "https://accounts.google.com/o/oauth2/v2/auth?client_id=..."
}
```

## OAuth Callback

> [card] GET /auth/callback
>
> Handle OAuth provider callback

This endpoint is called by the OAuth provider after the user authenticates. It completes the OAuth flow and creates or logs in the user.

### Request

This endpoint is not typically called directly. The OAuth provider redirects to this URL with an authorization code.

```
GET /auth/callback?code=AUTHORIZATION_CODE&state=STATE
```

### Response

After successful authentication, the user is redirected to the application with an authenticated session.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.