> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getprimo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Sync one SaaS identity from its application

> Read one identity from the application's API now, its account then its groups, roles, licenses and organization units, and record what changed; an identity linked to no employee is linked to the employee of its email. A recorded change also queues the application's background issues update. No other identity of the application is read: the application's own sync still runs every hour.

The answer is the identity as the application holds it now, or `identity: null` when the application no longer holds the account, which Primo then archives. It shows whether the application applied a change made through `provisionSaasIdentity`, `deprovisionSaasIdentity` or an assign or unassign tool; `recomputeSaasIdentityIssues` then judges the identity's issues again on what it read.

Answers 409 when the application does not read its identities through a connected API (manual provisioning, no integration, or the integration disconnected): its identities change only by hand. Answers 502, with the application's error, when the API refused the read.

Key: WriteScope: Company


## OpenAPI

````yaml https://api.getprimo.com/openapi.json post /saas/{saasId}/identities/{identityId}/sync
openapi: 3.1.1
info:
  title: Public API - BETA
  description: Read docs on https://docs.getprimo.com/
  version: '1.0'
  contact: {}
servers:
  - url: https://api.getprimo.com
security:
  - apikey: []
tags: []
paths:
  /saas/{saasId}/identities/{identityId}/sync:
    post:
      tags:
        - Saas
      summary: Sync one SaaS identity from its application
      description: >-
        Read one identity from the application's API now, its account then its
        groups, roles, licenses and organization units, and record what changed;
        an identity linked to no employee is linked to the employee of its
        email. A recorded change also queues the application's background issues
        update. No other identity of the application is read: the application's
        own sync still runs every hour.


        The answer is the identity as the application holds it now, or
        `identity: null` when the application no longer holds the account, which
        Primo then archives. It shows whether the application applied a change
        made through `provisionSaasIdentity`, `deprovisionSaasIdentity` or an
        assign or unassign tool; `recomputeSaasIdentityIssues` then judges the
        identity's issues again on what it read.


        Answers 409 when the application does not read its identities through a
        connected API (manual provisioning, no integration, or the integration
        disconnected): its identities change only by hand. Answers 502, with the
        application's error, when the API refused the read.
      operationId: syncSaasIdentity
      parameters:
        - name: saasId
          required: true
          in: path
          schema:
            type: string
        - name: identityId
          required: true
          in: path
          schema:
            type: string
      responses:
        default:
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SyncSaasIdentity_Output'
components:
  schemas:
    SyncSaasIdentity_Output:
      type: object
      properties:
        identity:
          description: >-
            The identity as the application holds it now, or `null` when the
            application no longer holds the account: Primo then archived the
            identity.
          anyOf:
            - type: object
              properties:
                id:
                  description: The SaaS identity ID, unchanged by the sync.
                  type: string
                employeeId:
                  description: >-
                    ID of the Primo employee linked to this identity, or `null`
                    when it is matched to none.
                  anyOf:
                    - type: string
                    - type: 'null'
                email:
                  type: string
                status:
                  description: >-
                    State of the account in the application. `INVITED`: the
                    account is not in use yet, either invited or pending on the
                    application's side, or emailed the application's sign-up
                    link and not seen signing in yet. An identity created by a
                    sign-up link turns `ACTIVE` only when Primo sees the
                    employee sign in, through the discovery of Google Workspace
                    or Microsoft Entra sign-ins on the invited address, or
                    through the sync of the application's API; without either it
                    stays `INVITED`. `ACTIVE`: the account is in use.
                    `SUSPENDED`: the application reports the account
                    deactivated.
                  type: string
                  enum:
                    - INVITED
                    - ACTIVE
                    - SUSPENDED
                groups:
                  description: >-
                    IDs of the groups the application answers this identity
                    holds.
                  type: array
                  items:
                    type: string
                roles:
                  description: >-
                    IDs of the roles the application answers this identity
                    holds.
                  type: array
                  items:
                    type: string
                licenses:
                  description: >-
                    IDs of the licenses the application answers this identity
                    holds.
                  type: array
                  items:
                    type: string
                organizationUnits:
                  description: >-
                    IDs of the organization units the application answers this
                    identity holds.
                  type: array
                  items:
                    type: string
              required:
                - id
                - employeeId
                - email
                - status
                - groups
                - roles
                - licenses
                - organizationUnits
              additionalProperties: false
            - type: 'null'
      required:
        - identity
      additionalProperties: false
  securitySchemes:
    apikey:
      scheme: bearer
      bearerFormat: API key
      type: http
      description: >-
        Use your Primo API key in the Authorization header as `Bearer
        <API_KEY>`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.