Skip to content

Create guest

Endpoint

POST /organizations/{org_id}/guests

This endpoint creates a new guest user record within the specified organization.

Request

Replace {org_id} with your Organization ID.

Headers

  • Authorization: Bearer {your_access_token}
  • Accept: application/json
  • X-Tallyfy-Client: APIClient
  • Content-Type: application/json

Body (JSON)

The request body requires a JSON object containing the details of the guest to be created.

Refer to the #definitions/createGuestInput schema in Swagger for all available properties. Key fields include:

  • email (string, required): The guest’s email address (must be unique within the org’s guests).
  • first_name (string, optional)
  • last_name (string, optional)
  • phone_1 (string, optional)
  • company_name (string, optional)
  • timezone (string, optional): E.g., Europe/Paris.
  • associated_members (array of integers, optional): User IDs of members associated with this guest.

Minimal Example Body:

{
"email": "new.guest@contractor.com"
}

More Comprehensive Example Body:

{
"email": "client.contact@acme.com",
"first_name": "Client",
"last_name": "Contact",
"company_name": "ACME Corp",
"phone_1": "+1-212-555-0123",
"associated_members": [1001, 1005]
}

Code Samples

const accessToken = 'YOUR_PERSONAL_ACCESS_TOKEN';
const orgId = 'YOUR_ORGANIZATION_ID';
const apiUrl = `https://go.tallyfy.com/api/organizations/${orgId}/guests`;
const guestData = {
email: "external.partner@partnerco.com",
first_name: "External",
last_name: "Partner",
company_name: "Partner Co"
};
const headers = new Headers();
headers.append('Authorization', `Bearer ${accessToken}`);
headers.append('Accept', 'application/json');
headers.append('X-Tallyfy-Client', 'APIClient');
headers.append('Content-Type', 'application/json');
fetch(apiUrl, {
method: 'POST',
headers: headers,
body: JSON.stringify(guestData)
})
.then(response => {
if (!response.ok) {
// Error handling (check for 422 if email exists)
return response.json().then(errData => { throw new Error(/*...*/); }).catch(() => { throw new Error(/*...*/); });
}
return response.json();
})
.then(data => {
console.log('Successfully created guest:');
console.log(JSON.stringify(data, null, 2));
})
.catch(error => {
console.error('Error creating guest:', error);
});

Response

A successful request returns a 200 OK or 201 Created status code and a JSON object containing the details of the newly created guest.

{
"data": {
"id": "new_guest_code_789", // Unique ID for this guest
"email": "external.partner@partnerco.com",
"last_accessed_at": null,
"details": {
"first_name": "External",
"last_name": "Partner",
"status": "active",
"company_name": "Partner Co",
// ... other details provided or defaulted ...
"created_at": "2024-05-21T16:00:00Z", // Note: Swagger might show this at top level
"updated_at": "2024-05-21T16:00:00Z" // Note: Swagger might show this at top level
}
}
}

If a guest with the provided email already exists, you will likely receive a 422 Unprocessable Entity error.