Project Admin

Project Admin Endpoints

Bot EndpointPOST /admin/projects/:projectId/bot​ Creates a new OpenOrchid Bot. Posting to this endpoint creates a Bot resource and a corresponding ProjectMembership resource. Parameters​ { name: string; description?: string; accessPolicy?: Reference<AccessPolicy>; } Example request​ await medplum.post('admin/projects/:projectId/bot', { name: 'Hello World Bot', description: 'Hello world', accessPolicy: { reference: 'AccessPolicy/access-policy-id', }, }); medplum post admin/projects/:projectId/bot \ '{ "name": "Hello World Bot", "description": "Hello world", "accessPolicy": { "reference": "AccessPolicy/access-policy-id" } }' curl https://api.medplum.com/admin/projects/:projectId/bot \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Hello World Bot", "description": "Hello world", "accessPolicy": { "reference": "AccessPolicy/:access-policy-id" }' Example Response​ { resourceType: 'Bot', name: 'Hello World Bot', description: 'Hello world', runtimeVersion: 'awslambda', sourceCode: { contentType: 'text/typescript', title: 'index.ts', url: 'Binary/:uuid' }, id: ':bot-uuid', meta: { project: ':projectId', //... }, } Client Application EndpointPOST /admin/projects/:projectId/client​ Creates a new ClientApplication. Posting to this endpoint creates a ClientApplication resource and a corresponding ProjectMembership resource. Parameters​ { name: string; description?: string; redirectUri?: string; accessPolicy?: Reference<AccessPolicy>; identityProvider?: { authorizeUrl?: string; tokenUrl?: string; userInfoUrl?: string; clientId?: string; clientSecret?: string; useSubject?: boolean; } } Example request​ await medplum.post('admin/projects/:projectId/client', { name: 'Hello World Client', description: 'Client App for Medplum Hello World', redirectUri: 'https://example.com/redirect', accessPolicy: { reference: 'AccessPolicy/access-policy-id', }, }); medplum post admin/projects/:projectId/client \ '{ "name": "Hello World Client", "description": "Client App for Medplum Hello World", "redirectUri": "https://example.com/redirect" "accessPolicy": { "reference": "AccessPolicy/access-policy-id" } }' curl https://api.medplum.com/admin/projects/:projectId/client \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Hello World Client", "description": "Hello world", "redirectUri": "https://example.com/redirect" "accessPolicy": { "reference": "AccessPolicy/:access-policy-id" }' Example Response​ { meta: { project: ':projectId', //... }, resourceType: 'ClientApplication', name: 'Hello World Client', id: ':clientId', secret: ':clientSecret', description: 'Client App for Medplum Hello World', redirectUri: 'https://example.com/redirect' } Invite User EndpointPOST /admin/projects/:projectId/invite​ Invite a new user to the project. This will perform the following actions: Search for an existing user with the provided email, if given Select the provided membership.profile or search for an existing profile resource (Patient, Practitioner, or RelatedPerson) using the profile-selection rules Create a new User, if no existing User was found, Set the password if password is given Generate a password reset url Create a new profile resource, if no existing profile was found Create a corresponding ProjectMembership resource, for the (user, profile) pair Send an invite email, if sendEmail is true Parameters​ { resourceType: 'Patient' | 'Practitioner' | 'RelatedPerson'; firstName: string; lastName: string; email?: string; externalId?: string; patient?: Reference<Patient>; scope?: 'project' | 'server'; password?: string; sendEmail?: boolean; membership?: Partial<ProjectMembership>; upsert?: boolean; forceNewMembership?: boolean; mfaRequired?: boolean; } parameter description resourceType The User's profile resourceType firstName, lastName The first and last names that will be assigned to user's profile resource. Ignored if a profile resource already exists email The email address assigned to the User. User matching uses the email and the selected project or server scope. externalId The unique id provided by external identity provider (if applicable). See Using External Ids patient The Patient a new RelatedPerson is related to. Required when the invite creates a RelatedPerson. When the invite does not set an access policy, OpenOrchid copies this reference onto ProjectMembership.access.parameter as patient, which fills %patient in the default RelatedPerson policy. See Caregiver access. password The User's password scope The scope of the user. If project, the user will be scoped to the project. If server, the user will be a server scoped user. Defaults to server for Practitioners and project for Patients. See server vs project scoped user guide sendEmail If true, send an invite email to the user. If self-hosting, see our guide on setting up SES membership Used to override any fields of the resulting ProjectMembership resource. Common use cases include: Setting Access Policies upon invite Overriding the default ProjectMembership.profile upsert If true, allows updating existing users and profiles instead of creating new ones. When enabled, the invite will search for existing users and profiles and update them if found, rather than throwing an error message. forceNewMembership If true, creates an additional ProjectMembership instead of checking for an existing membership by User and project. For email-based invites, User matching still uses email and identity scope; profile selection is unchanged. mfaRequired If true, requires the user to set up Multi-Factor Authentication (MFA) during their first login. See MFA documentation for more details. Profile selection​ Here, a profile is the Patient, Practitioner, or RelatedPerson resource referenced by ProjectMembership.profile. The invite selects this resource separately from the User's sign-in identity: