> For the complete documentation index, see [llms.txt](https://titans-productions.gitbook.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://titans-productions.gitbook.io/documentation/redm/scripts/companies/development-api/server.md).

# Server

The tp\_companies resource provides an API that allows other resources to interact with companies, retrieve company information, check company existence, and manage company accounts.

### Exports

API Getter Function

```lua
local CompaniesAPI = exports.tp_companies:getAPI()
```

1. Get all registered companies.

```lua
--- @return companies - requires a table (Returns all registered companies)
local companies = CompaniesAPI.GetCompanies()
```

2. Get the company data for a specific job.

```lua
--- @param job - requires a string (The job name of the company)
local company = CompaniesAPI.GetCompanyData(job)
```

3. Check if a company exists.

```lua
--- @param job - requires a string (The job name of the company)
local exists = CompaniesAPI.DoesCompanyExist(job)
```

4. Deposit money into a company account.

```lua
--- @param job - requires a string (The job name of the company)
--- @param amount - requires an integer value (The amount of money to deposit)
local success = CompaniesAPI.DepositCompanyAccount(job, amount)
```

5. Withdraw money from a company account.

```lua
--- @param job - requires a string (The job name of the company)
--- @param amount - requires an integer value (The amount of money to withdraw)
local success = CompaniesAPI.WithdrawFromCompanyAccount(job, amount)
```

6. Delete a company.

```lua
--- @param job - requires a string (The job name of the company)
--- @param callback - requires a function (The callback function that returns the deletion result)
CompaniesAPI.DeleteCompany(job, function(success)
    -- success = true if the company was successfully deleted
    -- success = false if the company could not be deleted
end)
```
