Register User
curl --request POST \
--url https://api.example.com/auth/register.php \
--header 'Accept: <accept>' \
--header 'Content-Type: <content-type>' \
--data '
{
"name": "<string>",
"lastName": "<string>",
"email": "<string>",
"phone": "<string>",
"password": "<string>",
"address": "<string>",
"latitude": 123,
"longitude": 123,
"lat": 123,
"lng": 123,
"city": "<string>",
"state": "<string>",
"country": "<string>"
}
'import requests
url = "https://api.example.com/auth/register.php"
payload = {
"name": "<string>",
"lastName": "<string>",
"email": "<string>",
"phone": "<string>",
"password": "<string>",
"address": "<string>",
"latitude": 123,
"longitude": 123,
"lat": 123,
"lng": 123,
"city": "<string>",
"state": "<string>",
"country": "<string>"
}
headers = {
"Content-Type": "<content-type>",
"Accept": "<accept>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Accept: '<accept>'},
body: JSON.stringify({
name: '<string>',
lastName: '<string>',
email: '<string>',
phone: '<string>',
password: '<string>',
address: '<string>',
latitude: 123,
longitude: 123,
lat: 123,
lng: 123,
city: '<string>',
state: '<string>',
country: '<string>'
})
};
fetch('https://api.example.com/auth/register.php', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/auth/register.php",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'lastName' => '<string>',
'email' => '<string>',
'phone' => '<string>',
'password' => '<string>',
'address' => '<string>',
'latitude' => 123,
'longitude' => 123,
'lat' => 123,
'lng' => 123,
'city' => '<string>',
'state' => '<string>',
'country' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Accept: <accept>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/auth/register.php"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"password\": \"<string>\",\n \"address\": \"<string>\",\n \"latitude\": 123,\n \"longitude\": 123,\n \"lat\": 123,\n \"lng\": 123,\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"country\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Accept", "<accept>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/auth/register.php")
.header("Content-Type", "<content-type>")
.header("Accept", "<accept>")
.body("{\n \"name\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"password\": \"<string>\",\n \"address\": \"<string>\",\n \"latitude\": 123,\n \"longitude\": 123,\n \"lat\": 123,\n \"lng\": 123,\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"country\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/auth/register.php")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Accept"] = '<accept>'
request.body = "{\n \"name\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"password\": \"<string>\",\n \"address\": \"<string>\",\n \"latitude\": 123,\n \"longitude\": 123,\n \"lat\": 123,\n \"lng\": 123,\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"country\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"400": {},
"500": {},
"success": true,
"message": "<string>",
"user": {
"id": 123,
"uuid": "<string>",
"nombre": "<string>",
"apellido": "<string>",
"email": "<string>",
"telefono": "<string>",
"tipo_usuario": "<string>",
"creado_en": "<string>",
"actualizado_en": "<string>",
"location": {
"id": 123,
"usuario_id": 123,
"direccion": "<string>",
"latitud": 123,
"longitud": 123,
"ciudad": "<string>",
"departamento": "<string>",
"pais": "<string>",
"es_principal": true
}
}
}User Endpoints
Register User
Create a new user account
POST
/
auth
/
register.php
Register User
curl --request POST \
--url https://api.example.com/auth/register.php \
--header 'Accept: <accept>' \
--header 'Content-Type: <content-type>' \
--data '
{
"name": "<string>",
"lastName": "<string>",
"email": "<string>",
"phone": "<string>",
"password": "<string>",
"address": "<string>",
"latitude": 123,
"longitude": 123,
"lat": 123,
"lng": 123,
"city": "<string>",
"state": "<string>",
"country": "<string>"
}
'import requests
url = "https://api.example.com/auth/register.php"
payload = {
"name": "<string>",
"lastName": "<string>",
"email": "<string>",
"phone": "<string>",
"password": "<string>",
"address": "<string>",
"latitude": 123,
"longitude": 123,
"lat": 123,
"lng": 123,
"city": "<string>",
"state": "<string>",
"country": "<string>"
}
headers = {
"Content-Type": "<content-type>",
"Accept": "<accept>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Accept: '<accept>'},
body: JSON.stringify({
name: '<string>',
lastName: '<string>',
email: '<string>',
phone: '<string>',
password: '<string>',
address: '<string>',
latitude: 123,
longitude: 123,
lat: 123,
lng: 123,
city: '<string>',
state: '<string>',
country: '<string>'
})
};
fetch('https://api.example.com/auth/register.php', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/auth/register.php",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'lastName' => '<string>',
'email' => '<string>',
'phone' => '<string>',
'password' => '<string>',
'address' => '<string>',
'latitude' => 123,
'longitude' => 123,
'lat' => 123,
'lng' => 123,
'city' => '<string>',
'state' => '<string>',
'country' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Accept: <accept>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/auth/register.php"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"password\": \"<string>\",\n \"address\": \"<string>\",\n \"latitude\": 123,\n \"longitude\": 123,\n \"lat\": 123,\n \"lng\": 123,\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"country\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Accept", "<accept>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/auth/register.php")
.header("Content-Type", "<content-type>")
.header("Accept", "<accept>")
.body("{\n \"name\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"password\": \"<string>\",\n \"address\": \"<string>\",\n \"latitude\": 123,\n \"longitude\": 123,\n \"lat\": 123,\n \"lng\": 123,\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"country\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/auth/register.php")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Accept"] = '<accept>'
request.body = "{\n \"name\": \"<string>\",\n \"lastName\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"password\": \"<string>\",\n \"address\": \"<string>\",\n \"latitude\": 123,\n \"longitude\": 123,\n \"lat\": 123,\n \"lng\": 123,\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"country\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"400": {},
"500": {},
"success": true,
"message": "<string>",
"user": {
"id": 123,
"uuid": "<string>",
"nombre": "<string>",
"apellido": "<string>",
"email": "<string>",
"telefono": "<string>",
"tipo_usuario": "<string>",
"creado_en": "<string>",
"actualizado_en": "<string>",
"location": {
"id": 123,
"usuario_id": 123,
"direccion": "<string>",
"latitud": 123,
"longitud": 123,
"ciudad": "<string>",
"departamento": "<string>",
"pais": "<string>",
"es_principal": true
}
}
}Endpoint
POST /auth/register.php
Headers
string
required
Must be
application/jsonstring
required
Must be
application/jsonRequest Body
string
required
User’s first name
string
required
User’s last name
string
required
Valid email address. Must be unique in the system.
string
required
Phone number with country code (e.g., +573001234567)
string
required
User password. Should be at least 8 characters.
string
Street address
number
Location latitude in decimal degrees
number
Location longitude in decimal degrees
number
Alternative field for latitude (backend accepts both)
number
Alternative field for longitude (backend accepts both)
string
City name
string
Department/state name
string
default:"Colombia"
Country name
Response
boolean
required
Indicates if registration was successful
string
Success or error message
object
Created user object
Show user object
Show user object
integer
Unique user identifier
string
Universally unique identifier
string
User’s first name
string
User’s last name
string
User’s email address
string
User’s phone number
string
User type:
pasajero, conductor, admin, or empresastring
Account creation timestamp (ISO 8601)
string
Last update timestamp (ISO 8601)
Request Example
curl -X POST https://76.13.114.194/auth/register.php \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"name": "Carlos",
"lastName": "Rodríguez",
"email": "carlos.rodriguez@example.com",
"phone": "+573001234567",
"password": "SecurePass123!",
"address": "Carrera 15 #85-30",
"latitude": 4.6814,
"longitude": -74.0479,
"city": "Bogotá",
"state": "Cundinamarca",
"country": "Colombia"
}'
import 'package:http/http.dart' as http;
import 'dart:convert';
final response = await http.post(
Uri.parse('https://76.13.114.194/auth/register.php'),
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
},
body: jsonEncode({
'name': 'Carlos',
'lastName': 'Rodríguez',
'email': 'carlos.rodriguez@example.com',
'phone': '+573001234567',
'password': 'SecurePass123!',
'address': 'Carrera 15 #85-30',
'latitude': 4.6814,
'longitude': -74.0479,
'city': 'Bogotá',
'state': 'Cundinamarca',
'country': 'Colombia',
}),
);
fetch('https://76.13.114.194/auth/register.php', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
},
body: JSON.stringify({
name: 'Carlos',
lastName: 'Rodríguez',
email: 'carlos.rodriguez@example.com',
phone: '+573001234567',
password: 'SecurePass123!',
address: 'Carrera 15 #85-30',
latitude: 4.6814,
longitude: -74.0479,
city: 'Bogotá',
state: 'Cundinamarca',
country: 'Colombia',
}),
})
.then(response => response.json())
.then(data => console.log(data));
Response Example
{
"success": true,
"message": "Usuario registrado exitosamente",
"user": {
"id": 456,
"uuid": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"nombre": "Carlos",
"apellido": "Rodríguez",
"email": "carlos.rodriguez@example.com",
"telefono": "+573001234567",
"tipo_usuario": "pasajero",
"creado_en": "2024-03-15T14:30:00.000Z",
"actualizado_en": null,
"calificacion": null,
"location": {
"id": 89,
"usuario_id": 456,
"direccion": "Carrera 15 #85-30",
"latitud": 4.6814,
"longitud": -74.0479,
"ciudad": "Bogotá",
"departamento": "Cundinamarca",
"pais": "Colombia",
"es_principal": true,
"creado_en": "2024-03-15T14:30:00.000Z"
}
}
}
{
"success": false,
"message": "Email ya está registrado"
}
{
"success": false,
"message": "Campo 'email' es requerido"
}
{
"success": false,
"message": "Formato de email inválido"
}
Error Responses
Bad Request
Invalid input data or email already registered
Internal Server Error
Server error during registration process
Notes
After successful registration, the user can immediately login using the
/auth/login.php endpoint.Passwords are hashed on the server. Never store plain-text passwords on the client.
See Also
- Login - Authenticate an existing user
- User Profile - Get user profile information
- Email Verification - Verify user email address
⌘I