RentManager API

Internal API Documentation for Our iOS Development Team

API Overview

Our complete rental property management API with secure authentication, property management, tenant tracking, and financial operations for internal iOS development.

Secure Authentication

Apple Sign-In integration with JWT tokens for secure API access

Property Management

Complete CRUD operations for properties, rentals, and tenant management

Financial Tracking

Payment processing, balance management, and financial reporting

Authentication

Implementation guide for our Apple Sign-In integration and JWT-based authentication system

Apple Sign-In

iOS Implementation

import AuthenticationServices

// Present Apple Sign-In
let request = ASAuthorizationAppleIDProvider().createRequest()
request.requestedScopes = [.fullName, .email]

let controller = ASAuthorizationController(authorizationRequests: [request])
controller.delegate = self
controller.presentationContextProvider = self
controller.performRequests()

API Request

POST /api/auth/apple

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

JWT Tokens

Response Format

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

Using JWT in Requests

// Add JWT to request headers
var request = URLRequest(url: url)
request.setValue("Bearer \(jwtToken)", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")

API Endpoints

Complete REST API endpoints reference for our internal iOS rental management application

Base URL

https://rentmanager.io/api

Authentication

POST /auth/apple

Apple Sign-In authentication for iOS

POST /auth/refresh

Refresh JWT access token

GET /auth/logout

Logout and invalidate session

Properties

GET /properties

Get all properties for authenticated user

POST /properties

Create new property

GET /properties/{id}

Get property details by ID

PUT /properties/{id}

Update property information

DELETE /properties/{id}

Delete property

Rentals & Agreements

GET /rentals

Get all rental agreements

POST /agreements

Create new rental agreement

GET /agreements/{id}

Get agreement details

GET /agreements/{id}/pdf

Generate agreement PDF

Finances & Payments

GET /finances/balance

Get user account balance

GET /finances/transactions

Get transaction history

POST /payments

Process payment

GET /invoices

Get invoices list

iOS Implementation Examples

Swift code examples and implementation patterns for our development team

API Client Setup

import Foundation

class RentManagerAPI {
    static let shared = RentManagerAPI()
    private let baseURL = "https://rentmanager.io/api"
    private var jwtToken: String?
    
    private init() {}
    
    func setAuthToken(_ token: String) {
        self.jwtToken = token
    }
    
    private func createRequest(for endpoint: String, method: HTTPMethod = .GET) -> URLRequest? {
        guard let url = URL(string: baseURL + endpoint) else { return nil }
        
        var request = URLRequest(url: url)
        request.httpMethod = method.rawValue
        request.setValue("application/json", forHTTPHeaderField: "Content-Type")
        
        if let token = jwtToken {
            request.setValue("Bearer \(token)", forHTTPHeaderField: "Authorization")
        }
        
        return request
    }
}

enum HTTPMethod: String {
    case GET = "GET"
    case POST = "POST"
    case PUT = "PUT"
    case DELETE = "DELETE"
}

Fetch Properties

extension RentManagerAPI {
    func fetchProperties(completion: @escaping (Result<[Property], Error>) -> Void) {
        guard let request = createRequest(for: "/properties") else {
            completion(.failure(APIError.invalidURL))
            return
        }
        
        URLSession.shared.dataTask(with: request) { data, response, error in
            if let error = error {
                completion(.failure(error))
                return
            }
            
            guard let data = data else {
                completion(.failure(APIError.noData))
                return
            }
            
            do {
                let properties = try JSONDecoder().decode([Property].self, from: data)
                DispatchQueue.main.async {
                    completion(.success(properties))
                }
            } catch {
                completion(.failure(error))
            }
        }.resume()
    }
}

struct Property: Codable {
    let id: Int
    let type: String?
    let country: String
    let address: String
    let bedrooms: Int?
    let bathrooms: Int?
    let area: Double?
    let rentPrice: Double?
    let isAvailable: Bool
}

SwiftUI Integration

import SwiftUI

struct PropertiesView: View {
    @StateObject private var viewModel = PropertiesViewModel()
    
    var body: some View {
        NavigationView {
            List(viewModel.properties) { property in
                PropertyRowView(property: property)
            }
            .navigationTitle("Properties")
            .onAppear {
                viewModel.loadProperties()
            }
            .refreshable {
                viewModel.loadProperties()
            }
        }
    }
}

class PropertiesViewModel: ObservableObject {
    @Published var properties: [Property] = []
    @Published var isLoading = false
    
    func loadProperties() {
        isLoading = true
        RentManagerAPI.shared.fetchProperties { [weak self] result in
            self?.isLoading = false
            switch result {
            case .success(let properties):
                self?.properties = properties
            case .failure(let error):
                print("Error loading properties: \(error)")
            }
        }
    }
}

Need Help?

Internal documentation and resources for our iOS development team

Documentation

Internal guides and API reference for our iOS development team

View API Docs