> This page is for Server SDKs.

> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# get

> Retrieve a specific message log entry.

Retrieve a specific message log entry.

### Schema

```yaml
openapi: 3.1.0
info:
  title: API
  version: 1.0.0
paths:
  /api/messaging/logs/{id}:
    get:
      operationId: subpackageMessageLogs_get_message_log
      summary: Get message log
      description: >-
        Retrieves one historical messaging record by log ID. Use it to inspect
        delivery details for a known message segment; this read-only endpoint
        does not send, retry, or redact the message. Use [List message
        logs](/docs/apis/rest/message-logs/list-message-logs) to discover log
        IDs or [Send a message](/docs/apis/rest/messages/create-message) for
        live messaging.


        #### Permissions


        The API token used to authenticate must have the following scope(s)
        enabled to make a successful request: _Messaging_.


        [Learn more about API scopes](/docs/platform/your-signalwire-api-space).
      tags:
        - subpackage_messageLogs
      parameters:
        - name: id
          in: path
          description: Unique ID of the log.
          required: true
          schema:
            $ref: '#/components/schemas/uuid'
      responses:
        '200':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Message.LogRetrieveResponse'
        '400':
          description: The request is invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Types.StatusCodes.StatusCode400'
        '422':
          description: The request contains invalid parameters. See errors for details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Message.MessageLogShowStatusCode422'
        '500':
          description: An internal server error occurred.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Types.StatusCodes.StatusCode500'
tags:
  - name: subpackage_messageLogs
servers:
  - url: https://%7BYour_Space_Name%7D.signalwire.com
    description: SignalWire API
components:
  schemas:
    uuid:
      type: string
      format: uuid
      description: Universal Unique Identifier.
      title: uuid
    MessageLogRetrieveResponseStatus:
      type: string
      enum:
        - queued
        - initiated
        - delivered
        - sent
        - received
        - undelivered
        - failed
      description: The status of the message.
      title: MessageLogRetrieveResponseStatus
    MessageLogRetrieveResponseDirection:
      type: string
      enum:
        - inbound
        - outbound
        - outbound-api
        - outbound-call
        - outbound-reply
      description: The direction of the message.
      title: MessageLogRetrieveResponseDirection
    MessageLogRetrieveResponseKind:
      type: string
      enum:
        - sms
        - mms
      description: The kind of message.
      title: MessageLogRetrieveResponseKind
    MessageLogRetrieveResponseSource:
      type: string
      enum:
        - realtime_api
        - laml
      description: Source of this log entry.
      title: MessageLogRetrieveResponseSource
    MessageLogRetrieveResponseType:
      type: string
      enum:
        - relay_message
        - laml_message
      description: Type of this log entry.
      title: MessageLogRetrieveResponseType
    Message.ChargeDetail:
      type: object
      properties:
        description:
          type: string
          description: Description for this charge.
        charge:
          type: number
          format: double
          description: Charged amount.
      required:
        - description
        - charge
      description: Details on charges associated with this log.
      title: Message.ChargeDetail
    Message.LogRetrieveResponse:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/uuid'
          description: A unique identifier for the log.
        from:
          type: string
          description: The origin phone number.
        to:
          type: string
          description: The destination phone number.
        status:
          $ref: '#/components/schemas/MessageLogRetrieveResponseStatus'
          description: The status of the message.
        direction:
          $ref: '#/components/schemas/MessageLogRetrieveResponseDirection'
          description: The direction of the message.
        kind:
          $ref: '#/components/schemas/MessageLogRetrieveResponseKind'
          description: The kind of message.
        source:
          $ref: '#/components/schemas/MessageLogRetrieveResponseSource'
          description: Source of this log entry.
        type:
          $ref: '#/components/schemas/MessageLogRetrieveResponseType'
          description: Type of this log entry.
        url:
          type:
            - string
            - 'null'
          format: uri
          description: >-
            URL for the resource associated with this log entry. Null for Relay
            messages.
        number_of_segments:
          type: integer
          description: The number of segments.
        charge:
          type: number
          format: double
          description: The charge in dollars.
        charge_details:
          type: array
          items:
            $ref: '#/components/schemas/Message.ChargeDetail'
          description: Details on charges associated with this log.
        created_at:
          type: string
          format: date-time
          description: Date and time when the message entry was created.
        error_message:
          type:
            - string
            - 'null'
          description: >-
            Description of the error when the message failed. Null when the
            message did not fail. LaML messages use the codes documented at
            https://signalwire.com/docs/compatibility-api/rest/error-codes.
        error_code:
          type:
            - string
            - 'null'
          description: >-
            Error code identifying why the message failed. Null when the message
            did not fail. Some Relay messages may have an `error_message`
            without an `error_code` — the `error_code` is a newer pattern that
            is not used in all Relay areas.
      required:
        - id
        - from
        - to
        - status
        - direction
        - kind
        - source
        - type
        - url
        - number_of_segments
        - charge
        - charge_details
        - created_at
        - error_message
        - error_code
      description: Response model for message log retrieve endpoint
      title: Message.LogRetrieveResponse
    TypesStatusCodesStatusCode400Error:
      type: string
      enum:
        - Bad Request
      title: TypesStatusCodesStatusCode400Error
    Types.StatusCodes.StatusCode400:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/TypesStatusCodesStatusCode400Error'
      required:
        - error
      description: The request is invalid.
      title: Types.StatusCodes.StatusCode400
    Types.StatusCodes.RestApiErrorItem:
      type: object
      properties:
        type:
          type: string
          description: The category of error.
        code:
          type: string
          description: A specific error code.
        message:
          type: string
          description: A description of what caused the error.
        attribute:
          type:
            - string
            - 'null'
          description: The request parameter that caused the error, if applicable.
        url:
          type: string
          description: A link to documentation about this error.
      required:
        - type
        - code
        - message
        - url
      description: Details about a specific error.
      title: Types.StatusCodes.RestApiErrorItem
    Message.MessageLogShowStatusCode422:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/Types.StatusCodes.RestApiErrorItem'
          description: List of validation errors.
      required:
        - errors
      description: The request contains invalid parameters. See errors for details.
      title: Message.MessageLogShowStatusCode422
    TypesStatusCodesStatusCode500Error:
      type: string
      enum:
        - Internal Server Error
      title: TypesStatusCodesStatusCode500Error
    Types.StatusCodes.StatusCode500:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/TypesStatusCodesStatusCode500Error'
      required:
        - error
      description: An internal server error occurred.
      title: Types.StatusCodes.StatusCode500

```

## **Response Example**

### Response (200)

```json
{
  "id": "string",
  "from": "+12077447397",
  "to": "+12029921413",
  "status": "failed",
  "direction": "inbound",
  "kind": "sms",
  "source": "laml",
  "type": "relay_message",
  "url": "https://example.signalwire.com/api/laml/2010-04-01/Accounts/c38dacad-2f6c-4de1-93d6-cc732e0c70c5/Messages/9ee38635-899a-490a-bfd1-9e72f5eea53c",
  "number_of_segments": 1,
  "charge": 0,
  "charge_details": [
    {
      "description": "Inbound SMS",
      "charge": 0.00415
    }
  ],
  "created_at": "2024-05-06T12:20:00Z",
  "error_message": "From number is not a SMS-capable phone number.",
  "error_code": "21601"
}
```

## **Example**

```python {9-10}
from signalwire.rest import RestClient

client = RestClient(
    project="your-project-id",
    token="your-api-token",
    host="your-space.signalwire.com",
)

msg = client.logs.messages.get("message-log-id")
print(msg.get("from"), "->", msg.get("to"))
```