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

# Get Goal By Id

> Get a single goal by goalId. Returns different schema based on goal type (behavior, skill, rating, or interval)

## Get Goal By Id

Retrieve a single goal by its goalId. Returns different schema based on goal type (frequency\_duration, opportunity, rating, or interval).

### Headers

```
Authorization: Bearer <your-api-key>
```

### Path Parameters

* `goalId` (required): Goal public identifier

### Success Response (200)

Response varies by goal type.

#### Frequency/Duration Based Goal Response

```json theme={null}
{
  "type": "frequency_duration",
  "publicId": "goal_abc123",
  "targetMaladaptiveBehaviorName": "Aggression",
  "dataCollectionType": "FREQUENCY_AND_DURATION",
  "addedToTreatmentPlanAt": "2024-01-15T10:30:00Z",
  "goalStatement": "Reduce aggressive behavior during transitions",
  "definition": "Physical aggression including hitting, kicking, or pushing",
  "instructions": "Monitor and record instances during class transitions",
  "status": "IN_PROGRESS",
  "baselineDate": "2024-01-15T00:00:00Z",
  "targetAchievementDate": "2024-06-15T00:00:00Z",
  "progressSummary": "Showing improvement over past 2 weeks",
  "autoProgressToMaintenanceEnabled": false,
  "autoProgressToMasteredEnabled": false,
  "baselineMetric": {
    "publicId": "metric_123",
    "value": 10,
    "unit": "FREQUENCY",
    "frequencyUnit": "DAYS",
    "observationPeriod": 1,
    "observationPeriodUnit": "DAYS",
    "successCriteria": "EQUAL_TO"
  },
  "successMetric": {
    "publicId": "metric_124",
    "value": 2,
    "unit": "FREQUENCY",
    "frequencyUnit": "DAYS",
    "observationPeriod": 1,
    "observationPeriodUnit": "DAYS",
    "successCriteria": "LESS_THAN_OR_EQUAL_TO"
  },
  "maintenanceMetric": {
    "publicId": "metric_125",
    "value": 2,
    "unit": "FREQUENCY",
    "frequencyUnit": "DAYS",
    "observationPeriod": 1,
    "observationPeriodUnit": "DAYS",
    "successCriteria": "LESS_THAN_OR_EQUAL_TO"
  },
  "behaviorInstances": [
    {
      "publicId": "instance_abc",
      "quantity": 3,
      "durationSeconds": 120,
      "happenedAt": "2024-01-15T14:30:00Z",
      "antecedent": "Transition to next activity",
      "consequence": "Redirected to quiet area"
    }
  ]
}
```

#### Opportunity Based Goal Response

```json theme={null}
{
  "type": "opportunity",
  "publicId": "goal_xyz789",
  "goalStatement": "Complete hand washing sequence independently",
  "skillAcquisitionGoalType": "CHAINED_GOAL",
  "shortDescription": "Hand washing routine",
  "instructions": "Use task analysis with 8 steps",
  "skillCategory": "Self-care",
  "status": "IN_PROGRESS",
  "baselineDate": "2024-01-15T00:00:00Z",
  "targetAchievementDate": "2024-06-15T00:00:00Z",
  "progressSummary": "Currently at 60% independence",
  "minTrialsCount": 3,
  "enabledOutcomes": ["SUCCESS", "FAILURE", "PROMPTED"],
  "autoProgressToMaintenanceEnabled": false,
  "autoProgressToMasteredEnabled": false,
  "baselineMetric": {
    "publicId": "metric_126",
    "value": 20,
    "unit": "PERCENTAGE",
    "successCriteria": "EQUAL_TO"
  },
  "successMetric": {
    "publicId": "metric_127",
    "value": 80,
    "unit": "PERCENTAGE",
    "successCriteria": "GREATER_THAN_OR_EQUAL_TO"
  },
  "maintenanceMetric": {
    "publicId": "metric_128",
    "value": 80,
    "unit": "PERCENTAGE",
    "successCriteria": "GREATER_THAN_OR_EQUAL_TO"
  },
  "childGoals": [
    {
      "publicId": "goal_child1"
    }
  ],
  "skillTrials": [
    {
      "happenedAt": "2024-01-15T14:30:00Z",
      "trialOutcome": "SUCCESS"
    },
    {
      "happenedAt": "2024-01-15T14:35:00Z",
      "trialOutcome": "PROMPTED"
    }
  ]
}
```

#### Rating Goal Response

```json theme={null}
{
  "type": "rating",
  "publicId": "goal_rating123",
  "title": "Anxiety level during transitions",
  "description": "Rate anxiety on 1-10 scale",
  "instructions": "Observe and rate at start of each transition",
  "status": "IN_PROGRESS",
  "measurementType": "RATING",
  "ratingInstances": [
    {
      "publicId": "rating_abc",
      "rating": 7,
      "happenedAt": "2024-01-15T14:30:00Z"
    }
  ]
}
```

#### Interval Goal Response

```json theme={null}
{
  "type": "interval",
  "publicId": "goal_interval123",
  "title": "On-task behavior",
  "description": "Track engagement during work periods",
  "instructions": "Observe at end of each interval",
  "status": "IN_PROGRESS",
  "measurementType": "INTERVAL",
  "intervalDuration": 30,
  "intervalQuantity": 10,
  "sets": 3,
  "intervalRecordingType": "WHOLE",
  "window": 5,
  "intervalSets": [
    {
      "setNumber": 1,
      "happenedAt": "2024-01-15T14:00:00Z",
      "endTime": "2024-01-15T14:05:00Z",
      "present": 8,
      "absent": 2,
      "instances": [
        {
          "intervalNumber": 1,
          "isPresent": true,
          "happenedAt": "2024-01-15T14:00:00Z"
        }
      ]
    }
  ]
}
```

### Error Responses

#### 400 - Validation Error

```json theme={null}
{
  "error": "Validation error",
  "details": [
    {
      "code": "invalid_string",
      "message": "Invalid goalId format",
      "path": ["goalId"]
    }
  ]
}
```

#### 500 - Internal Server Error

```json theme={null}
{
  "error": "An unexpected error occurred"
}
```

## Examples

### cURL Example

```bash theme={null}
# Get goal by goalId
curl -X GET "https://app.hipp.health/api/v1/goals/goal_abc123" \
  -H "Authorization: Bearer your-api-key"
```

### JavaScript Example

```javascript theme={null}
const getGoalById = async (goalId) => {
  const response = await fetch(
    `https://app.hipp.health/api/v1/goals/${goalId}`,
    {
      method: "GET",
      headers: {
        Authorization: "Bearer your-api-key",
      },
    }
  );

  if (!response.ok) {
    const error = await response.json();
    throw new Error(error.error || "Failed to fetch goal");
  }

  return response.json();
};

// Usage
try {
  const goal = await getGoalById("goal_abc123");
  console.log("Goal:", goal);
  console.log("Type:", goal.type);
  console.log("Status:", goal.status);
} catch (error) {
  console.error("Error fetching goal:", error.message);
}
```


## OpenAPI

````yaml GET /v1/goals/{goalId}
openapi: 3.0.0
info:
  title: Hipp Health API
  version: 1.0.0
  description: API for managing users and resources within your Hipp Health organization
servers:
  - url: https://app.hipp.health/api
    description: Production Server
security: []
paths:
  /v1/goals/{goalId}:
    get:
      tags:
        - V1
      summary: Get goal by ID
      description: >-
        Get a single goal by goalId. Returns different schema based on goal type
        (behavior, skill, rating, or interval)
      operationId: get-v1-goals-{goalId}
      parameters:
        - in: path
          name: goalId
          schema:
            type: string
          required: true
          example: '123'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GoalDetailSchema'
        '400':
          $ref: '#/components/responses/400'
        '500':
          $ref: '#/components/responses/500'
components:
  schemas:
    GoalDetailSchema:
      type: object
      discriminator:
        propertyName: type
      oneOf:
        - $ref: '#/components/schemas/BehaviorGoalDetailSchema'
          title: Frequency/Duration Based
        - $ref: '#/components/schemas/SkillGoalDetailSchema'
          title: Opportunity Based
        - $ref: '#/components/schemas/RatingGoalDetailSchema'
          title: Rating Goal
        - $ref: '#/components/schemas/IntervalGoalDetailSchema'
          title: Interval Goal
    BehaviorGoalDetailSchema:
      type: object
      properties:
        type:
          type: string
        publicId:
          type: string
        targetMaladaptiveBehaviorName:
          type: string
          nullable: true
        dataCollectionType:
          $ref: '#/components/schemas/BehaviorDataCollectionType'
        addedToTreatmentPlanAt:
          type: string
          format: date-time
        goalStatement:
          type: string
        definition:
          type: string
          nullable: true
        instructions:
          type: string
          nullable: true
        status:
          $ref: '#/components/schemas/BehaviorGoalStatus'
        baselineDate:
          type: string
          format: date-time
          nullable: true
        targetAchievementDate:
          type: string
          format: date-time
          nullable: true
        progressSummary:
          type: string
          nullable: true
        autoProgressToMaintenanceEnabled:
          type: boolean
        autoProgressToMasteredEnabled:
          type: boolean
        isBehavior:
          type: boolean
        baselineMetric:
          $ref: '#/components/schemas/GoalMetricSchema'
        successMetric:
          $ref: '#/components/schemas/GoalMetricSchema'
        maintenanceMetric:
          $ref: '#/components/schemas/GoalMetricSchema'
        behaviorInstances:
          type: array
          items:
            type: object
            properties:
              publicId:
                type: string
              quantity:
                type: number
              durationSeconds:
                type: number
                nullable: true
              happenedAt:
                type: string
                format: date-time
              antecedent:
                type: string
              consequence:
                type: string
            required:
              - publicId
              - quantity
              - happenedAt
              - antecedent
              - consequence
          nullable: true
      required:
        - type
        - publicId
        - dataCollectionType
        - addedToTreatmentPlanAt
        - goalStatement
        - status
        - autoProgressToMaintenanceEnabled
        - autoProgressToMasteredEnabled
        - baselineMetric
        - successMetric
        - maintenanceMetric
    SkillGoalDetailSchema:
      type: object
      properties:
        type:
          type: string
        publicId:
          type: string
        goalStatement:
          type: string
        skillAcquisitionGoalType:
          $ref: '#/components/schemas/SkillAcquisitionGoalType'
        shortDescription:
          type: string
          nullable: true
        instructions:
          type: string
          nullable: true
        skillCategory:
          type: string
          nullable: true
        status:
          $ref: '#/components/schemas/SkillAcquisitionGoalStatus'
        baselineDate:
          type: string
          format: date-time
          nullable: true
        targetAchievementDate:
          type: string
          format: date-time
          nullable: true
        progressSummary:
          type: string
          nullable: true
        minTrialsCount:
          type: number
          nullable: true
        enabledOutcomes:
          type: array
          items:
            $ref: '#/components/schemas/TrialOutcomes'
        autoProgressToMaintenanceEnabled:
          type: boolean
        autoProgressToMasteredEnabled:
          type: boolean
        baselineMetric:
          $ref: '#/components/schemas/GoalMetricSchema'
        successMetric:
          $ref: '#/components/schemas/GoalMetricSchema'
        maintenanceMetric:
          $ref: '#/components/schemas/GoalMetricSchema'
        childGoals:
          type: array
          items:
            type: object
            properties:
              publicId:
                type: string
            required:
              - publicId
          nullable: true
        skillTrials:
          type: array
          items:
            type: object
            properties:
              happenedAt:
                type: string
                format: date-time
              trialOutcome:
                $ref: '#/components/schemas/TrialOutcomes'
                nullable: true
          nullable: true
      required:
        - type
        - publicId
        - goalStatement
        - skillAcquisitionGoalType
        - status
        - enabledOutcomes
        - autoProgressToMaintenanceEnabled
        - autoProgressToMasteredEnabled
        - baselineMetric
        - successMetric
        - maintenanceMetric
    RatingGoalDetailSchema:
      type: object
      properties:
        type:
          type: string
        publicId:
          type: string
        title:
          type: string
        description:
          type: string
          nullable: true
        instructions:
          type: string
          nullable: true
        status:
          $ref: '#/components/schemas/GoalStatus'
        measurementType:
          type: string
          enum:
            - RATING
        ratingInstances:
          type: array
          items:
            type: object
            properties:
              publicId:
                type: string
              rating:
                type: number
              happenedAt:
                type: string
                format: date-time
            required:
              - publicId
              - rating
              - happenedAt
      required:
        - type
        - publicId
        - title
        - status
        - measurementType
        - ratingInstances
    IntervalGoalDetailSchema:
      type: object
      properties:
        type:
          type: string
        publicId:
          type: string
        title:
          type: string
        description:
          type: string
          nullable: true
        instructions:
          type: string
          nullable: true
        status:
          $ref: '#/components/schemas/GoalStatus'
        measurementType:
          type: string
          enum:
            - INTERVAL
        intervalDuration:
          type: integer
        intervalQuantity:
          type: integer
        sets:
          type: integer
        intervalRecordingType:
          $ref: '#/components/schemas/IntervalRecordingType'
        window:
          type: integer
          nullable: true
        intervalSets:
          type: array
          items:
            type: object
            properties:
              setNumber:
                type: number
              happenedAt:
                type: string
              endTime:
                type: string
                format: date-time
                nullable: true
              present:
                type: number
              absent:
                type: number
              instances:
                type: array
                items:
                  type: object
                  properties:
                    intervalNumber:
                      type: number
                    isPresent:
                      type: boolean
                      nullable: true
                    happenedAt:
                      type: string
                  required:
                    - intervalNumber
                    - happenedAt
            required:
              - setNumber
              - happenedAt
              - present
              - absent
              - instances
      required:
        - type
        - publicId
        - title
        - status
        - measurementType
        - intervalDuration
        - intervalQuantity
        - sets
        - intervalRecordingType
        - intervalSets
    ValidationError:
      type: object
      properties:
        error:
          type: string
          example: Validation error
        details:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                example: invalid_string
              message:
                type: string
                example: Valid email is required
              path:
                type: array
                items:
                  type: string
                example:
                  - email
    BehaviorDataCollectionType:
      type: string
      enum:
        - FREQUENCY_ONLY
        - DURATION_ONLY
        - FREQUENCY_AND_DURATION
    BehaviorGoalStatus:
      type: string
      enum:
        - BASELINE
        - IN_MAINTENANCE
        - MASTERED
        - ARCHIVED
        - IN_PROGRESS
        - DISCONTINUED
        - FUTURE
        - ON_HOLD
    GoalMetricSchema:
      type: object
      properties:
        publicId:
          type: string
        value:
          type: number
          nullable: true
        unit:
          $ref: '#/components/schemas/GoalMetricUnit'
          nullable: true
        frequencyUnit:
          $ref: '#/components/schemas/GoalMetricFrequencyUnit'
          nullable: true
        observationPeriod:
          type: number
          nullable: true
        observationPeriodUnit:
          $ref: '#/components/schemas/GoalMetricFrequencyUnit'
          nullable: true
        successCriteria:
          $ref: '#/components/schemas/GoalMetricSuccessCriteria'
          nullable: true
      required:
        - publicId
    SkillAcquisitionGoalType:
      type: string
      enum:
        - SINGLE_TARGET_GOAL
        - MULTI_TARGET_GOAL
        - CHAINED_GOAL
        - MULTI_TARGET_GOAL_TARGET
        - CHAINED_GOAL_TARGET
    SkillAcquisitionGoalStatus:
      type: string
      enum:
        - IN_PROGRESS
        - IN_MAINTENANCE
        - MASTERED
        - DISCONTINUED
        - FUTURE
        - ON_HOLD
        - BASELINE
        - ARCHIVED
    TrialOutcomes:
      type: string
      enum:
        - SUCCESS
        - FAILURE
        - PROMPTED
        - FULL_PHYSICAL_PROMPT
        - PARTIAL_PHYSICAL_PROMPT
        - MODEL_PROMPT
        - GESTURE_PROMPT
        - VERBAL_PROMPT
        - VISUAL_PROMPT
        - ENVIRONMENTAL_PROMPT
        - SHAPING_PROMPT
        - TACTILE_PROMPT
        - TIME_DELAY_PROMPT
        - WITHIN_STIMULUS_POSITION_PROMPT
        - WITHIN_STIMULUS_FADING_CUE_PROMPT
        - VERBAL_FULL_MODEL_PROMPT
        - VERBAL_PARTIAL_MODEL_PROMPT
        - VERBAL_PHONEMIC_CUE_PROMPT
        - VERBAL_CONTEXTUAL_CUE_PROMPT
        - VERBAL_SIMULTANEOUS_IMITATION_PROMPT
        - VERBAL_ABA_ONLY_INDIRECT_PROMPT
        - PHYSICAL_PARTIAL_PROMPT
        - PHYSICAL_TOUCH_CUE_PROMPT
        - PHYSICAL_IMPLIED_TOUCH_PROMPT
        - PHYSICAL_SHADOW_PROMPT
        - PHYSICAL_HAND_OVER_HAND_PROMPT
        - PHYSICAL_MINIMAL_ASSIST_PROMPT
        - PHYSICAL_MODERATE_ASSIST_PROMPT
        - PHYSICAL_MAX_ASSIST_PROMPT
        - PHYSICAL_CONTACT_GUARD_PROMPT
        - ENVIRONMENTAL_STANDBY_ASSIST_PROMPT
        - ENVIRONMENTAL_MODIFICATION_PROMPT
        - ENVIRONMENTAL_LOSS_OF_BALANCE_PROMPT
        - ENVIRONMENTAL_INCREASED_COMPLETION_TIME_PROMPT
        - GESTURAL_POINTING_PROMPT
        - GESTURAL_MOTIONING_PROMPT
        - GESTURAL_PARTIAL_MODEL_PROMPT
        - GESTURAL_FULL_MODEL_PROMPT
        - VISUAL_POINTING_PROMPT
        - VISUAL_MOTIONING_PROMPT
        - VISUAL_CUE_PROMPT
        - WITHIN_STIMULUS_POSITION_5_PROMPT
        - WITHIN_STIMULUS_POSITION_4_PROMPT
        - WITHIN_STIMULUS_POSITION_3_PROMPT
        - WITHIN_STIMULUS_POSITION_2_PROMPT
        - WITHIN_STIMULUS_POSITION_1_PROMPT
        - WITHIN_STIMULUS_POSITION_EQUIDISTANT_MATERIALS_PROMPT
        - WITHIN_STIMULUS_FADING_DASHED_LINES_PROMPT
        - WITHIN_STIMULUS_FADING_TOUCH_POINTS_PROMPT
        - WITHIN_STIMULUS_FADING_COLOR_PROMPT
        - WITHIN_STIMULUS_FADING_TEXTUAL_PROMPT
        - WITHIN_STIMULUS_FADING_BORDERS_PROMPT
        - WITHIN_STIMULUS_FADING_HIGHLIGHTER_PROMPT
        - TIME_DELAY_5_SECONDS_PROMPT
        - TIME_DELAY_4_SECONDS_PROMPT
        - TIME_DELAY_3_SECONDS_PROMPT
        - TIME_DELAY_2_SECONDS_PROMPT
        - TIME_DELAY_1_SECOND_PROMPT
        - TIME_DELAY_0_SECONDS_PROMPT
        - SHAPING_TIME_PROMPT
        - SHAPING_RESPONSE_PROMPT
        - ORAL_POSTURAL_PROMPT
        - TACTILE_KINESTHETIC_PROMPT
        - INDEPENDENT_PROMPT
        - SUPERVISION_PROMPT
        - CONTACT_GUARD
        - MINIMAL_ASSISTANCE_PROMPT
        - MODERATE_ASSISTANCE_PROMPT
        - MAXIMAL_ASSISTANCE_PROMPT
        - TOTAL_ASSISTANCE_PROMPT
        - MINIMAL_VERBAL_PROMPTS_OR_ASSISTANCE_PROMPT
        - MODERATE_VERBAL_PROMPTS_OR_ASSISTANCE_PROMPT
        - MAXIMAL_VERBAL_PROMPTS_OR_ASSISTANCE_PROMPT
        - EXPECTANT_PAUSE_PROMPT
        - INDIRECT_NONVERBAL_PROMPT
        - INDIRECT_VERBAL_PROMPT
        - REQUEST_A_RESPONSE_PROMPT
        - PARTIAL_VERBAL_PROMPT
        - DIRECT_MODEL_PROMPT
        - PARTIAL_PHYSICAL_ASSISTANCE_PROMPT
        - PHYSICAL_PROMPT
    GoalStatus:
      type: string
      enum:
        - IN_PROGRESS
        - BASELINE
        - IN_MAINTENANCE
        - MASTERED
        - ON_HOLD
        - DISCONTINUED
        - FUTURE
        - ARCHIVED
    IntervalRecordingType:
      type: string
      enum:
        - PARTIAL
        - MOMENTARY
        - WHOLE
    GoalMetricUnit:
      type: string
      enum:
        - FREQUENCY
        - PERCENTAGE
        - DURATION
    GoalMetricFrequencyUnit:
      type: string
      enum:
        - SECONDS
        - MINUTES
        - HOURS
        - DAYS
        - WEEKS
        - SESSIONS
    GoalMetricSuccessCriteria:
      type: string
      enum:
        - EQUAL_TO
        - LESS_THAN
        - GREATER_THAN
        - LESS_THAN_OR_EQUAL_TO
        - GREATER_THAN_OR_EQUAL_TO
  responses:
    '400':
      description: Bad Request - Validation Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationError'
    '500':
      description: Internal Server Error
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: An unexpected error occurred

````