Skip to main content

Editing User/Company API

The Editing User/Company API allows you to modify existing company or user details, such as contact information, address, and branding assets. This endpoint ensures that your data remains up to date and accurate.

Endpoint

PUT /api/company/edit

Request Body Schema

The following schema defines the updatable fields for user or company details:
const EditCompanySchema = z.object({
  griddid: z.string().readonly(),
  mainEmail: z.string().optional(),
  mainPhone: z.string().optional(),
  mainContact: z.string().optional(),
  webURL: z.string().optional(),
  address: z.string().optional(),
  city: z.string().optional(),
  state: z.string().optional(),
  zipCode: z.string().optional(),
  country: z.string().optional(),
  logo: z.number().optional(),
});
FieldTypeDescriptionRequired
griddidstringUnique GNET ID for the companyYes
mainEmailstringPrimary email for contactNo
mainPhonestringPrimary phone numberNo
mainContactstringName of the main contact personNo
webURLstringCompany website URLNo
addressstringStreet address of the companyNo
citystringCity where the company is locatedNo
statestringState where the company is locatedNo
zipCodestringPostal/ZIP codeNo
countrystringCountry where the company operatesNo
logonumberID of the company logo assetNo

Example Request

{
  "griddid": "company-slug",
  "mainEmail": "newemail@example.com",
  "mainPhone": "+1234567890",
  "mainContact": "Jane Doe",
  "webURL": "https://www.company.com",
  "address": "456 Elm St",
  "city": "New York",
  "state": "NY",
  "zipCode": "10001",
  "country": "USA",
  "logo": 42
}

Success Response

200 - OK

Indicates that the company or user details were successfully updated. Example Response:
{
  "success": true,
  "status": 200,
  "message": "Company details updated successfully."
}

Error Responses

StatusDescriptionPossible Causes
400Bad requestInvalid or missing fields in the request
404Not foundNo company or user associated with the provided GNET ID
422Parsing errorThe input data does not meet schema validation rules
500Internal server errorAn error occurred on the server while processing the request

Example Error Response

{
  "success": false,
  "status": 422,
  "error": "Parsing error: Invalid email format."
}

Best Practices

  • Validate your inputs: Use the dry run functionality in the Signup API to confirm the format of inputs before making live updates.
  • Provide only necessary fields: You do not need to include all fields in the request body—only the ones you want to update.
  • Handle 404 errors gracefully: If a GNET ID does not exist, suggest checking the ID or creating a new company.
Ready to integrate this endpoint? Check out the User Check API to validate if a user or company exists before editing their details.
I