Skip to content

CreateEntity

Creates an entity, such as a customer, shipper, carrier or transporter, as creating an entity in TrakIT does. Use it when your system has a new party that TrakIT must know, for example before you send it as the customer of a job with CreateJob. To change an entity later, use UpdateEntity.

How to sign in and read the response: Authentication, Responses.

POST /api/v1/CreateEntity
Token: your-token
Content-Type: application/json
{
"EntType": 1,
"Types": [8, 9],
"EntCode": "EXSHIP",
"EntName": "Example Shipping Co",
"CountryCode": "KE",
"Address": "1 Example Road, Example City",
"Contact": "John Smith",
"Phone": "+1 555 0100",
"Email": "ops@example.com",
"FinEmail": "accounts@example.com",
"TIN": "P000000000X",
"CurrCode": "USD",
"RespOffice": 3,
"Notify": true
}
Field Required Meaning
EntType Yes The entity’s main type, as a number: 0 carrier, 1 customer, 2 transporter, 3 bond agent, 4 clearing agent, 5 bank, 6 authority, 7 other, 8 shipper, 9 receiver. TrakIT Support names the types for your installation, so the names may differ: see Entity types. The main type cannot be changed later.
Types No The entity’s other types, as a list of the same numbers, for example [8, 9] for a customer that is also a shipper and a receiver. The main type and repeated numbers are skipped. To change them later, use UpdateEntityTypes.
EntName Yes Entity Name.
CountryCode Yes Country.
EntCode Yes, for most types Entity Code. Leave it out when TrakIT numbers the codes of the type itself.
The other fields No See Entity fields.

The field names are not case-sensitive: EntName and entname are the same.

The fields have the names GetEntity returns. The labels in bold are those of the entity’s fields, which describe what each one may hold. Send text fields as JSON text, IDs as JSON numbers, and on/off fields as true or false. For a text field, null is the same as an empty text.

Field Meaning
EntCode Entity Code, up to 25 characters, unique. Stored in capitals. For a type whose codes TrakIT numbers itself (the field is greyed out in TrakIT), leave it out: TrakIT gives the code, made of the type’s prefix and the entity’s ID.
EntName Entity Name, up to 150 characters. Two entities in the same country cannot have the same name.
LocalName Local Name.
CountryCode Country: the 2-letter ISO code, for example KE, or the country’s name as TrakIT has it, for example Kenya.
Address Postal Address, up to 500 characters.
Contact Contact Person(s), up to 50 characters.
Phone Phone Numbers, up to 50 characters.
WANum WhatsApp Numbers, in the format +[CountryCode][Number], separated by commas or semicolons.
Email, FinEmail, MgmtEmail General Emails, Finance Emails and Management Emails: addresses separated by commas or semicolons, up to 500 characters each.
Remarks Remarks, up to 1,000 characters.
TIN, RegN TIN and Registration. Stored in capitals.
SCAC Shipping Line (SCAC), for carriers only (as the main type or one of Types): the shipping line’s code, for example MAEU.
Account Default Account: letters, numbers, hyphens and slashes, up to 50 characters. Spaces are removed and letters are capitalized.
RespOffice Responsible Company: a company ID. When left out, the API user’s own company.
PCID Default Profit Center: the ID of an active profit centre of the responsible company, or 0 for none.
CurrCode Base Currency: one of the responsible company’s currencies, for example USD.
RespUser Responsible: a user ID.
GroupID Customer Group, for customers only (main type 1): a customer group ID, or 0 for none.
Notify Status Updates, for customers only. Needs Email, or WANum once WhatsApp is set up on your installation.
TrackLink Send Link, for customers only.
EnableAPI Enable API Access.
Active false to create the entity disabled (Disable). true when left out.

The entity’s logo, Agreed to WhatsApp, its entity data fields and its company-specific accounts on the Per Company tab cannot be set here.

TrakIT checks the request, reads the fields in the order you send them and stops at the first one it refuses. It then checks the entity as the entity page does. Nothing is saved unless every check passes.

Rule Info when it fails
The Token header holds a valid token. Token missing in header, Token invalid or expired, or another answer listed in Login token
The user is a system administrator with API access. API User must be SysAdmin with API Access
The request has a JSON body. No request body found
EntType is a whole number. EntType missing or invalid
Types, if sent, is a list of whole numbers. Types must be a list of entity type IDs, Entity type IDs must be integers
Each type exists and is in use. Entity type ... does not exist or is not in use
Each field is one of the fields above. ... is not recognized or supported
Text fields are text, on/off fields are true or false. ... must be text, ... must be true or false
RespOffice is an enabled company. RespOffice should be a company ID, Company ... does not exist or is disabled
PCID is an active profit centre of the responsible company. PCID should be a profit center ID, or 0, Profit center ... is not an active profit center of company ...
CurrCode is one of the responsible company’s currencies. Currency ... is not one of company ...'s currencies
RespUser is a user. User ... does not exist
GroupID is a customer group, and the entity is a customer. GroupID should be a customer group ID, or 0, Customer group ... does not exist, GroupID is only for entities whose main type is customer
Notify and TrackLink are true only for a customer. Notify is only for entities whose main type is customer, TrackLink is only for entities whose main type is customer
SCAC is sent only for a carrier. SCAC is only for carriers
EntCode is left out when TrakIT numbers the type’s codes. EntCode is set by TrakIT for this entity type
The entity’s details pass the entity page’s checks. Their messages, for example Entity Code must be specified, Entity Name must be specified, Country must be selected, Entity Code specified already exists, Entity Name specified already exists in selected country, Email ... is invalid
Your company’s validations for creating an entity pass. Their own messages

On success, Identity and RetInfo.EntID are the new entity’s ID, and RetInfo.EntCode is its code, the one TrakIT gave it when it numbers the type’s codes itself.

{
"Code": 1,
"Info": "",
"RetInfo": {
"EntID": 48211,
"EntCode": "EXSHIP"
},
"RowsAffected": 1,
"Scalar": null,
"Identity": 48211
}

Read the entity with GetEntity to see all its details.

  • The entity is enabled for its responsible company on the Per Company tab.
  • The creation is recorded in the entity’s Action Log under the API user’s name, with the other types assigned.
  • If entities of the type need approval, the new entity is not approved: a user approves it in TrakIT.
  • TrakIT then runs your company’s actions for creating an entity, tells the users who subscribed to entity notifications, and calculates the entity’s computed data fields.
  • WhatsApp numbers you send have not agreed to receive WhatsApp messages: a user records their consent on the entity page. See WhatsApp consent.