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

# Get activity

> 特定のアクティビティを1件取得します。
公開範囲が `PUBLIC` な Company / Contact / Deal に1件も紐づかない場合も 404 ではなく、
`links` を空配列にした 200 を返します。紐づけがすべて解除された状態を取得側が
確定できるようにするためで、404 は「取得できない」ことのみを意味します。
発生源による扱いの違いは次のとおりです。
- `source_type` が `MEETING` / `MESSAGE`: 発生源が公開対象であれば取得できます。
  公開対象でない場合は 404 を返します。
- `source_type` が `OBJECT_CHANGE_EVENT`: 発生源側の公開判定はありません。
  アクティビティIDが分かっていれば、`links` が空でも 200 を返します。




## OpenAPI

````yaml /openapi.yaml get /v2/activities/{activityId}
openapi: 3.1.0
info:
  title: Frictio Public API
  version: 1.0.0-beta
servers:
  - url: https://public-api.frictio.ai
security:
  - ApiKeyAuth: []
paths:
  /v2/activities/{activityId}:
    get:
      summary: Get activity
      description: |
        特定のアクティビティを1件取得します。
        公開範囲が `PUBLIC` な Company / Contact / Deal に1件も紐づかない場合も 404 ではなく、
        `links` を空配列にした 200 を返します。紐づけがすべて解除された状態を取得側が
        確定できるようにするためで、404 は「取得できない」ことのみを意味します。
        発生源による扱いの違いは次のとおりです。
        - `source_type` が `MEETING` / `MESSAGE`: 発生源が公開対象であれば取得できます。
          公開対象でない場合は 404 を返します。
        - `source_type` が `OBJECT_CHANGE_EVENT`: 発生源側の公開判定はありません。
          アクティビティIDが分かっていれば、`links` が空でも 200 を返します。
      operationId: getV2Activity
      parameters:
        - $ref: '#/components/parameters/workspaceId'
        - $ref: '#/components/parameters/activityId'
      responses:
        '200':
          description: 成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V2Activity'
        '400':
          $ref: '#/components/responses/V2BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/V2NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  parameters:
    workspaceId:
      name: X-Workspace-Id
      in: header
      required: true
      description: ワークスペースID
      schema:
        type: string
      example: e1f2a3b4-...
    activityId:
      name: activityId
      in: path
      required: true
      description: アクティビティID
      schema:
        type: string
        format: uuid
      example: 11111111-2222-4333-8444-555555555555
  schemas:
    V2Activity:
      type: object
      required:
        - id
        - type
        - source_type
        - source_id
        - occurred_at
        - created_via
        - actor
        - links
      properties:
        id:
          type: string
          format: uuid
        type:
          type: string
          description: アクティビティ種別の識別子です。
        source_type:
          type: string
          enum:
            - MEETING
            - MESSAGE
            - OBJECT_CHANGE_EVENT
        source_id:
          type: string
          description: 発生元レコードのID（`source_type` に応じたリソースのID）です。
        occurred_at:
          type: string
          format: date-time
        created_via:
          type:
            - string
            - 'null'
          description: 'アクティビティの作成経路（例: `UI:WEB`）。取得できない場合は `null` です。'
          example: UI:WEB
        actor:
          oneOf:
            - $ref: '#/components/schemas/V2ActivityActor'
            - type: 'null'
        links:
          type: array
          description: >
            アクティビティに紐づくCRMコンテキスト。公開範囲が `PUBLIC` なCompany / Contact /
            Dealのみ含まれます。
          items:
            $ref: '#/components/schemas/V2ActivityLink'
    V2ActivityActor:
      type: object
      required:
        - kind
        - id
      description: |
        アクティビティの発生元。`activities.actor_type` が `MEMBER` かつメンバーが解決できた場合は
        `kind: member` で `id` にワークスペースメンバーの公開ID（`/v1/members` の `id` と同じ）を返します。
        それ以外（システム起因や解決できないメンバー）は `kind: system` で `id` は `null` になります。
      properties:
        kind:
          type: string
          enum:
            - member
            - system
        id:
          type:
            - string
            - 'null'
    V2ActivityLink:
      type: object
      description: |
        `context_type` は小文字（`GET /v2/objects` の object名に合わせています）、`origin` は大文字
        （webhook `record.activity_link.*` の `origin` に合わせています）です。フィールドごとに正本となる
        契約が異なるため、`source_type` や `actor.kind` を含めペイロード全体のcasingは意図的に統一していません。
      required:
        - context_type
        - context_id
        - origin
      properties:
        context_type:
          type: string
          enum:
            - company
            - contact
            - deal
        context_id:
          type: string
        origin:
          type: string
          enum:
            - DIRECT
            - DERIVED
          description: |
            CRMコンテキストとの紐付け経路です。`DIRECT` はアクティビティ自体が指すレコード、
            `DERIVED` は紐づく別レコード（例: Contactに紐づくCompany）から推論された関連であることを示します。
    V2Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
            request_id:
              type: string
    Error:
      type: object
      required:
        - statusCode
        - message
      properties:
        statusCode:
          type: integer
          description: HTTPステータスコード
          example: 404
        message:
          type: string
          description: エラーメッセージ
          example: Meeting not found
        error:
          type: string
          description: |
            エラー種別。メッセージ文字列付きで例外が生成された場合のみ含まれます。
          example: Not Found
  responses:
    V2BadRequest:
      description: 不正なリクエスト
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/V2Error'
    Unauthorized:
      description: APIキーが無効、失効、期限切れ、または未指定です
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            invalidApiKey:
              summary: 無効な API キー
              value:
                statusCode: 401
                message: Invalid API key
                error: Unauthorized
            missingApiKey:
              summary: API キー未指定
              value:
                statusCode: 401
                message: Missing X-Api-Key header
                error: Unauthorized
    Forbidden:
      description: 権限エラー
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 403
            message: Forbidden
    V2NotFound:
      description: リソースが見つからない
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/V2Error'
    TooManyRequests:
      description: レートリミット超過
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 429
            message: Too Many Requests
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key

````

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