# Profile

# Get Profile

GET
/me

# Example Request

curl --location --request GET 'https://yourwebsite.com/api/me' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {api_key}' \
--header 'Authorization: Bearer {api_key}'

# Example Response

{
    "data": {
        "id": 123,
        "first_name": "John",
        "last_name": "Doe",
        "username": "johndoe",
        "email": "[email protected]",
        "phone": "+381641234567",
        "avatar": "http://yourwebsite.com/users/john-doe-avatar.jpg",
        "address": "Some random street, 123, Serbia",
        "country_id": 688,
        "role_id": 1,
        "status": "Active",
        "birthday": "1989-01-03",
        "last_login": "2017-04-27 16:47:59",
        "two_factor_country_code": 381,
        "two_factor_phone": "6412345678",
        "two_factor_options": {
          "option1": 4,
          "option2": "option value"
        },
        "created_at": "2017-04-20 16:47:59",
        "updated_at": "2017-04-27 10:47:59"
    }
}

# Available includes

If provided, the available includes will be part of the response for each ticket object.

role

User's role details.

country

User's country details

# Update Details

PATCH
/me/details

You can provide even just a single attribute that you want to update.

# Parameters

Parameter Type Required Description
first_name String No User's first name.
last_name String No User's last name.
birthday Date No User's birth date.
phone String No User's phone number.
address String No User's full address.
country_id Number No The ID of the users country. Check countries endpoint for more info.

# Example Request

curl --location --request PATCH 'https://yourwebsite.com/api/me/details' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {api_key}' \
--header 'Authorization: Bearer {api_key}' \
--data-raw '{
  "first_name": "Milos",
  "last_name": "Stojanovic",
  "birthday": "1990-10-18",
  "phone": "+381641234567",
  "address": "Some street 123, Nis, Serbia",
  "country_id": 688
}'

# Example Response

{
    "data": {
        "id": 123,
        "first_name": "John",
        "last_name": "Doe",
        "username": "johndoe",
        "email": "[email protected]",
        "phone": "+381641234567",
        "avatar": "http://yourwebsite.com/users/john-doe-avatar.jpg",
        "address": "Some random street, 123, Serbia",
        "country_id": 688,
        "role_id": 1,
        "status": "Active",
        "birthday": "1989-01-03",
        "last_login": "2017-04-27 16:47:59",
        "two_factor_country_code": 381,
        "two_factor_phone": "6412345678",
        "two_factor_options": {
          "option1": 4,
          "option2": "option value"
        },
        "created_at": "2017-04-20 16:47:59",
        "updated_at": "2017-04-27 10:47:59"
    }
}

# Update Auth Credentials

PATCH
/me/details/auth

You can provide even just a single attribute that you want to update.

# Parameters

Parameter Type Required Description
username String No Unique user's username.
email String No Unique user's email.
password String No Users password.
password_confirmation String No Password confirmation.

# Example Request

curl --location --request PATCH 'https://yourwebsite.com/api/me/details' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {api_key}' \
--header 'Authorization: Bearer {api_key}' \
--data-raw '{
  "email": "[email protected]",
  "username": "john.doe",
  "password": "123123",
  "password_confirmation": "123123"
}'

# Example Response

{
    "data": {
        "id": 123,
        "first_name": "John",
        "last_name": "Doe",
        "username": "johndoe",
        "email": "[email protected]",
        "phone": "+381641234567",
        "avatar": "http://yourwebsite.com/users/john-doe-avatar.jpg",
        "address": "Some random street, 123, Serbia",
        "country_id": 688,
        "role_id": 1,
        "status": "Active",
        "birthday": "1989-01-03",
        "last_login": "2017-04-27 16:47:59",
        "two_factor_country_code": 381,
        "two_factor_phone": "6412345678",
        "two_factor_options": {
          "option1": 4,
          "option2": "option value"
        },
        "created_at": "2017-04-20 16:47:59",
        "updated_at": "2017-04-27 10:47:59"
    }
}

# Upload Avatar

POST
/me/avatar

# Example Request

curl --location --request POST 'https://yourwebsite.com/api/me/avatar' \
--header 'Accept: application/json' \
--header 'Content-Type: multipart/form-data' \
--header 'Authorization: Bearer {api_key}' \
--header 'Authorization: Bearer {api_key}' \
--form 'file=image.jpg'

# Example Response

{
    "data": {
        "id": 123,
        "first_name": "John",
        "last_name": "Doe",
        "username": "johndoe",
        "email": "[email protected]",
        "phone": "+381641234567",
        "avatar": "http://yourwebsite.com/users/john-doe-avatar.jpg",
        "address": "Some random street, 123, Serbia",
        "country_id": 688,
        "role_id": 1,
        "status": "Active",
        "birthday": "1989-01-03",
        "last_login": "2017-04-27 16:47:59",
        "two_factor_country_code": 381,
        "two_factor_phone": "6412345678",
        "two_factor_options": {
          "option1": 4,
          "option2": "option value"
        },
        "created_at": "2017-04-20 16:47:59",
        "updated_at": "2017-04-27 10:47:59"
    }
}

# Update Avatar from External Source

PUT
/me/avatar/external
Parameter Type Required Description
url String Yes URL to an external avatar image.

# Example Request

curl --location --request PUT 'https://yourwebsite.com/api/me/avatar/external' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {api_key}' \
--header 'Authorization: Bearer {api_key}' \
--data-raw '{
  "url": "https://s.gravatar.com/avatar/20208b38fbb6018920da7d038fbc58dc?s=80"
}'

# Example Response

{
    "data": {
        "id": 123,
        "first_name": "John",
        "last_name": "Doe",
        "username": "johndoe",
        "email": "[email protected]",
        "phone": "+381641234567",
        "avatar": "http://yourwebsite.com/users/john-doe-avatar.jpg",
        "address": "Some random street, 123, Serbia",
        "country_id": 688,
        "role_id": 1,
        "status": "Active",
        "birthday": "1989-01-03",
        "last_login": "2017-04-27 16:47:59",
        "two_factor_country_code": 381,
        "two_factor_phone": "6412345678",
        "two_factor_options": {
          "option1": 4,
          "option2": "option value"
        },
        "created_at": "2017-04-20 16:47:59",
        "updated_at": "2017-04-27 10:47:59"
    }
}

# Enable 2FA

PUT
/me/2fa

Enables the Two-Factor authentication mechanism for user's account.

# Parameters

Parameter Type Required Description
country_code Number Yes ISO 3166-1 country code.
phone_number Number Yes Phone number without country code part.

# Example Request

curl --location --request PUT 'https://yourwebsite.com/api/me/2fa' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {api_key}' \
--header 'Authorization: Bearer {api_key}' \
--data-raw '{
  "country_code": 381,
  "phone_number": 6412345678
}'

# Example Response

{
    "data": {
        "id": 123,
        "first_name": "John",
        "last_name": "Doe",
        "username": "johndoe",
        "email": "[email protected]",
        "phone": "+381641234567",
        "avatar": "http://yourwebsite.com/users/john-doe-avatar.jpg",
        "address": "Some random street, 123, Serbia",
        "country_id": 688,
        "role_id": 1,
        "status": "Active",
        "birthday": "1989-01-03",
        "last_login": "2017-04-27 16:47:59",
        "two_factor_country_code": 381,
        "two_factor_phone": "6412345678",
        "two_factor_options": {
          "option1": 4,
          "option2": "option value"
        },
        "created_at": "2017-04-20 16:47:59",
        "updated_at": "2017-04-27 10:47:59"
    }
}

# Verify 2FA Phone Number

POST
/me/2fa/verify

# Parameters

Parameter Type Required Description
token String Yes Token received via SMS.

# Example Request

curl --location --request POST 'https://yourwebsite.com/api/me/2fa/verify' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {api_key}' \
--header 'Authorization: Bearer {api_key}' \
--data-raw '{
  "token": "213456789"
}'

# Example Response

{
    "data": {
        "id": 123,
        "first_name": "John",
        "last_name": "Doe",
        "username": "johndoe",
        "email": "[email protected]",
        "phone": "+381641234567",
        "avatar": "http://yourwebsite.com/users/john-doe-avatar.jpg",
        "address": "Some random street, 123, Serbia",
        "country_id": 688,
        "role_id": 1,
        "status": "Active",
        "birthday": "1989-01-03",
        "last_login": "2017-04-27 16:47:59",
        "two_factor_country_code": 381,
        "two_factor_phone": "6412345678",
        "two_factor_options": {
          "option1": 4,
          "option2": "option value"
        },
        "created_at": "2017-04-20 16:47:59",
        "updated_at": "2017-04-27 10:47:59"
    }
}

# Disable 2FA

DELETE
/me/2fa

# Example Request

curl --location --request DELETE 'https://yourwebsite.com/api/me/2fa' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {api_key}' \
--header 'Authorization: Bearer {api_key}'

# Example Response

{
    "data": {
        "id": 123,
        "first_name": "John",
        "last_name": "Doe",
        "username": "johndoe",
        "email": "[email protected]",
        "phone": "+381641234567",
        "avatar": "http://yourwebsite.com/users/john-doe-avatar.jpg",
        "address": "Some random street, 123, Serbia",
        "country_id": 688,
        "role_id": 1,
        "status": "Active",
        "birthday": "1989-01-03",
        "last_login": "2017-04-27 16:47:59",
        "two_factor_country_code": 381,
        "two_factor_phone": "6412345678",
        "two_factor_options": {
          "option1": 4,
          "option2": "option value"
        },
        "created_at": "2017-04-20 16:47:59",
        "updated_at": "2017-04-27 10:47:59"
    }
}

# Get Sessions

GET
/me/sessions

# Example Request

curl --location --request GET 'https://yourwebsite.com/api/me/sessions' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {api_key}' \
--header 'Authorization: Bearer {api_key}'

# Example Response

{
    "data": [
        {
            "id": "uFfF2KPoq7XZAOPLhen5ayOArawyzGitjoFIdogV",
            "user_id": 1,
            "ip_address": "123.45.67.890",
            "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36",
            "browser": "Chrome",
            "platform": "OS X",
            "device": "Macintosh",
            "last_activity": "2017-08-18 14:30:09"
        },
        // ...
    ]
}