Spiko Users API

The Users API from Spiko — 6 operation(s) for users.

OpenAPI Specification

spiko-users-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Spiko Distributor Account transactions Users API
  version: v0
  description: The Distributor API allows third parties like SaaS providers, fintechs or Web3 companies to distribute the Spiko Funds to their customers. With this API, you can programmatically manage investors, send subscription and redemption orders, and access real-time portfolio information.
servers:
- url: https://distributor-api.spiko.io
  description: Production Server
- url: https://distributor-api.preprod.spiko.io
  description: Pre-production Server
security: []
tags:
- name: Users
paths:
  /v0/investors/{investorId}/users:
    post:
      tags:
      - Users
      operationId: users.createInvestorInvitation
      parameters:
      - name: investorId
        in: path
        schema:
          type: string
          description: a Universally Unique Identifier
          format: uuid
        required: true
        description: a Universally Unique Identifier
      security:
      - basicAuth: []
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                anyOf:
                - type: object
                  required:
                  - type
                  - invitation
                  properties:
                    type:
                      type: string
                      enum:
                      - invitation-sent
                    invitation:
                      type: object
                      required:
                      - email
                      - firstName
                      - lastName
                      properties:
                        email:
                          $ref: '#/components/schemas/Lowercase'
                        firstName:
                          identifier: Name
                          type: string
                          title: Name
                          description: a valid name, of max size 255, non empty, without number, some special characters are forbidden
                        lastName:
                          identifier: Name
                          type: string
                          title: Name
                          description: a valid name, of max size 255, non empty, without number, some special characters are forbidden
                      additionalProperties: false
                  additionalProperties: false
                - type: object
                  required:
                  - type
                  - user
                  properties:
                    type:
                      type: string
                      enum:
                      - user-added
                    user:
                      type: object
                      required:
                      - userId
                      - email
                      - firstName
                      - lastName
                      properties:
                        userId:
                          type: string
                          description: a Universally Unique Identifier
                          format: uuid
                        email:
                          $ref: '#/components/schemas/Lowercase'
                        firstName:
                          identifier: Name
                          type: string
                          title: Name
                          description: a valid name, of max size 255, non empty, without number, some special characters are forbidden
                        lastName:
                          identifier: Name
                          type: string
                          title: Name
                          description: a valid name, of max size 255, non empty, without number, some special characters are forbidden
                      additionalProperties: false
                  additionalProperties: false
        '400':
          description: The request did not match the expected schema
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpApiDecodeError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                anyOf:
                - $ref: '#/components/schemas/Unauthorized'
                - $ref: '#/components/schemas/DistributorAuthenticationError'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
        '404':
          description: NotFound
        '409':
          description: Account already exists
          content:
            application/json:
              schema:
                anyOf:
                - $ref: '#/components/schemas/AccountAlreadyExistsApiError'
                - $ref: '#/components/schemas/InvitationAlreadyExistsApiError'
      description: "\n**Invite a new user to join an investor account.**\n\n- If the user already has a Spiko account, they will be added directly to the investor with the specified role.\n- If the user does not have a Spiko account, an invitation email will be sent.\n- Returns either the created invitation or the added user depending on the scenario.\n          "
      summary: Invite user to investor
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
              - email
              - firstName
              - lastName
              - role
              properties:
                email:
                  $ref: '#/components/schemas/Lowercase'
                firstName:
                  type: string
                  description: a string that will be trimmed
                lastName:
                  type: string
                  description: a string that will be trimmed
                role:
                  type: string
                  enum:
                  - admin
                  - viewer
                  title: Role
                  description: 'Role to assign to the invited user: "admin" for full access, "viewer" for read-only access.'
              additionalProperties: false
        required: true
    get:
      tags:
      - Users
      operationId: users.getUsersOfInvestor
      parameters:
      - name: investorId
        in: path
        schema:
          type: string
          description: a Universally Unique Identifier
          format: uuid
        required: true
        description: a Universally Unique Identifier
      security:
      - basicAuth: []
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  required:
                  - userId
                  - email
                  - firstName
                  - lastName
                  properties:
                    userId:
                      type: string
                      description: a Universally Unique Identifier
                      format: uuid
                    email:
                      $ref: '#/components/schemas/Lowercase'
                    firstName:
                      identifier: Name
                      type: string
                      title: Name
                      description: a valid name, of max size 255, non empty, without number, some special characters are forbidden
                    lastName:
                      identifier: Name
                      type: string
                      title: Name
                      description: a valid name, of max size 255, non empty, without number, some special characters are forbidden
                  additionalProperties: false
        '400':
          description: The request did not match the expected schema
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpApiDecodeError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                anyOf:
                - $ref: '#/components/schemas/Unauthorized'
                - $ref: '#/components/schemas/DistributorAuthenticationError'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
        '404':
          description: NotFound
      description: "\n**Retrieve all users associated with an investor.**\n\n- Returns the list of users with their roles (admin, manager, or viewer).\n          "
      summary: Get users of investor
  /v0/investors/{investorId}/invitations:
    get:
      tags:
      - Users
      operationId: users.getPendingInvitationsOfInvestor
      parameters:
      - name: investorId
        in: path
        schema:
          type: string
          description: a Universally Unique Identifier
          format: uuid
        required: true
        description: a Universally Unique Identifier
      security:
      - basicAuth: []
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  required:
                  - email
                  - firstName
                  - lastName
                  properties:
                    email:
                      $ref: '#/components/schemas/Lowercase'
                    firstName:
                      identifier: Name
                      type: string
                      title: Name
                      description: a valid name, of max size 255, non empty, without number, some special characters are forbidden
                    lastName:
                      identifier: Name
                      type: string
                      title: Name
                      description: a valid name, of max size 255, non empty, without number, some special characters are forbidden
                  additionalProperties: false
        '400':
          description: The request did not match the expected schema
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpApiDecodeError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                anyOf:
                - $ref: '#/components/schemas/Unauthorized'
                - $ref: '#/components/schemas/DistributorAuthenticationError'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
        '404':
          description: NotFound
      description: "\n**Retrieve all pending user invitations for an investor.**\n\n- Returns invitations that have been sent but not yet accepted.\n          "
      summary: Get pending invitations
  /v0/investors/{investorId}/invitations/{id}:
    get:
      tags:
      - Users
      operationId: users.getInvitationOfInvestor
      parameters:
      - name: investorId
        in: path
        schema:
          type: string
          description: a Universally Unique Identifier
          format: uuid
        required: true
        description: a Universally Unique Identifier
      - name: id
        in: path
        schema:
          type: string
          description: a Universally Unique Identifier
          format: uuid
        required: true
        description: a Universally Unique Identifier
      security:
      - basicAuth: []
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                anyOf:
                - type: object
                  required:
                  - id
                  - investorId
                  - email
                  - firstName
                  - lastName
                  - role
                  - createdAt
                  - status
                  properties:
                    id:
                      type: string
                      description: a Universally Unique Identifier
                      format: uuid
                    investorId:
                      type: string
                      description: a Universally Unique Identifier
                      format: uuid
                    email:
                      $ref: '#/components/schemas/Lowercase'
                    firstName:
                      identifier: Name
                      type: string
                      title: Name
                      description: a valid name, of max size 255, non empty, without number, some special characters are forbidden
                    lastName:
                      identifier: Name
                      type: string
                      title: Name
                      description: a valid name, of max size 255, non empty, without number, some special characters are forbidden
                    role:
                      type: string
                      enum:
                      - admin
                      - coordinator
                      - manager
                      - viewer
                      - legal-representative
                    createdAt:
                      type: string
                      title: valid range date
                      description: A valid date within the range 2020-2100
                    status:
                      type: string
                      enum:
                      - pending
                  additionalProperties: false
                - type: object
                  required:
                  - id
                  - investorId
                  - email
                  - firstName
                  - lastName
                  - role
                  - createdAt
                  - status
                  - acceptedAt
                  - userId
                  properties:
                    id:
                      type: string
                      description: a Universally Unique Identifier
                      format: uuid
                    investorId:
                      type: string
                      description: a Universally Unique Identifier
                      format: uuid
                    email:
                      $ref: '#/components/schemas/Lowercase'
                    firstName:
                      identifier: Name
                      type: string
                      title: Name
                      description: a valid name, of max size 255, non empty, without number, some special characters are forbidden
                    lastName:
                      identifier: Name
                      type: string
                      title: Name
                      description: a valid name, of max size 255, non empty, without number, some special characters are forbidden
                    role:
                      type: string
                      enum:
                      - admin
                      - coordinator
                      - manager
                      - viewer
                      - legal-representative
                    createdAt:
                      type: string
                      title: valid range date
                      description: A valid date within the range 2020-2100
                    status:
                      type: string
                      enum:
                      - accepted
                    acceptedAt:
                      type: string
                      title: valid range date
                      description: A valid date within the range 2020-2100
                    userId:
                      type: string
                      description: a Universally Unique Identifier
                      format: uuid
                  additionalProperties: false
        '400':
          description: The request did not match the expected schema
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpApiDecodeError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                anyOf:
                - $ref: '#/components/schemas/Unauthorized'
                - $ref: '#/components/schemas/DistributorAuthenticationError'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
        '404':
          description: NotFound
      description: "\n**Retrieve a user invitation by its ID.**\n\n- Returns the invitation with its current status (`pending` or `accepted`).\n- Useful for looking up an invitation when receiving an `investor-invitation.accepted` webhook.\n          "
      summary: Get invitation of investor
  /v0/investors/{investorId}/users/{userId}:
    delete:
      tags:
      - Users
      operationId: users.unlinkUser
      parameters:
      - name: investorId
        in: path
        schema:
          type: string
          description: a Universally Unique Identifier
          format: uuid
        required: true
        description: a Universally Unique Identifier
      - name: userId
        in: path
        schema:
          type: string
          description: a Universally Unique Identifier
          format: uuid
        required: true
        description: a Universally Unique Identifier
      security:
      - basicAuth: []
      responses:
        '204':
          description: Success
        '400':
          description: The request did not match the expected schema
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpApiDecodeError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                anyOf:
                - $ref: '#/components/schemas/Unauthorized'
                - $ref: '#/components/schemas/DistributorAuthenticationError'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
        '404':
          description: NotFound
      description: "\n**Remove a user from an investor account.**\n          "
      summary: Unlink user from investor
  /v0/investors/{investorId}/invitations/{email}:
    delete:
      tags:
      - Users
      operationId: users.deleteInvitation
      parameters:
      - name: investorId
        in: path
        schema:
          type: string
          description: a Universally Unique Identifier
          format: uuid
        required: true
        description: a Universally Unique Identifier
      - name: email
        in: path
        schema:
          $ref: '#/components/schemas/Lowercase'
        required: true
      security:
      - basicAuth: []
      responses:
        '204':
          description: Success
        '400':
          description: The request did not match the expected schema
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpApiDecodeError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                anyOf:
                - $ref: '#/components/schemas/Unauthorized'
                - $ref: '#/components/schemas/DistributorAuthenticationError'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
        '404':
          description: NotFound
      description: "\n**Delete a pending user invitation for an investor.**\n\n- Only pending (not yet accepted) invitations can be deleted.\n- The invitation is identified by the invitee's email address.\n          "
      summary: Delete pending invitation
  /v0/investors/{investorId}/invitations/{email}/resend:
    post:
      tags:
      - Users
      operationId: users.resendInvitation
      parameters:
      - name: investorId
        in: path
        schema:
          type: string
          description: a Universally Unique Identifier
          format: uuid
        required: true
        description: a Universally Unique Identifier
      - name: email
        in: path
        schema:
          $ref: '#/components/schemas/Lowercase'
        required: true
      security:
      - basicAuth: []
      responses:
        '204':
          description: Success
        '400':
          description: The request did not match the expected schema
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpApiDecodeError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                anyOf:
                - $ref: '#/components/schemas/Unauthorized'
                - $ref: '#/components/schemas/DistributorAuthenticationError'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
        '404':
          description: NotFound
      description: "\n**Resend the invitation email for a pending user invitation.**\n\n- Only pending (not yet accepted) invitations can be resent.\n- The invitation is identified by the invitee's email address.\n- A new invitation email is sent to the invitee.\n          "
      summary: Resend pending invitation
components:
  schemas:
    AccountAlreadyExistsApiError:
      type: object
      required:
      - reason
      - _tag
      properties:
        reason:
          type: string
        _tag:
          type: string
          enum:
          - AccountAlreadyExistsApiError
      additionalProperties: false
      description: Account already exists
    ForbiddenError:
      type: object
      required:
      - reason
      - _tag
      properties:
        reason:
          type: string
        customErrorCode:
          type: string
          enum:
          - AccountDoesNotBelongToInvestor
          - SessionIsNot2FA
          - InvestorDocumentLinkedToActiveBankAccount
          - AtLeastTwoAdminUsersRequired
          - InvestorNotPendingOnboarding
          - ShareClassNotAvailableForDistributor
        _tag:
          type: string
          enum:
          - ForbiddenError
      additionalProperties: false
      description: Forbidden
    HttpApiDecodeError:
      type: object
      required:
      - issues
      - message
      - _tag
      properties:
        issues:
          type: array
          items:
            $ref: '#/components/schemas/Issue'
        message:
          type: string
        _tag:
          type: string
          enum:
          - HttpApiDecodeError
      additionalProperties: false
      description: The request did not match the expected schema
    Issue:
      type: object
      required:
      - _tag
      - path
      - message
      properties:
        _tag:
          type: string
          enum:
          - Pointer
          - Unexpected
          - Missing
          - Composite
          - Refinement
          - Transformation
          - Type
          - Forbidden
          description: The tag identifying the type of parse issue
        path:
          type: array
          items:
            $ref: '#/components/schemas/PropertyKey'
          description: The path to the property where the issue occurred
        message:
          type: string
          description: A descriptive message explaining the issue
      additionalProperties: false
      description: Represents an error encountered while parsing a value to match the schema
    Lowercase:
      type: string
      description: a string that will be converted to lowercase
    DistributorAuthenticationError:
      type: object
      required:
      - reason
      - _tag
      properties:
        reason:
          type: string
        _tag:
          type: string
          enum:
          - DistributorAuthenticationError
      additionalProperties: false
      description: Authentication Error
    Unauthorized:
      $id: /schemas/void
      title: Unauthorized
    PropertyKey:
      anyOf:
      - type: string
      - type: number
      - type: object
        required:
        - _tag
        - key
        properties:
          _tag:
            type: string
            enum:
            - symbol
          key:
            type: string
        additionalProperties: false
        description: an object to be decoded into a globally shared symbol
    InvitationAlreadyExistsApiError:
      type: object
      required:
      - reason
      - _tag
      properties:
        reason:
          type: string
        _tag:
          type: string
          enum:
          - InvitationAlreadyExistsApiError
      additionalProperties: false
      description: Invitation already exists
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: Use your API client_id as username and client_secret as password.