Intercode SaaS Kit
  • Welcome to SaaS Starter Kit
  • Getting Started
    • Technology stack
    • Database Setup
    • Local Environment Setup
  • Basics
    • Dependencies
    • App architecture
    • Deployment
    • App roles
    • Endpoints List
      • Auth
      • Two Factor Auth
      • Businesses
      • Demo
      • Email
      • Export Document
      • Email Files
      • Files Demo
      • Leads
      • Orders
      • Payments
      • Subscriptions
      • Teams
      • Team Memberships
      • User Admin
  • Animation and Styles
    • Framer Motion
    • Ant Design and Styles
  • Pages
    • Auth
      • Working with PassportJS
      • Two-Factor Auth
      • OAuth Providers
    • Leads
    • Businesses
    • Team management
      • Ownership
    • Profile
    • User Settings
      • App Tour
    • App Settings
      • Lead Statuses
    • Dashboard
      • Lead volume widget
      • Doughnut chart widget
      • Recent leads table widget
      • Lead count over period widget
    • Demo
  • Features
    • Impersonation
    • Subscriptions (Stripe)
    • Search
    • Sentry
    • Captcha
    • Audit Logs
    • Internationalization
  • External integrations
    • Mailer
    • Google oAuth2
    • Facebook oAuth2
    • S3 compatible storage (AWS, MinIO)
Powered by GitBook
On this page
  1. Basics
  2. Endpoints List

Businesses

PreviousTwo Factor AuthNextDemo

Last updated 6 months ago

GET

POST

PATCH

PUT

DELETE

Retrieves all active businesses for the user's team.

get
Responses
200
Businesses retrieved successfully
application/json
get
GET /businesses HTTP/1.1
Host: 
Accept: */*
200

Businesses retrieved successfully

{
  "count": 10,
  "businesses": [
    {
      "id": 1,
      "name": "Business Name",
      "phones": [
        "123-456-7890"
      ],
      "email": "business@example.com",
      "contactPerson": {
        "id": 1,
        "firstName": "John",
        "lastName": "Doe",
        "photo": "https://example.com/photo.jpg"
      },
      "team": {
        "id": "team_id"
      }
    }
  ]
}

Searches for businesses based on the provided search term.

get
Query parameters
searchstringRequired

The search term to use for finding businesses.

Example: Business Name
Responses
200
Businesses retrieved successfully
application/json
429
Too many requests
application/json
get
GET /businesses/search?search=Business+Name HTTP/1.1
Host: 
Accept: */*
[
  {
    "id": 1,
    "name": "Business Name",
    "phones": [
      "123-456-7890"
    ],
    "email": "business@example.com",
    "contactPerson": {
      "id": 1,
      "firstName": "John",
      "lastName": "Doe",
      "photo": "https://example.com/photo.jpg"
    },
    "team": {
      "id": "team_id"
    }
  }
]

Retrieves all archived businesses for the user's team.

get
Responses
200
Archived businesses retrieved successfully
application/json
get
GET /businesses/archived HTTP/1.1
Host: 
Accept: */*
200

Archived businesses retrieved successfully

{
  "count": 5,
  "businesses": [
    {
      "id": 1,
      "name": "Business Name",
      "phones": [
        "123-456-7890"
      ],
      "email": "business@example.com",
      "contactPerson": {
        "id": 1,
        "firstName": "John",
        "lastName": "Doe",
        "photo": "https://example.com/photo.jpg"
      },
      "team": {
        "id": "team_id"
      }
    }
  ]
}

Retrieves all team members who are not associated with any business.

get
Responses
200
Members retrieved successfully
application/json
get
GET /businesses/members-without-business HTTP/1.1
Host: 
Accept: */*
200

Members retrieved successfully

{
  "count": 5,
  "users": [
    {
      "id": 1,
      "firstName": "John",
      "lastName": "Doe",
      "phoneNumber": "123-456-7890",
      "email": "user@example.com",
      "teamRole": "Member",
      "membershipId": 1,
      "isActive": true,
      "isDeleted": false,
      "deletedAt": "2023-01-01T00:00:00Z"
    }
  ]
}

Retrieves a business by its ID.

get
Path parameters
idstringRequired
Responses
200
Business retrieved successfully
application/json
400
Invalid ID
application/json
404
Business not found
application/json
get
GET /businesses/{id} HTTP/1.1
Host: 
Accept: */*
{
  "id": 1,
  "name": "Business Name",
  "phones": [
    "123-456-7890"
  ],
  "email": "business@example.com",
  "contactPerson": {
    "id": 1,
    "firstName": "John",
    "lastName": "Doe",
    "photo": "https://example.com/photo.jpg"
  },
  "team": {
    "id": "team_id"
  }
}

Retrieves a photo for a business by its file name.

get
Path parameters
fileNamestringRequired
Responses
200
Photo retrieved successfully
application/json
Responsestring · binary
404
Photo not found
application/json
get
GET /businesses/get-photo/{fileName} HTTP/1.1
Host: 
Accept: */*
binary

Retrieves comments for a business by its ID.

get
Path parameters
idnumberRequired
Responses
200
Comments retrieved successfully
application/json
400
Invalid business ID
application/json
403
Access denied
application/json
404
Business not found
application/json
get
GET /businesses/comments/{id} HTTP/1.1
Host: 
Accept: */*
{
  "count": 5,
  "comments": [
    {
      "id": 1,
      "content": "This is a comment.",
      "user": {
        "id": 1,
        "firstName": "John",
        "lastName": "Doe",
        "email": "user@example.com"
      },
      "createdAt": "2023-01-01T00:00:00Z"
    }
  ]
}

Retrieves logs for a business by its ID.

get
Path parameters
idnumberRequired
Responses
200
Logs retrieved successfully
application/json
403
Access denied
application/json
404
Business not found
application/json
get
GET /businesses/logs/{id} HTTP/1.1
Host: 
Accept: */*
{
  "count": 5,
  "logs": [
    {
      "id": 1,
      "action": "CreateBusiness",
      "entityType": "Business",
      "user": {
        "id": 1,
        "email": "user@example.com"
      },
      "createdAt": "2023-01-01T00:00:00Z"
    }
  ]
}

Retrieves logs and comments for a business by its ID.

get
Path parameters
idnumberRequired
Responses
200
Logs and comments retrieved successfully
application/json
400
Invalid business ID
application/json
403
Access denied
application/json
404
Business not found
application/json
get
GET /businesses/logs-and-comments/{id} HTTP/1.1
Host: 
Accept: */*
{
  "logsAndComments": [
    {
      "id": 1,
      "action": "CreateBusiness",
      "entityType": "Business",
      "user": {
        "id": 1,
        "email": "user@example.com"
      },
      "content": "This is a comment.",
      "createdAt": "2023-01-01T00:00:00Z"
    }
  ],
  "logsCount": 5,
  "commentsCount": 5
}

Deletes a photo for a business by its file name.

delete
Path parameters
fileNamestringRequired
Responses
200
Photo deleted successfully
application/json
ResponseanyExample: {"message":"Photo deleted successfully","description":"The photo has been deleted successfully."}
404
Photo not found
application/json
delete
DELETE /businesses/delete-photo/{fileName} HTTP/1.1
Host: 
Accept: */*
{
  "message": "Photo deleted successfully",
  "description": "The photo has been deleted successfully."
}

Deletes a comment on a business.

delete
Path parameters
idnumberRequired
Responses
200
Comment deleted successfully
application/json
ResponseanyExample: {"message":"Comment deleted successfully","description":"The comment has been deleted successfully."}
400
Invalid comment ID
application/json
403
Access denied
application/json
delete
DELETE /businesses/comments/{id} HTTP/1.1
Host: 
Accept: */*
{
  "message": "Comment deleted successfully",
  "description": "The comment has been deleted successfully."
}
  • GET
  • GETRetrieves all active businesses for the user's team.
  • GETSearches for businesses based on the provided search term.
  • GETRetrieves all archived businesses for the user's team.
  • GETRetrieves all team members who are not associated with any business.
  • GETRetrieves a business by its ID.
  • GETRetrieves a photo for a business by its file name.
  • GETRetrieves comments for a business by its ID.
  • GETRetrieves logs for a business by its ID.
  • GETRetrieves logs and comments for a business by its ID.
  • POST
  • POSTCreates a new business.
  • POSTUploads a photo for a business.
  • POSTLeaves a comment on a business.
  • PATCH
  • PATCHArchives multiple businesses by their IDs.
  • PATCHRestores multiple archived businesses by their IDs.
  • PUT
  • PUTUpdates a business by its ID.
  • PUTEdits a comment on a business.
  • DELETE
  • DELETEDeletes multiple businesses by their IDs.
  • DELETEDeletes a photo for a business by its file name.
  • DELETEDeletes a comment on a business.

Creates a new business.

post
Body
namestringRequiredExample: Business Name
emailstringRequiredExample: business@example.com
descriptionstringRequiredExample: Business description
photostringRequiredExample: photo.jpg
phonesstring[]RequiredExample: ["123-456-7890"]
contactPersonnumberRequiredExample: 1
Responses
201
Business created successfully
application/json
400
Phones must be unique
application/json
post
POST /businesses HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 438

{
  "name": "Business Name",
  "address": {
    "addressOne": "123 Main St",
    "addressTwo": "Suite 100",
    "city": "Anytown",
    "country": "USA",
    "state": "CA",
    "zipCode": "12345"
  },
  "email": "business@example.com",
  "description": "Business description",
  "photo": "photo.jpg",
  "phones": [
    "123-456-7890"
  ],
  "contactPerson": 1,
  "socialMedia": {
    "youtube": "youtube.com/business",
    "facebook": "facebook.com/business",
    "instagram": "instagram.com/business",
    "twitter": "twitter.com/business"
  }
}
{
  "id": 1,
  "name": "Business Name",
  "phones": [
    "123-456-7890"
  ],
  "email": "business@example.com",
  "contactPerson": {
    "id": 1,
    "firstName": "John",
    "lastName": "Doe",
    "photo": "https://example.com/photo.jpg"
  },
  "team": {
    "id": "team_id"
  }
}

Uploads a photo for a business.

post
Body
idnumberOptionalExample: 1
photostring · binaryOptional
Responses
200
Photo uploaded successfully
application/json
ResponsestringExample: formatted_file_name.jpg
400
Invalid file
application/json
post
POST /businesses/upload-photo HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 25

{
  "id": 1,
  "photo": "binary"
}
formatted_file_name.jpg

Leaves a comment on a business.

post
Path parameters
idnumberRequired
Body
contentstringOptionalExample: This is a comment.
Responses
201
Comment added successfully
application/json
400
Invalid business ID
application/json
403
Access denied
application/json
404
Business not found
application/json
post
POST /businesses/comments/{id} HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 32

{
  "content": "This is a comment."
}
{
  "id": 1,
  "content": "This is a comment.",
  "user": {
    "id": 1,
    "firstName": "John",
    "lastName": "Doe",
    "email": "user@example.com"
  },
  "createdAt": "2023-01-01T00:00:00Z"
}

Archives multiple businesses by their IDs.

patch
Body
idsnumber[]RequiredExample: [1,2,3]
Responses
200
Businesses archived successfully
application/json
400
One or more businesses not found
application/json
patch
PATCH /businesses/archive HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 15

{
  "ids": [
    1,
    2,
    3
  ]
}
[
  {
    "id": 1,
    "name": "Business Name",
    "phones": [
      "123-456-7890"
    ],
    "email": "business@example.com",
    "contactPerson": {
      "id": 1,
      "firstName": "John",
      "lastName": "Doe",
      "photo": "https://example.com/photo.jpg"
    },
    "team": {
      "id": "team_id"
    }
  }
]

Restores multiple archived businesses by their IDs.

patch
Body
idsnumber[]RequiredExample: [1,2,3]
Responses
200
Businesses restored successfully
application/json
400
One or more businesses not found
application/json
patch
PATCH /businesses/restore HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 15

{
  "ids": [
    1,
    2,
    3
  ]
}
[
  {
    "id": 1,
    "name": "Business Name",
    "phones": [
      "123-456-7890"
    ],
    "email": "business@example.com",
    "contactPerson": {
      "id": 1,
      "firstName": "John",
      "lastName": "Doe",
      "photo": "https://example.com/photo.jpg"
    },
    "team": {
      "id": "team_id"
    }
  }
]

Updates a business by its ID.

put
Path parameters
idstringRequired
Body
namestringRequiredExample: Business Name
emailstringRequiredExample: business@example.com
descriptionstringRequiredExample: Business description
photostringRequiredExample: photo.jpg
phonesstring[]RequiredExample: ["123-456-7890"]
contactPersonnumberRequiredExample: 1
Responses
200
Business updated successfully
application/json
400
Invalid ID
application/json
404
Business not found
application/json
put
PUT /businesses/{id} HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 438

{
  "name": "Business Name",
  "address": {
    "addressOne": "123 Main St",
    "addressTwo": "Suite 100",
    "city": "Anytown",
    "country": "USA",
    "state": "CA",
    "zipCode": "12345"
  },
  "email": "business@example.com",
  "description": "Business description",
  "photo": "photo.jpg",
  "phones": [
    "123-456-7890"
  ],
  "contactPerson": 1,
  "socialMedia": {
    "youtube": "youtube.com/business",
    "facebook": "facebook.com/business",
    "instagram": "instagram.com/business",
    "twitter": "twitter.com/business"
  }
}
{
  "id": 1,
  "name": "Updated Business Name",
  "phones": [
    "123-456-7890"
  ],
  "email": "updated.business@example.com",
  "contactPerson": {
    "id": 1,
    "firstName": "John",
    "lastName": "Doe",
    "photo": "https://example.com/photo.jpg"
  },
  "team": {
    "id": "team_id"
  }
}

Edits a comment on a business.

put
Path parameters
idnumberRequired
Body
contentstringOptionalExample: This is an edited comment.
Responses
200
Comment edited successfully
application/json
400
Invalid comment ID
application/json
403
Access denied
application/json
404
Comment not found
application/json
put
PUT /businesses/comments/{id} HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 40

{
  "content": "This is an edited comment."
}
{
  "id": 1,
  "content": "This is an edited comment.",
  "user": {
    "id": 1,
    "firstName": "John",
    "lastName": "Doe",
    "email": "user@example.com"
  },
  "createdAt": "2023-01-01T00:00:00Z"
}

Deletes multiple businesses by their IDs.

delete
Body
idsnumber[]RequiredExample: [1,2,3]
Responses
200
Businesses deleted successfully
application/json
400
One or more businesses not found
application/json
delete
DELETE /businesses HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 15

{
  "ids": [
    1,
    2,
    3
  ]
}
[
  {
    "id": 1,
    "name": "Business Name",
    "phones": [
      "123-456-7890"
    ],
    "email": "business@example.com",
    "contactPerson": {
      "id": 1,
      "firstName": "John",
      "lastName": "Doe",
      "photo": "https://example.com/photo.jpg"
    },
    "team": {
      "id": "team_id"
    }
  }
]