API Reference

Complete reference documentation for our internal RentManager API. This API provides comprehensive rental property management capabilities for our iOS application development.

Our internal API uses RESTful conventions and returns JSON responses. All requests require authentication via JWT tokens obtained through our Apple Sign-In implementation.

Base URL

All our API requests should be made to:

https://rentmanager.io/api

This is our production API endpoint.

Authentication

Our RentManager API uses JWT (JSON Web Tokens) for authentication. Tokens are obtained through our Apple Sign-In implementation and must be included in the Authorization header of all authenticated requests.

Authorization: Bearer your_jwt_token_here

JWT tokens expire after 24 hours. Use the refresh token to obtain a new access token when needed.

Error Handling

Our API uses standard HTTP status codes to indicate success or failure. Error responses include a JSON object with details about the error.

HTTP Status Codes

Status Code Description
200 OK - Request successful
201 Created - Resource created successfully
400 Bad Request - Invalid request parameters
401 Unauthorized - Authentication required
403 Forbidden - Insufficient permissions
404 Not Found - Resource not found
500 Internal Server Error - Server error

Error Response Format

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid request parameters",
    "details": {
      "field": "email",
      "issue": "Email format is invalid"
    }
  }
}

Authentication Endpoints

POST /auth/apple

Authenticate with Apple Sign-In and receive JWT tokens.

Request Body

{
  "identityToken": "apple_identity_token_from_ios",
  "user": {
    "name": {
      "firstName": "John",
      "lastName": "Doe"
    }
  }
}

Parameters

Parameter Type Required Description
identityToken string Yes Apple identity token from iOS AuthenticationServices
user.name.firstName string No User's first name (only available on first sign-in)
user.name.lastName string No User's last name (only available on first sign-in)

Response

{
  "success": true,
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "isNewUser": false,
  "user": {
    "id": 123,
    "email": "user@privaterelay.appleid.com",
    "full_name": "John Doe",
    "role": "user",
    "access_level": "support"
  }
}
POST /auth/refresh

Refresh an expired access token using a refresh token.

Request Body

{
  "refreshToken": "your_refresh_token_here"
}

Response

{
  "token": "new_access_token_here"
}
GET /auth/logout

Logout and invalidate the current session.

Headers

Authorization: Bearer your_jwt_token

Response

{
  "message": "Logout successful"
}

Properties

GET /properties

Get all properties for the authenticated user.

Query Parameters

Parameter Type Description
page integer Page number for pagination (default: 1)
limit integer Number of properties per page (default: 20, max: 100)
type string Filter by property type (apartment, house, office, etc.)
country string Filter by country code (US, GB, etc.)
available boolean Filter by availability status

Response

{
  "properties": [
    {
      "id": 1,
      "type": "apartment",
      "country": "US",
      "address": "123 Main St, New York, NY 10001",
      "bedrooms": 2,
      "bathrooms": 1,
      "area": 850.5,
      "area_unit": "ft2",
      "rent_price": 2500.00,
      "rent_currency": "USD",
      "is_available": true,
      "created_at": "2024-01-15T10:30:00Z",
      "updated_at": "2024-01-20T14:45:00Z"
    }
  ],
  "pagination": {
    "current_page": 1,
    "total_pages": 5,
    "total_items": 87,
    "items_per_page": 20
  }
}
POST /properties

Create a new property.

Request Body

{
  "type": "apartment",
  "country": "US",
  "address": "456 Oak Ave, Los Angeles, CA 90210",
  "bedrooms": 3,
  "bathrooms": 2,
  "area": 1200.0,
  "area_unit": "ft2",
  "rent_price": 3500.00,
  "rent_currency": "USD",
  "rent_frequency": "monthly",
  "is_available": true,
  "furnished": "partial"
}

Required Fields

Field Type Description
country string 2-letter country code (ISO 3166-1 alpha-2)
address string Full property address

Response

{
  "id": 123,
  "message": "Property created successfully",
  "property": {
    "id": 123,
    "type": "apartment",
    "country": "US",
    "address": "456 Oak Ave, Los Angeles, CA 90210",
    "bedrooms": 3,
    "bathrooms": 2,
    "area": 1200.0,
    "area_unit": "ft2",
    "rent_price": 3500.00,
    "rent_currency": "USD",
    "is_available": true,
    "created_at": "2024-01-21T09:15:00Z"
  }
}

More endpoints documentation coming soon...

Contact us for complete API documentation