LeadSquared Developer Centre

ON THIS PAGE

Create Tickets


Lets you create a new ticket.

You can pass as many ticket fields (including custom fields) as you want, but it is mandatory to pass at least one of the following lead fields –

  • LeadDetail.EmailAddress
  • LeadId
  • LeadDetail.Phone
Note: To obtain the host API URL, contact your account manager, or write to scsupport@leadsquared.com.

You can find the org ID after you log in to your LeadSquared account.

LeadSquared Service CRM

API URL

URL
Icon
POST {{HOST}}/api/tenants/{{org ID}}/tickets

Request

Content-Type: application/json
JSON Body/Payload Icon
{
   "TypeId":"1",
   "Id":null,
   "LeadId":"45b5fded-e696-45a6-9fbb-c6af6178229e",
   "Fields":[
      {
         "SchemaName":"Title",
         "Value":"Test ticket from API"
      },
      {
         "SchemaName":"RelatedCustomerId",
         "Value":"45b5fded-e696-45a6-9fbb-c6af6178229e"
      },
      {
         "SchemaName":"Description",
         "Value":"Test ticket from External API"
      },
      {
         "SchemaName":"Type",
         "Value":"General"
      },
      {
         "SchemaName":"Status",
         "Value":"Open"
      },
      {
         "SchemaName":"Priority",
         "Value":"Low"
      },
      {
         "SchemaName":"Channel",
         "Value":"Chat"
      }
   ],
   "RelatedTicketTypeId":1
}

Request Parameters

Parameter Description
TypeId

Specifies the ticket type. Pass 1 by default.

Id

Pass null.

Fields

Pass the schema names of the system and custom ticket and lead fields, along with their corresponding values.

You must include all the mandatory ticket fields configured in your account. Additionally, you must also include one of the following lead fields –

  • “EmailAddress” – The lead’s email address.
  • “LeadID” – The lead’s unique Id. To obtain this Id, refer to Get a Lead by Email or Get a Lead by Phone Number.
  • “LeadDetail.Phone” – The lead’s phone number.
RelatedTicketTypeId

Specifies the ticket type. Pass 1 by default.

Response

200 OK
Content-Type: application/json
{
    "Status": "Success",
    "ReasonForFailure": null,
    "Id": "34",
    "Message": null,
    "TicketId": "27e8259d-0681-4adb-b5e8-14f66a208dd4",
    "Key": "#034"
}

HTTP Response Codes

Code Description
200 OK

This is the status code for successful API call.

401 Unauthorized

The API call was made with invalid access credentials. Check your AccessKey and SecretKey.

400 Bad Request

The message body on the request is not as per API specification. Make sure that content type is set to “application/json” and the JSON body has correct attribute names and structure.

404 Not Found

The API could not be found. Please check the API signature.

429 Too Many Requests

API calls exceeded the limit of 25 in 5 second(s)

500 Internal Server Error

The API called failed. There could be many reasons for it. Check the exception message to get more details.

On this page

© 2024 by MarketXpander Services Pvt Ltd. All Rights Reserved.