### Complete Webviewer Example Source: https://github.com/procore/documentation/blob/main/example apps and sdks/bim_webviewer/bim_web_viewer.md A comprehensive example demonstrating viewer initialization, starting, retrieving camera direction, and checking model cache status. The `hasModel` method from the `Cache` namespace returns a promise. ```javascript const viewer = new ProcoreBim.Webviewer(options); // Starts the viewer, must be called. // `start` does not belong to a namespace. viewer.start(); // Gets the camera direction, `getCameraDirection()` belongs to // the `camera` namespace. var cameraDirection = viewer.camera.getCameraDirection(); // Checks if the model is cached, `hasModel` returns a promise // and belongs to the `Cache` namespace. ProcoreBim.Cache.hasModel({ meshUrl: 'samples/vortex.mesh', meshnodeUrl: 'samples/vortex.meshnode', nodeUrl: 'samples/vortex.node', }).then(function (isCached) { console.log(isCached); }); ``` -------------------------------- ### start() Source: https://github.com/procore/documentation/blob/main/example apps and sdks/bim_webviewer/novolib_bim_web_viewer.md Initializes and starts the WebViewer instance. This function must be called before interacting with the viewer or any of its namespaces. ```APIDOC ## start() ### Description Initializes and starts the WebViewer instance. This function must be called before interacting with the viewer or any of its namespaces. It sets up all necessary resources and event listeners required for the viewer to function. ### Returns `void` ### Example ```typescript const container = document.createElement("div"); container.style.width = "100vw"; container.style.height = "100vh"; document.body.appendChild(container); const webviewer = new Webviewer(container); webviewer.start(); ``` ``` -------------------------------- ### Initiate OAuth 2.0 Flow for Installed Apps Source: https://github.com/procore/documentation/blob/main/oauth/oauth_installed_apps.md Use this GET request to initiate the OAuth 2.0 flow for installed applications. Set the redirect_uri to 'urn:ietf:wg:oauth:2.0:oob' to signal that the authorization code should be returned in the URL. ```http GET https://login.procore.com/oauth/authorize?response_type=code&client_id=&redirect_uri=urn:ietf:wg:oauth:2.0:oob ``` -------------------------------- ### Start Webviewer Rendering Source: https://github.com/procore/documentation/blob/main/example apps and sdks/bim_webviewer/bim_web_viewer.md The entry point to the Webviewer that starts rendering. This method must be called. ```javascript start(); ``` -------------------------------- ### Install BIM Web Viewer SDK via NPM Source: https://github.com/procore/documentation/blob/main/example apps and sdks/bim_webviewer/bim_web_viewer.md Use this command to install the Procore BIM Web Viewer SDK using npm. This is the recommended installation method for production use. ```sh npm install @procore/bim-webviewer-sdk ``` -------------------------------- ### Install Jekyll Dependencies Source: https://github.com/procore/documentation/blob/main/README.md Navigate to the documentation folder and run this command to install the Jekyll framework and other required Ruby gems. ```bash bundle install ``` -------------------------------- ### Start Local Jekyll Server Source: https://github.com/procore/documentation/blob/main/README.md Run this command to start the Jekyll server locally. Access the documentation at http://127.0.0.1:4000/documentation/introduction. ```bash bundle exec jekyll serve ``` -------------------------------- ### Instantiate and Start the BIM Web Viewer Source: https://github.com/procore/documentation/blob/main/example apps and sdks/bim_webviewer/bim_web_viewer.md Create a new instance of the Procore BIM Web Viewer with specified options and then start the viewer. Refer to the [Options](#options) section for details on the `options` object. ```js const viewer = new ProcoreBim.Webviewer(options); viewer.start(); ``` -------------------------------- ### Complete Example: Event Listeners Source: https://github.com/procore/documentation/blob/main/example apps and sdks/bim_webviewer/bim_web_viewer.md This example demonstrates how to initialize the Webviewer and add event listeners for 'appResize' and 'bcfCameraSet'. The 'appResize' event provides data about the viewer's dimensions. ```javascript const viewer = new ProcoreBim.Webviewer(options); viewer.events.addEventListener('appResize', (data) => { // Called when the window resizes and returns an object with properties // `offsetHeight`, `offsetWidth`, `offsetLeft`, `offsetTop`. console.log(data.offsetHeight); }); viewer.events.addEventListener('bcfCameraSet', () => { // Called when the camera has been set, does not return any data. }); viewer.start(); ``` -------------------------------- ### Start WebViewer Instance Source: https://github.com/procore/documentation/blob/main/example apps and sdks/bim_webviewer/novolib_bim_web_viewer.md Initialize and start the WebViewer instance. This function must be called before interacting with the viewer or its namespaces. It sets up all necessary resources and event listeners. ```typescript const container = document.createElement("div"); container.style.width = "100vw"; container.style.height = "100vh"; document.body.appendChild(container); const webviewer = new Webviewer(container); webviewer.start(); ``` -------------------------------- ### Example Project Users Response Source: https://github.com/procore/documentation/blob/main/document_management_integration/document_management_technical_guide.md This is an example of the JSON response from the Project Users endpoint, showing user details including the 'id' required for updating document fields. ```json [ { "id": 8972757, "name": "Jane Doe", "first_name": "Jane", "last_name": "Doe" } ] ``` -------------------------------- ### Install Novolib BIM Web Viewer Source: https://github.com/procore/documentation/blob/main/example apps and sdks/bim_webviewer/novolib_bim_web_viewer.md Install the Novolib BIM Web Viewer module from NPM. This is the recommended method for integrating the viewer into your project. ```sh npm install @procore/novolib-pilot ``` -------------------------------- ### Example Project Fields Response Source: https://github.com/procore/documentation/blob/main/document_management_integration/document_management_technical_guide.md This is an example response from the List Project Fields endpoint. It shows the structure of project fields, including their IDs, names, labels, and configuration details like type, variant, and custom field definitions. ```json { "data": [ { "id": "01JDXMPK09FD0892J5BDMJD37D", "name": "type", "label": "Type", "description": "The document type", "position": "1", "active": true, "visible": true, "readonly": false, "can_affect_permissions": true, "type": "lov_entry", "variant": "single_select" }, { "id": "01JDXMPK0CFD0569F2Y8HEA04G", "name": "status", "label": "Status", "description": "The document status", "position": "2", "active": true, "visible": true, "readonly": false, "can_affect_permissions": true, "type": "lov_entry", "variant": "single_select" }, { "id": "01JDXMPK0GFP0R25B8T4DA6W0M", "name": "custom_field_123", "description": "Custom Field", "position": "3", "active": true, "visible": true, "readonly": false, "can_affect_permissions": false, "variant": "procore_location", "label": "Location_CF", "type": "reference", "custom_field_definition_id": "123" } ] } ``` -------------------------------- ### Initialize and Start BIM Web Viewer Source: https://github.com/procore/documentation/blob/main/example apps and sdks/bim_webviewer/bim_web_viewer_demo.md This snippet initializes the BIM Web Viewer with specified options, including the parent element, model URLs, and desired tools. Ensure the parent element exists in the DOM before initializing the viewer. The viewer is started immediately after initialization. ```javascript const options = { parentElement: document.getElementById('bim-webviewer-parent-element'), meshUrl: '/documentation/bim_webviewer/parcel.mesh', meshnodeUrl: '/documentation/bim_webviewer/parcel.meshnode', nodeUrl: '/documentation/bim_webviewer/parcel.node', modelId: 1, modelRevisionId: 1, tools: [ ProcoreBim.Webviewer.tools.CONTEXTMENU, ProcoreBim.Webviewer.tools.BOTTOMTOOL, ProcoreBim.Webviewer.tools.COACHMARKS, ProcoreBim.Webviewer.tools.MEASUREMENT_SD, ProcoreBim.Webviewer.tools.SETTINGS, ] }; const viewer = new ProcoreBim.Webviewer(options); viewer.start(); ``` -------------------------------- ### Example Document Upload Show Response Source: https://github.com/procore/documentation/blob/main/document_management_integration/document_management_technical_guide.md This is an example response from the Show Document Upload endpoint. It includes the document's ID, fields with their values and sources, upload status, integration statuses for ML and filename scraping, the `latest_event_id`, and user permissions. ```json { "data": { "id": "01JDXMPK0MTP0H41D4PYZ62R6R", "fields": [ { "id": "01JDXMPK09FD0892J5BDMJD37D", "name": "type", "type": "lov_entry", "values": [ { "id": "01JDXMPK0HMV0N14A7S3C95V9N", "code": "DRW", "label": "Drawing", "active": true, "tags": [] } ], "label_source": "MANUAL", "label": "Type", "description": "The document type" }, { "id": "01JDXMPK0BFD0670G3Z9JFB15F", "name": "revision", "type": "string", "values": [{ "label": "Rev A" }], "label_source": "MANUAL", "label": "Revision", "description": "The document revision identifier" } ], "upload_status": "COMPLETED", "integration_statuses": { "ml": "completed", "filename_scraping": "completed" }, "latest_event_id": "01JDXMPK0REV0D87H0JVVZ8M2W", "permissions": { "allowed_actions": ["view"] } } } ``` -------------------------------- ### Example JSON Request Body Source: https://github.com/procore/documentation/blob/main/api_essentials/restful_api_concepts.md This is an example of the JSON format expected for API requests, including company ID and project details. ```json { "company_id": 5, "project": { "name": "Project A", "description": "A description of the project", "address": "500 Construction Way", "city": "Carpinteria", "zip": "93013", "department_ids": [1,2], "project_number": "A-1", "estimated_start_date": "2015-05-15", "estimated_completion_date": "2015-05-31" } } ``` -------------------------------- ### Example JSON Response for File Download URL Source: https://github.com/procore/documentation/blob/main/best_practices/secure_file_access_tips.md This is an example of a JSON response that might contain a file download URL. The 'url' field under 'files[].file_versions[]' is the link to download the file. ```json { "id": 1, "files": [ { "id": 12, "name": "file.pdf", "file_versions": [ { "id": 12, "notes": "These are notes about the current file version.", "url": "www.file.com" } ] } ] } ``` -------------------------------- ### Example Response for Metadata Values Source: https://github.com/procore/documentation/blob/main/document_management_integration/document_management_technical_guide.md This is an example response structure for fetching metadata values. It includes 'id', 'code', 'label', and 'active' status for each metadata entry. Only active values can be used for populating document fields. ```json { "data": [ { "id": "01JDXMPK0HMV0N14A7S3C95V9N", "code": "DRW", "label": "Drawing", "active": true, "tags": [] }, { "id": "01JDXMPK0JMV0M23B6R2B84T8P", "code": "SPC", "label": "Specification", "active": true, "tags": [] }, { "id": "01JDXMPK0KMV0K32C5Q1A73S7Q", "code": "IMG", "label": "Image", "active": true, "tags": [] } ] } ``` -------------------------------- ### Webviewer Initialization and Core Methods Source: https://github.com/procore/documentation/blob/main/example apps and sdks/bim_webviewer/bim_web_viewer.md Demonstrates how to instantiate the Webviewer, start the rendering process, and terminate the viewer. These are fundamental methods for managing the webviewer lifecycle. ```APIDOC ## start() ### Description Entry point to the Webviewer and starts rendering. This method must be called. ### Method start ### Parameters None ### Returns undefined ### Namespace None --- ## terminate() ### Description Stops rendering, frees memory, and removes webviewer from parent element. ### Method terminate ### Parameters None ### Returns undefined ### Namespace None ``` -------------------------------- ### Example JSON Response with Date/Time Fields Source: https://github.com/procore/documentation/blob/main/best_practices/date_time.md Timestamps returned from Procore API GET requests are strings in ISO 8601 format. This example shows typical date/time fields in a JSON response. ```json { "id": 12877, "assignee": { "id": 1234567, "login": "joearchitect@proarchs.com", "name": "Joe Architect" }, "created_at": "2018-06-27T17:57:13Z", "created_by": { "id": 2468101, "login": "jdeveloper@prodevs.com", "name": "James Developer" }, "description": "We need to verify that that the final design complies with all applicable local zoning ordinances.", "due_date": "2018-08-17T00:00:00Z", "number": "1", "private": true, "status": "initiated", "task_item_category": { "id": 66043, "name": "Design" }, "title": "Verify zoning compliance", "updated_at": "2018-06-27T17:57:13Z" } ``` -------------------------------- ### Uom Constant Example in TypeScript Source: https://github.com/procore/documentation/blob/main/example apps and sdks/bim_webviewer/bim_web_viewer.md Demonstrates how to use the `UOM` constant to get a specific unit of measure string. The `Uom` type is a union of all valid unit strings. ```typescript const candelasPerSquareMeter: Uom = UOM.cdsqm; console.log(candelasPerSquareMeter); // => "cd/m²" ``` -------------------------------- ### Rest V2 API Pagination Example Source: https://github.com/procore/documentation/blob/main/announcements/new_rest_v2_version.md Shows a GET request for a collection endpoint using Rest V2 API, including the expected response structure with a 'data' envelope and pagination headers. ```http GET /rest/v2.0/companies/{company_id}/items { "data": [ { item }, { item }, ... ] } # And the associated pagination information is provided with these response headers `Per-Page`, `Total`, and `Link`. ``` -------------------------------- ### List Companies API Request Source: https://github.com/procore/documentation/blob/main/overview/quick_start_guide.md Example of how to make a GET request to list available companies using the Procore API. Ensure you include the Authorization header with your Bearer token. API calls use the https://sandbox.procore.com base URL. ```HTTP GET https://sandbox.procore.com/companies ``` -------------------------------- ### Get Camera Look At Source: https://github.com/procore/documentation/blob/main/example apps and sdks/bim_webviewer/bim_web_viewer.md Gets the camera target point in world space. ```APIDOC ## Get Camera Look At ### Description Gets the camera target. ### Method ```js getLookAt(); ``` ### Parameters None ### Returns ```js Promise<{ x: Number, y: Number, z: Number }> ``` ``` -------------------------------- ### downloadStart Source: https://github.com/procore/documentation/blob/main/example apps and sdks/bim_webviewer/bim_web_viewer.md Fires before requests are made to download the model. ```APIDOC ## downloadStart ### Description Fires before requests are made to download the model. ### Event downloadStart ``` -------------------------------- ### Initialize and Handle Floor Plan Events Source: https://github.com/procore/documentation/blob/main/example apps and sdks/bim_webviewer/bim_web_viewer.md Initializes the Procore BIM Web Viewer and sets up an event listener for floor plan interactions. Use this to manage the state when the 2D floor plan overlay opens or closes. ```javascript const viewer = new ProcoreBim.Webviewer(options); let floorPlanNavigateAndClose = null; viewer.events.addEventListener('floorPlan', (data) => { // Executed when the 2D floor plan overlay is interacted with. if (data.type === 'open') { // Your application might need to know when the 2D floor plan overlay is `open` and keep a reference to // floorPlanNavigateAndClose floorPlanNavigateAndClose = data.floorPlanNavigateAndClose; } }); viewer.start(); // Perhaps your application places markers that represent 3D positions on the 2D floor plan overlay while it is open. When // tapping on a marker, this function could be called that uses `floorPlanNavigateAndClose` to set the camera and close the // 2D floor plan overlay. const goto = (camera) => { if (floorPlanNavigateAndClose !== null) { floorPlanNavigateAndClose(camera.x, camera.y, camera.z, 0.1, 0.1); floorPlanNavigateAndClose = null; } }; ``` -------------------------------- ### Get Camera Look At Source: https://github.com/procore/documentation/blob/main/example apps and sdks/bim_webviewer/bim_web_viewer.md Gets the current target point the camera is looking at. This function is part of the Camera namespace. ```javascript getLookAt(); ``` -------------------------------- ### Example Budget Modification Request Body Source: https://github.com/procore/documentation/blob/main/tutorials/tutorial_budget_changes_api.md This is an example of a Budget Modification request body, showing the `to_budget_line_item_id`, `from_budget_line_item_id`, and `transfer_amount`. ```json { "budget_modification": { "to_budget_line_item_id": 1, "from_budget_line_item_id": 2, "notes": "Transfer money for extra concrete.", "transfer_amount": "4500.0" } } ``` -------------------------------- ### Create a Procore Webhook using cURL Source: https://context7.com/procore/documentation/llms.txt Example of creating a company-level webhook. Ensure to replace placeholder tokens and IDs with your actual values. ```bash # Step 1 — Create a company-level hook (POST /rest/v1.0/webhooks/hooks) curl -H "Authorization: Bearer " \ -H "Procore-Company-Id: 5358233" \ -H "Content-Type: application/json" \ -X POST https://api.procore.com/rest/v1.0/webhooks/hooks \ -d '{ "company_id": 5358233, "hook": { "api_version": "v2", "namespace": "acme-invoice-sync", "destination_url": "https://webhooks.yourdomain.com/events", "destination_headers": { "Authorization": "Bearer " } } }' ``` -------------------------------- ### Webviewer Constructor Source: https://github.com/procore/documentation/blob/main/example apps and sdks/bim_webviewer/novolib_bim_web_viewer.md Creates a new WebViewer instance and attaches it to the specified container element. Initializes the WebViewer with provided options, sets up the rendering root, and patches the Mirage fetch if needed. ```APIDOC ## Webviewer(container: HTMLElement, initOptions?: InitOptions) ### Description Creates a new WebViewer instance and attaches it to the specified container element. This constructor initializes the WebViewer with the provided options, sets up the rendering root, and patches the Mirage fetch if needed. The `initOptions` parameter allows you to specify authentication, scene ID, and beta feature flags. ### Parameters - `container: HTMLElement` - The DOM element to mount the WebViewer into. - `initOptions?: InitOptions` - Optional configuration for authentication, scene ID, and beta features. ### Example ```typescript const container = document.getElementById("webviewer-container"); const webviewer = new Webviewer(container, { auth, sceneId, enableBetaFeatures }); ``` ``` -------------------------------- ### Subcontractor Invoice Response Example Source: https://github.com/procore/documentation/blob/main/tutorials/tutorial_requisitions.md This is an example JSON response after creating a subcontractor invoice. Note the 'id' attribute, which is required for subsequent calls. ```json { "id": 1280646, "billing_date": "2017-11-01", "commitment_id": 786001, "invoice_number": "123", "origin_data": null, "origin_id": null, "percent_complete": "96.36%", "period_id": 117330, "status": "draft", "requisition_start": "2016-11-01", "requisition_end": "2016-11-30", "number": 19, "g702": { "balance_to_finish_including_retainage": "7300.00", "completed_work_retainage_percent": "10.00", "completed_work_retainage_amount": "5200.00", "contract_sum_to_date": "55000.00", "current_payment_due": "0.00", "less_previous_certificates_for_payment": "47700.00", "net_change_by_change_orders": "5000.00", "original_contract_sum": "50000.00", "stored_materials_retainage_amount": "100.00", "stored_materials_retainage_percent": "10.00", "total_completed_and_stored_to_date": "53000.00", "total_earned_less_retainage": "47700.00", "total_retainage": "5300.00" }, "attachments": [] } ``` -------------------------------- ### Initialize Viewer with Resources Source: https://github.com/procore/documentation/blob/main/example apps and sdks/bim_webviewer/bim_web_viewer.md Initializes the viewer with resource descriptors, supporting either file extractions or model revisions. Support for multiple resources is planned. ```javascript // File Extraction Initialization { resources: [ { fileExtractionId: 23 } ], } ``` ```javascript // Model Revision Initialization { resources: [ { modelId: 888, modelRevisionId: 999, meshUrl: 'https://foo.com/geometry/mesh' meshnodeUrl: 'https://foo.com/geometry/meshnode' nodeUrl: 'https://foo.com/geometry/node' } ], } ``` -------------------------------- ### Document Upload API Response Example Source: https://github.com/procore/documentation/blob/main/document_management_integration/document_management_metadata_details.md An example of the response structure from the Document Upload API, detailing various fields associated with a document. ```json { "id": "31OZMQFW8L1T82WOY8G7WH8TL", "fields": [ { "id": "MG8XE61LVYN2UKFYBQXSVI4F3", "name": "updated_at", "type": "timestamp", "values": [ { "label": "2000-01-01T00:00:00.000Z" } ], "label_source": "SYSTEM", "label": "Date Updated", "description": "The date and time the document was last updated" }, { "id": "FJI8TLPTERNJIQT6LF3W8MB0Z", "name": "uploaded_at", "type": "timestamp", "values": [ { "label": "2000-01-01T00:00:00.000Z" } ], "label_source": "SYSTEM", "label": "Date Uploaded", "description": "The date and time the document was uploaded to Procore" }, { "id": "NFQRRFRI2WXQNDKM8MHFG2FC6", "name": "in_active_workflow", "type": "lov_entry", "values": [ { "id": "TYRCJ5TIQ7ER8WGJXZMOIK9W5", "code": "", "tags": [], "label": "No", "active": true } ], "label_source": "SYSTEM", "label": "In Active Workflow", "description": "Indicates if the document is currently in an active workflow" }, { "id": "O1QROZV3IXNPAH2PJ72A4FK9B", "name": "uploaded_by", "type": "reference", "values": [ { "id": "8972757", "code": "", "label": "Jane Doe" } ], "variant": "procore_user", "label_source": "SYSTEM", "label": "Uploaded By", "description": "The person who uploaded the document to Procore" }, { "id": "LY9NVSGHOK9OF0TQP5SXS7SNI", "name": "file_size", "type": "string", "values": [ { "label": "405475" } ], "label_source": "SYSTEM", "label": "Size", "description": "The amount of storage or space the document uses" }, { "id": "4GZVLETC6T4ESGXW6ZYOX1FV5", "name": "classification", "type": "lov_entry", "values": [], "label_source": "NONE", "label": "Level", "description": "The level of a building or structure" }, { "id": "58IC8WRCV30EE1URJHN19TNY1", "name": "workflow_step_due_date", "type": "timestamp", "values": [], "label_source": "NONE", "label": "Workflow Step Due", "description": "The due date for the current workflow step to be completed" }, { "id": "64Q03PT52MF8LOWIZ7QKBVGWT", "name": "date_authored", "type": "timestamp", "values": [], "label_source": "ML_FAILED", "confidence_score": 0, "label": "Date Authored", "description": "The date the document was authored" }, { "id": "GT6JHAY20I1B8EU8W8OD79ZE7", "name": "originator", "type": "reference", "values": [], "variant": "procore_vendor", "label_source": "SYSTEM", "label": "Originator", "description": "The company that employs the author of a document " }, { "id": "TYDBJ9O0KI190ATV1DLMQ2NLZ", "name": "workflow_current_step", "type": "string", "values": [], "label_source": "NONE", "label": "Current Workflow Step", "description": "The Step in the workflow in which the document is currently at" }, { "id": "ZCSWZJS8VLG7CQXU8ECGGGG2Y", "name": "discipline", "type": "lov_entry", "values": [], "label_source": "SCRAPING_FAILED", "label": "Discipline", "description": "The discipline associated with this document like architectural, electrical, etc." }, { "id": "15WXIWB104E2ZO7O7UBZM55RK", "name": "created_at", "type": "timestamp", "values": [ { "label": "2026-01-14T20:10:05.754Z" } ], "label_source": "SYSTEM", "label": "Created At", "description": "The date the document was created" }, { "id": "IUEO5LXJU0MQUK5JA8BYDXUVC", "name": "project_stage", "type": "reference", "values": [], "variant": "procore_project_stage", "label_source": "NONE", "label": "Project Stage", "description": "The construction stage associated with the document. Formerly known as Stage." }, { "id": "VPGW834ONMDD9BY5SRJYAJJVS", "name": "location", "type": "reference", "values": [], "variant": "procore_location", "label_source": "NONE", "label": "Location", "description": "Locations associated with the document pulled from Project Locations" }, { "id": "NQ7KXAVMU8D7WLGGC230SX51Y", "name": "revision", "type": "string" } ] } ``` -------------------------------- ### Get Upload Status Source: https://github.com/procore/documentation/blob/main/tutorials/tutorial_unified_uploads.md Use the Get Upload Status endpoint to check the current state of an upload, or to poll until the file is fully processed and available. ```APIDOC ## GET /companies/{company_id}/projects/{project_id}/uploads/{upload_id} ### Description Retrieves the current status of a file upload. ### Method GET ### Endpoint /companies/{company_id}/projects/{project_id}/uploads/{upload_id} ### Parameters #### Path Parameters - **company_id** (integer) - Required - The ID of the company. - **project_id** (integer) - Required - The ID of the project. - **upload_id** (string) - Required - The ID of the upload to check. ### Response #### Success Response (200 OK) - **data** (object) - Contains upload details. - **upload_id** (string) - The ID of the upload. - **file_name** (string) - The original name of the file. - **sanitized_file_name** (string) - The sanitized file name. - **content_type** (string) - The MIME type of the file. - **file_size** (integer) - The size of the file in bytes. - **status** (string) - The current status of the upload (e.g., `ready`, `receiving`, `complete`, `available`). - **custom_metadata** (object) - Any custom metadata associated with the upload. - **segments** (array) - Information about the file segments. #### Response Example { "data": { "upload_id": "01JEXAMPLE00000000000000001", "file_name": "report.pdf", "sanitized_file_name": "report.pdf", "content_type": "application/pdf", "file_size": 2097152, "status": "complete", "custom_metadata": {}, "segments": [] } } ``` -------------------------------- ### Get Upload Requirements - GET Source: https://github.com/procore/documentation/blob/main/document_management_integration/document_management_technical_guide.md Retrieve the required fields for document uploads specific to a project. These fields must be populated in subsequent update calls. ```http GET /rest/v2.0/companies/8089/projects/2305/document_management/upload_requirements ``` -------------------------------- ### Create Project (REST API v1.x) Source: https://context7.com/procore/documentation/llms.txt Create a new project using the v1.x API. The request body must nest attributes under the 'project' key. Requires Authorization and Procore-Company-Id headers. ```bash # Create a project (POST) — v1.x request body must nest attributes under the resource key curl -H "Authorization: Bearer " \ -H "Procore-Company-Id: 9999" \ -H "Content-Type: application/json" \ -X POST https://api.procore.com/rest/v1.0/projects \ -d '{ "company_id": 5, "project": { "name": "Project A", "description": "A description of the project", "address": "500 Construction Way", "city": "Carpinteria", "zip": "93013", "project_number": "A-1", "estimated_start_date": "2015-05-15", "estimated_completion_date": "2015-05-31" } }' ``` -------------------------------- ### Batch Create/Update Projects via Sync Action Source: https://context7.com/procore/documentation/llms.txt Use sync actions to batch upsert up to 1,000 resources in a single request. Resources are matched by `id` or `origin_id`. This example creates two new projects. ```bash curl -H "Authorization: Bearer " \ -H "Procore-Company-Id: 9999" \ -H "Content-Type: application/json" \ -X POST https://api.procore.com/rest/v1.0/projects/sync \ -d '{ "updates": [ { "origin_id": "abc", "name": "New Project ABC" }, { "origin_id": "def", "name": "New Project DEF" } ] }' ``` -------------------------------- ### Get Project Fields - GET Source: https://github.com/procore/documentation/blob/main/document_management_integration/document_management_technical_guide.md Fetch available fields for document management within a project, including their IDs. These IDs are necessary for updating document metadata. ```http GET /rest/v2.0/companies/8089/projects/2305/document_management/fields ``` -------------------------------- ### Get Field Values - GET Source: https://github.com/procore/documentation/blob/main/document_management_integration/document_management_technical_guide.md Retrieve the available values and their corresponding IDs for specific document fields, such as 'type' or 'status'. These IDs are used when updating document fields. ```http GET /rest/v2.0/companies/8089/projects/2305/document_management/fields/type/values ``` ```http GET /rest/v2.0/companies/8089/projects/2305/document_management/fields/status/values ``` -------------------------------- ### Create Budget Change with Multiple 'From' Values Source: https://github.com/procore/documentation/blob/main/tutorials/tutorial_budget_changes_api.md This example shows how to represent a Budget Modification with multiple 'From' values by splitting the negative amount across several adjustment line items, each with a `budget_change` type and the same `adjustment_number`. ```json { "number": 10, "status": "draft", "title": "Equipment", "description": "Example description", "adjustment_line_items": [ { "ref": "item1", "adjustment_number": 1, "wbs_code_id": 2, "type": "change_event", "amount": 4500 }, { "ref": "item2", "adjustment_number": 1, "wbs_code_id": 4, "type": "budget_change", "amount": -2500 }, { "ref": "item3", "adjustment_number": 1, "wbs_code_id": 5, "type": "budget_change", "amount": -2000 } ] } ``` -------------------------------- ### REST API v1.x - Create Project Source: https://context7.com/procore/documentation/llms.txt Create a new project using the v1.x API. Request body must nest attributes under the resource key. ```APIDOC ## REST API v1.x — Create Project ### Description Creates a new project. The request body must nest attributes under the `project` key. ### Method POST ### Endpoint `https://api.procore.com/rest/v1.0/projects` ### Headers - **Authorization**: Bearer - **Procore-Company-Id**: (integer) - Required - **Content-Type**: application/json ### Request Body ```json { "company_id": 5, "project": { "name": "Project A", "description": "A description of the project", "address": "500 Construction Way", "city": "Carpinteria", "zip": "93013", "project_number": "A-1", "estimated_start_date": "2015-05-15", "estimated_completion_date": "2015-05-31" } } ``` ### Response #### Success Response (201 Created) ```json { "id": 185407, "name": "Project F", "display_name": "A-2 - Project F", "project_number": "A-2", "address": "500 Construction Way", "city": "Carpinteria", "state_code": "CA", "country_code": "US", "zip": "93013", "active": true, "estimated_start_date": "2015-05-15", "estimated_completion_date": "2015-05-31", "created_at": "2016-04-14T17:55:40Z", "updated_at": "2016-04-14T17:55:41Z", "office": { "id": 3610, "name": "Carpinteria" }, "project_stage": { "id": 1, "name": "Bidding" } } ``` ``` -------------------------------- ### Procore Webhook Incoming Event Payload Example Source: https://context7.com/procore/documentation/llms.txt Example of the JSON payload structure received by your webhook endpoint for a 'Direct Cost Line Items' update event. ```json # Incoming event payload (v3.0 format with related_resources): # POST https://webhooks.yourdomain.com/events # { # "id": 123456789, # "ulid": "0A1B2C3D4F5G6H7I8J9K0LMN", # "timestamp": "2025-02-06T23:34:12.246562Z", # "metadata": { "source_user_id": 987654321, "source_application_id": null, ... }, # "user_id": 987654321, # "company_id": 1357908642, # "project_id": 2468013579, # "api_version": "v3.0", # "event_type": "update", # "resource_name": "Direct Cost Line Items", # "resource_id": 379913, # "related_resources": [{ "id": 1234, "name": "Direct Costs" }] # } ``` -------------------------------- ### Clone Procore Documentation Repository Source: https://github.com/procore/documentation/blob/main/README.md Use this command to clone the Procore documentation repository to your local environment. ```bash git clone git@github.com:procore/documentation.git ``` -------------------------------- ### Initialize WebViewer Instance Source: https://github.com/procore/documentation/blob/main/example apps and sdks/bim_webviewer/novolib_bim_web_viewer.md Create a new WebViewer instance and attach it to a specified container element. The initOptions parameter allows for configuration of authentication, scene ID, and beta features. ```typescript const container = document.getElementById("webviewer-container"); const webviewer = new Webviewer(container, { auth, sceneId, enableBetaFeatures }); ``` -------------------------------- ### Validation Type Examples for ERP Metadata Source: https://github.com/procore/documentation/blob/main/erp_integration/erp_metadata_details.md Provides specific examples for various validation types, demonstrating how to configure 'enabled' status, 'length' constraints, and custom 'message' for user feedback. ```json "max_length": { "enabled": true, "length": 50, "message": "Address is too long. Maximum %{length} characters." } ``` ```json "max_length_decimal": { "enabled": true, "length": 4, "message": "Decimal value is too long" } ``` ```json "max_length_units": { "enabled": true, "length": 8, "message": "Value is too long" } ``` ```json "max_line_length": { "enabled": true, "length": 30, "message": "Description is too long" } ``` ```json "numeric": { "enabled": true, "message": "Value entered is not numeric" } ``` ```json "positive": { "enabled": true, "message": "Value entered has to be a postive numeric value" } ``` ```json "present": { "enabled": true, "message": "Must provide a value" } ``` -------------------------------- ### List Budget Views cURL Example Source: https://github.com/procore/documentation/blob/main/tutorials/tutorial_budget_line_items.md Use this cURL command to retrieve a list of all budget views available in a specific project. You will need the project ID. The response JSON contains the `id` for the desired budget view. ```curl curl -X GET https://api.procore.com/rest/v1.0/budget_views?project_id=123456 ``` -------------------------------- ### Create Budget Change from Budget Modification (Single From) Source: https://github.com/procore/documentation/blob/main/tutorials/tutorial_budget_changes_api.md This example demonstrates creating a Budget Change from a Budget Modification. The amount is split between positive and negative adjustment line items, using the WBS Code IDs from the original modification. ```json { "number": 10, "status": "draft", "title": "Equipment", "description": "Example description", "adjustment_line_items": [ { "ref": "item1", "adjustment_number": 1, "wbs_code_id": 2, "type": "change_event", "amount": 4500 }, { "ref": "item2", "adjustment_number": 1, "wbs_code_id": 4, "type": "budget_change", "amount": -4500 } ] } ``` -------------------------------- ### Obtain Access Token with Authorization Code Source: https://github.com/procore/documentation/blob/main/plan_your_app/developer_managed_service_accounts.md After obtaining an authorization code, make a POST request to the 'Get or Refresh an Access Token' endpoint with the code to get an access token for the logged-in user. ```http POST https://developers.procore.com/reference/rest/v1/authentication?version=1.0#get-or-refresh-an-access-token ``` -------------------------------- ### Get Latest Event ID - GET Source: https://github.com/procore/documentation/blob/main/document_management_integration/document_management_technical_guide.md Retrieve the latest event ID for a document upload and check integration statuses, such as ML processing. This is crucial for ensuring all document processing is complete before proceeding with further actions. ```http GET /rest/v2.0/companies/8089/projects/2305/document_management/document_uploads/01JDXMPK0MTP0H41D4PYZ62R6R ``` ```json { "data": { "id": "01JDXMPK0MTP0H41D4PYZ62R6R", "upload_status": "COMPLETED", "integration_statuses": { "ml": "completed", "filename_scraping": "completed" }, "latest_event_id": "01JDXMPK0REV0D87H0JVVZ8M2W", "fields": [ { "id": "01JDXMPK09FD0892J5BDMJD37D", "name": "type", "values": [{ "label": "Drawing" }], "label_source": "MANUAL" }, { "id": "01JDXMPK0BFD0670G3Z9JFB15F", "name": "revision", "values": [{ "label": "Rev A" }], "label_source": "MANUAL" }, { "id": "01JDXMPK0AFD0781H4ACKGC26E", "name": "name", "values": [{ "label": "Floor Plan Level 1" }], "label_source": "MANUAL" }, ``` -------------------------------- ### Create New Projects Source: https://github.com/procore/documentation/blob/main/tutorials/using_sync_actions.md This JSON payload demonstrates how to create new projects. Each project object requires at least an `origin_id` and a `name`. ```json { "entities": [ { "id": 6, "logo_url": "http://localhost:3000/assets/procore_logo_small.gif", "name": "New Project ABC", "display_name": "New Project ABC", "project_number": null, "address": null, "city": null, "state_code": null, "country_code": null, "zip": null, "latitude": null, "longitude": null, "description": null, "square_feet": null, "estimated_start_date": null, "estimated_completion_date": null, "active": true, "flag": null, "phone": null, "public_notes": null, "actual_start_date": "2016-07-25", "projected_finish_date": null, "created_at": "2016-07-25T12:02:09Z", "updated_at": "2016-07-25T12:02:09Z", "origin_id": "abc", "origin_data": null, "project_stage": { "id": 3, "name": "Course of Construction" }, "departments": [] }, { "id": 7, "logo_url": "http://localhost:3000/assets/procore_logo_small.gif", "name": "New Project DEF", "display_name": "New Project DEF", "project_number": null, "address": null, "city": null, "state_code": null, "country_code": null, "zip": null, "latitude": null, "longitude": null, "description": null, "square_feet": null, "estimated_start_date": null, "estimated_completion_date": null, "active": true, "flag": null, "phone": null, "public_notes": null, "actual_start_date": "2016-07-25", "projected_finish_date": null, "created_at": "2016-07-25T12:02:10Z", "updated_at": "2016-07-25T12:02:10Z", "origin_id": "def", "origin_data": null, "project_stage": { "id": 3, "name": "Course of Construction" }, "departments": [] } ], "errors": [] } ``` -------------------------------- ### Unified File Upload API Guide Source: https://github.com/procore/documentation/blob/main/document_management_integration/document_management_technical_guide.md This section outlines the process of uploading binary files using the V2.1 Unified File Upload API, which is separate from the V2 Document Management endpoints. This flow involves initializing the upload, uploading the binary bytes, completing the upload, and polling for status. ```APIDOC ## Unified File Upload API Flow ### Description Uploads binary files to Procore's storage service. This process is external to the V2 Document Management endpoints and involves multiple steps to ensure the file is processed and available. ### Steps 1. **POST** to initialize the upload session and receive presigned URL(s). 2. **PUT** to upload the binary bytes to the presigned URL(s). 3. **PATCH** to complete the upload. 4. **GET** to poll upload status until `data.status` is `available`. ### Key Information - Save `data.upload_id` from the file upload POST response. This will be used as your `file_upload_id` in Step 6 of the Document Management process. - Do not use the `upload_id` until the file status is `available`, confirming it is fully processed. - The binary file upload can be performed before or after the Create Document Uploads request (Step 4), but both must be completed before Step 6. ``` -------------------------------- ### Set Webviewer Configuration Options Source: https://github.com/procore/documentation/blob/main/example apps and sdks/bim_webviewer/bim_web_viewer.md Sets configuration options for the Webviewer. Currently, only the 'selection' option is supported. ```javascript setOptions(options); ``` -------------------------------- ### Enable Pre-built Tools Source: https://github.com/procore/documentation/blob/main/example apps and sdks/bim_webviewer/bim_web_viewer.md Specify an array of pre-built tools to be enabled in the Web Viewer. This can include constants or objects for tool-specific options. ```js [ ProcoreBim.Webviewer.tools.BOTTOMTOOL, ProcoreBim.Webviewer.tools.COACHMARKS, ProcoreBim.Webviewer.tools.MEASUREMENT_SD ]; ``` ```js [ ProcoreBim.Webviewer.tools.BOTTOMTOOL, { type: ProcoreBim.Webviewer.tools.MEASUREMENT_SD, center_lock: true } ]; ```